Documentation
¶
Index ¶
- type NodeInfo
- type Orchestration
- func (o *Orchestration) AddShardConfig(rec *ValidatorAssignmentRecord) error
- func (o *Orchestration) Close() error
- func (o *Orchestration) PartitionDescription(partitionID types.PartitionID, epoch uint64) (*types.PartitionDescriptionRecord, error)
- func (o *Orchestration) RoundPartitions(rootRound uint64) ([]*types.PartitionDescriptionRecord, error)
- func (o *Orchestration) ShardConfig(partition types.PartitionID, shard types.ShardID, epoch uint64) (*ValidatorAssignmentRecord, error)
- func (o *Orchestration) ShardEpoch(partition types.PartitionID, shard types.ShardID, shardRound uint64) (uint64, error)
- type TrustBase
- type ValidatorAssignmentRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeInfo ¶
type NodeInfo struct { NodeID string `json:"nodeId"` // libp2p node id (hash of libp2p encryption public key) AuthKey hex.Bytes `json:"authKey"` // libp2p encryption public key SigKey hex.Bytes `json:"sigKey"` // alphabill signing public key // contains filtered or unexported fields }
func NewVARNodeFromGenesisNode ¶
func NewVARNodeFromGenesisNode(pn *genesis.PartitionNode) NodeInfo
type Orchestration ¶
type Orchestration struct {
// contains filtered or unexported fields
}
func NewOrchestration ¶
func NewOrchestration(seed *genesis.RootGenesis, dbFile string) (*Orchestration, error)
NewOrchestration creates new boltDB implementation of shard validator orchestration.
- seed is the root genesis file used to generate db schema and the first VARs.
- dbFile is filename (full path) to the Bolt DB file to use for storage, if the file does not exist it will be created;
func (*Orchestration) AddShardConfig ¶
func (o *Orchestration) AddShardConfig(rec *ValidatorAssignmentRecord) error
AddShardConfig verifies and stores the given VAR.
Validation rules:
- The network ID must match
- The partition ID must match one of the existing partitions
- The shard ID must be 0x80 (CBOR encoding of the empty bitstring)
- The new epoch number must be one greater than the current epoch of the only shard in the specified partition
- The activation round number must be strictly greater than the current round of the only shard in the specified partition
- The node identifiers must match their authentication keys
func (*Orchestration) Close ¶
func (o *Orchestration) Close() error
func (*Orchestration) PartitionDescription ¶
func (o *Orchestration) PartitionDescription(partitionID types.PartitionID, epoch uint64) (*types.PartitionDescriptionRecord, error)
func (*Orchestration) RoundPartitions ¶
func (o *Orchestration) RoundPartitions(rootRound uint64) ([]*types.PartitionDescriptionRecord, error)
RoundPartitions returns Partition Descriptions active on the given RootChain round.
func (*Orchestration) ShardConfig ¶
func (o *Orchestration) ShardConfig(partition types.PartitionID, shard types.ShardID, epoch uint64) (*ValidatorAssignmentRecord, error)
ShardConfig returns VAR for the given shard epoch.
func (*Orchestration) ShardEpoch ¶
func (o *Orchestration) ShardEpoch(partition types.PartitionID, shard types.ShardID, shardRound uint64) (uint64, error)
ShardEpoch returns the active epoch number for the given round in a shard.
type TrustBase ¶
func (*TrustBase) GetQuorum ¶
GetQuorum calculates and returns minimum number of nodes required for a quorum
func (*TrustBase) GetTotalNodes ¶
GetTotalNodes returns total number of registered validator nodes
type ValidatorAssignmentRecord ¶
type ValidatorAssignmentRecord struct { NetworkID types.NetworkID `json:"networkId"` PartitionID types.PartitionID `json:"partitionId"` ShardID types.ShardID `json:"shardId"` EpochNumber uint64 `json:"epochNo"` RoundNumber uint64 `json:"roundNo"` Nodes []NodeInfo `json:"nodes"` // contains filtered or unexported fields }
func NewVARFromGenesis ¶
func NewVARFromGenesis(gpr *genesis.GenesisPartitionRecord) *ValidatorAssignmentRecord
TODO partition genesis record should support multi-shard nodes i.e. currently we create one VAR per partition, but should create one VAR per shard
func (*ValidatorAssignmentRecord) Verify ¶
func (v *ValidatorAssignmentRecord) Verify(prev *ValidatorAssignmentRecord) error
Verify verifies the provided VAR extends the previous VAR.