Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Name = "shard_sequencer"
)
Functions ¶
This section is empty.
Types ¶
type Sequencer ¶
type Sequencer struct { shard.UnimplementedTransactionHandlerServer // contains filtered or unexported fields }
Sequencer handles sequencing game shard transactions.
func NewShardSequencer ¶
NewShardSequencer returns a new game shardsequencer server. It runs on a default port of 9601, unless the SHARD_SEQUENCER_PORT environment variable is set.
The sequencer exposes a single gRPC endpoint, SubmitShardTx, which will take in transactions from game shards, indexed by namespace. At every block, the sequencer tx queue is flushed, and processed in the storage shard storage module, persisting the data to the blockchain.
func (*Sequencer) FlushMessages ¶
func (s *Sequencer) FlushMessages() []*types.SubmitShardTxRequest
FlushMessages empties and returns all messages stored in the queue.
func (*Sequencer) Submit ¶
func (s *Sequencer) Submit(_ context.Context, req *shard.SubmitTransactionsRequest) ( *shard.SubmitTransactionsResponse, error)
Submit appends the game shard tx submission to the tx queue.
type TxQueue ¶
type TxQueue struct {
// contains filtered or unexported fields
}
TxQueue acts as a transaction queue. Transactions come in to the TxQueue with an epoch.
func NewTxQueue ¶
func (*TxQueue) GetTxs ¶
func (tc *TxQueue) GetTxs() []*types.SubmitShardTxRequest
GetTxs gets all currently queued transactions sorted by namespace and by transaction ID, and then clears the queue.