Class: Solace::Serializers::TransactionSerializer
- Inherits:
-
BaseSerializer
- Object
- Base
- BaseSerializer
- Solace::Serializers::TransactionSerializer
- Defined in:
- lib/solace/serializers/transaction_serializer.rb
Constant Summary collapse
- SIGNATURE_PLACEHOLDER =
([0] * 64).pack('C*')
Instance Attribute Summary
Attributes inherited from BaseSerializer
Instance Method Summary collapse
-
#encode_message ⇒ Array<Integer>
Encodes the message from the transaction.
-
#encode_signatures ⇒ Array<Integer>
Encodes the signatures of the transaction.
Methods inherited from BaseSerializer
Methods inherited from Base
Constructor Details
This class inherits a constructor from Solace::Serializers::BaseSerializer
Instance Method Details
#encode_message ⇒ Array<Integer>
Encodes the message from the transaction
42 43 44 |
# File 'lib/solace/serializers/transaction_serializer.rb', line 42 def record..to_bytes end |
#encode_signatures ⇒ Array<Integer>
Encodes the signatures of the transaction
Iterates over the number sum number of signatures and either encodes or sets the placeholder for each expected index in the signatures array.
The BufferLayout is:
- [Number of signatures (compact u16)]
- [Signatures (variable length)]
34 35 36 37 |
# File 'lib/solace/serializers/transaction_serializer.rb', line 34 def encode_signatures Codecs.encode_compact_u16(record.signatures.size).bytes + index_signatures(record..num_required_signatures) end |