Documentation ¶
Index ¶
- Constants
- func DecodeMsg(data []byte, expectedFlags uint8) (interface{}, error)
- func EncodeMsg(msg Message) []byte
- type Ledger
- type Message
- type MessageType
- type MsgChunk
- type MsgGetBacklog
- type MsgGetConfirmedOutput
- type MsgGetConfirmedTransaction
- type MsgGetTxInclusionState
- type MsgGetUnspentAliasOutput
- type MsgOutput
- type MsgPostTransaction
- type MsgSetID
- type MsgTransaction
- type MsgTxInclusionState
- type MsgUnspentAliasOutput
- type MsgUpdateSubscriptions
Constants ¶
const ( // FlagClientToServer is set in a message type if the message is client to server FlagClientToServer = byte(0x80) // FlagServerToClient is set in a message type if the message is server to client FlagServerToClient = byte(0x40) )
const ChunkMessageHeaderSize = 3
ChunkMessageHeaderSize is the amount of bytes added by MsgChunk as overhead to each chunk
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ledger ¶
type Ledger interface { GetUnspentOutputs(addr ledgerstate.Address, f func(ledgerstate.Output)) GetOutput(outID ledgerstate.OutputID, f func(ledgerstate.Output)) bool GetOutputMetadata(outID ledgerstate.OutputID, f func(*ledgerstate.OutputMetadata)) bool GetConfirmedTransaction(txid ledgerstate.TransactionID, f func(*ledgerstate.Transaction)) bool GetTxInclusionState(txid ledgerstate.TransactionID) (ledgerstate.InclusionState, error) EventTransactionConfirmed() *events.Event EventTransactionBooked() *events.Event PostTransaction(tx *ledgerstate.Transaction) error Detach() }
Ledger is the interface between txstream and the underlying value tangle
type Message ¶
type Message interface { Write(w *marshalutil.MarshalUtil) Read(r *marshalutil.MarshalUtil) error Type() MessageType }
Message is the common interface of all messages in the txstream protocol
type MessageType ¶
type MessageType byte
MessageType represents the type of a message in the txstream protocol
type MsgChunk ¶
type MsgChunk struct {
Data []byte
}
MsgChunk is a special message for big data packets chopped into pieces
func (*MsgChunk) Read ¶
func (msg *MsgChunk) Read(m *marshalutil.MarshalUtil) error
func (*MsgChunk) Write ¶
func (msg *MsgChunk) Write(w *marshalutil.MarshalUtil)
type MsgGetBacklog ¶
type MsgGetBacklog struct {
Address ledgerstate.Address
}
MsgGetBacklog is a request to get the backlog for the given address. Server replies sending one MsgTransaction for each transaction with unspent outputs targeted to the address.
func (*MsgGetBacklog) Read ¶
func (msg *MsgGetBacklog) Read(m *marshalutil.MarshalUtil) error
func (*MsgGetBacklog) Type ¶
func (msg *MsgGetBacklog) Type() MessageType
Type returns the Message type
func (*MsgGetBacklog) Write ¶
func (msg *MsgGetBacklog) Write(w *marshalutil.MarshalUtil)
type MsgGetConfirmedOutput ¶
type MsgGetConfirmedOutput struct { Address ledgerstate.Address OutputID ledgerstate.OutputID }
MsgGetConfirmedOutput is a request to get a specific confirmed output from the ledger. It may or may not be consumed
func (*MsgGetConfirmedOutput) Read ¶
func (msg *MsgGetConfirmedOutput) Read(m *marshalutil.MarshalUtil) error
func (*MsgGetConfirmedOutput) Type ¶
func (msg *MsgGetConfirmedOutput) Type() MessageType
Type returns the Message type
func (*MsgGetConfirmedOutput) Write ¶
func (msg *MsgGetConfirmedOutput) Write(w *marshalutil.MarshalUtil)
type MsgGetConfirmedTransaction ¶
type MsgGetConfirmedTransaction struct { Address ledgerstate.Address TxID ledgerstate.TransactionID }
MsgGetConfirmedTransaction is a request to get a specific confirmed transaction from the ledger. Server replies with MsgTransaction.
func (*MsgGetConfirmedTransaction) Read ¶
func (msg *MsgGetConfirmedTransaction) Read(m *marshalutil.MarshalUtil) error
func (*MsgGetConfirmedTransaction) Type ¶
func (msg *MsgGetConfirmedTransaction) Type() MessageType
Type returns the Message type
func (*MsgGetConfirmedTransaction) Write ¶
func (msg *MsgGetConfirmedTransaction) Write(w *marshalutil.MarshalUtil)
type MsgGetTxInclusionState ¶
type MsgGetTxInclusionState struct { Address ledgerstate.Address TxID ledgerstate.TransactionID }
MsgGetTxInclusionState is a request to get the inclusion state for a transaction. Server replies with MsgTxInclusionState.
func (*MsgGetTxInclusionState) Read ¶
func (msg *MsgGetTxInclusionState) Read(m *marshalutil.MarshalUtil) error
func (*MsgGetTxInclusionState) Type ¶
func (msg *MsgGetTxInclusionState) Type() MessageType
Type returns the Message type
func (*MsgGetTxInclusionState) Write ¶
func (msg *MsgGetTxInclusionState) Write(w *marshalutil.MarshalUtil)
type MsgGetUnspentAliasOutput ¶
type MsgGetUnspentAliasOutput struct {
AliasAddress *ledgerstate.AliasAddress
}
MsgGetUnspentAliasOutput is a request to get the unique unspent AliasOutput for the given AliasAddress.
func (*MsgGetUnspentAliasOutput) Read ¶
func (msg *MsgGetUnspentAliasOutput) Read(m *marshalutil.MarshalUtil) error
func (*MsgGetUnspentAliasOutput) Type ¶
func (msg *MsgGetUnspentAliasOutput) Type() MessageType
Type returns the Message type
func (*MsgGetUnspentAliasOutput) Write ¶
func (msg *MsgGetUnspentAliasOutput) Write(w *marshalutil.MarshalUtil)
type MsgOutput ¶
type MsgOutput struct { Address ledgerstate.Address Output ledgerstate.Output OutputMetadata *ledgerstate.OutputMetadata }
MsgOutput is the response for MsgGetConfirmedOutput
func (*MsgOutput) Read ¶
func (msg *MsgOutput) Read(m *marshalutil.MarshalUtil) error
func (*MsgOutput) Write ¶
func (msg *MsgOutput) Write(w *marshalutil.MarshalUtil)
type MsgPostTransaction ¶
type MsgPostTransaction struct {
Tx *ledgerstate.Transaction
}
MsgPostTransaction is a request from the client to post a transaction in the ledger. No reply from server.
func (*MsgPostTransaction) Read ¶
func (msg *MsgPostTransaction) Read(m *marshalutil.MarshalUtil) error
func (*MsgPostTransaction) Type ¶
func (msg *MsgPostTransaction) Type() MessageType
Type returns the Message type
func (*MsgPostTransaction) Write ¶
func (msg *MsgPostTransaction) Write(w *marshalutil.MarshalUtil)
type MsgSetID ¶
type MsgSetID struct {
ClientID string
}
MsgSetID is a message from client informing its ID, used mostly for tracing/loging.
func (*MsgSetID) Read ¶
func (msg *MsgSetID) Read(m *marshalutil.MarshalUtil) error
func (*MsgSetID) Write ¶
func (msg *MsgSetID) Write(w *marshalutil.MarshalUtil)
type MsgTransaction ¶
type MsgTransaction struct { // Address is the address that requested the transaction Address ledgerstate.Address // Tx is the transaction being sent Tx *ledgerstate.Transaction }
MsgTransaction informs the client of a given confirmed transaction in the ledger.
func (*MsgTransaction) Read ¶
func (msg *MsgTransaction) Read(m *marshalutil.MarshalUtil) error
func (*MsgTransaction) Type ¶
func (msg *MsgTransaction) Type() MessageType
Type returns the Message type
func (*MsgTransaction) Write ¶
func (msg *MsgTransaction) Write(w *marshalutil.MarshalUtil)
type MsgTxInclusionState ¶
type MsgTxInclusionState struct { Address ledgerstate.Address TxID ledgerstate.TransactionID State ledgerstate.InclusionState }
MsgTxInclusionState informs the client with the inclusion state of a given transaction as a response from the given address.
func (*MsgTxInclusionState) Read ¶
func (msg *MsgTxInclusionState) Read(m *marshalutil.MarshalUtil) error
func (*MsgTxInclusionState) Type ¶
func (msg *MsgTxInclusionState) Type() MessageType
Type returns the Message type
func (*MsgTxInclusionState) Write ¶
func (msg *MsgTxInclusionState) Write(w *marshalutil.MarshalUtil)
type MsgUnspentAliasOutput ¶
type MsgUnspentAliasOutput struct { AliasAddress *ledgerstate.AliasAddress AliasOutput *ledgerstate.AliasOutput OutputMetadata *ledgerstate.OutputMetadata Timestamp time.Time }
MsgUnspentAliasOutput is the response for MsgGetUnspentAliasOutput
func (*MsgUnspentAliasOutput) Read ¶
func (msg *MsgUnspentAliasOutput) Read(m *marshalutil.MarshalUtil) error
func (*MsgUnspentAliasOutput) Type ¶
func (msg *MsgUnspentAliasOutput) Type() MessageType
Type returns the Message type
func (*MsgUnspentAliasOutput) Write ¶
func (msg *MsgUnspentAliasOutput) Write(w *marshalutil.MarshalUtil)
type MsgUpdateSubscriptions ¶
type MsgUpdateSubscriptions struct {
Addresses []ledgerstate.Address
}
MsgUpdateSubscriptions is a request from the client to subscribe to requests/transactions for the given addresses. Server will send all transactions containing unspent outputs to the address, and then whenever a relevant transaction is confirmed in the ledger, i will be sent in real-time.
func (*MsgUpdateSubscriptions) Read ¶
func (msg *MsgUpdateSubscriptions) Read(m *marshalutil.MarshalUtil) error
func (*MsgUpdateSubscriptions) Type ¶
func (msg *MsgUpdateSubscriptions) Type() MessageType
Type returns the Message type
func (*MsgUpdateSubscriptions) Write ¶
func (msg *MsgUpdateSubscriptions) Write(w *marshalutil.MarshalUtil)
Directories ¶
Path | Synopsis |
---|---|
Package chopper helps splitting messages into smaller pieces and reassemble them
|
Package chopper helps splitting messages into smaller pieces and reassemble them |