internal

package
v0.0.0-...-4f0ab6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultShard is the default shard when no sharding is enabled.
	DefaultShard = shard.IDToShardIndex(0)
)

Functions

This section is empty.

Types

type ShardManager

type ShardManager struct {
	// contains filtered or unexported fields
}

ShardManager is used to manage the state of each shard, it detects the incoming confirmation message and processes the message if it match re-shard condition.

note, it doesn't support concurrency processing, that means when a shard begins re-shard others should wait for a moment. Considering that it only modifies the state of shard without causing any blocking and usually the reshard period is longer, so we have serialized it to avoid concurrency security problems.

func (*ShardManager) Act

func (sm *ShardManager) Act(e *message.Event, callback func(m interface{}))

Act is the function for implements the actor-pattern interface.

func (*ShardManager) Add

func (sm *ShardManager) Add(sp *shardController)

Add adds a new shardController to it's processor map, if the processor already exists, return error.

func (*ShardManager) StartEnabledShardControllers

func (sm *ShardManager) StartEnabledShardControllers()

StartEnabledShardControllers start all enabled shardProcessors

type ThreadedShardManager

type ThreadedShardManager struct {
	// contains filtered or unexported fields
}

ThreadedShardManager is used to manage the state of each shard, it detects the incoming confirmation message and processes the message if it match re-shard condition.

func ProvideShardManager

func ProvideShardManager(cfg *config.Config, info *ValidationInfo, metrics *metrics.Metrics,
	blockChain iblockchain.BlockChain, depositPool idepositpool.DepositPool, heartbeatMgr iheartbeat.HeartBeat,
	connector connection.Connector) *ThreadedShardManager

ProvideShardManager creates an instance of ThreadedShardManager

func (*ThreadedShardManager) GetAllShardControllers

func (tsm *ThreadedShardManager) GetAllShardControllers() []icontroller.IShardController

GetAllShardControllers returns all shard controllers.

func (*ThreadedShardManager) GetEnableShards

func (tsm *ThreadedShardManager) GetEnableShards() []shard.Index

GetEnableShards returns the enabled shard index array.

func (*ThreadedShardManager) GetShardController

func (tsm *ThreadedShardManager) GetShardController(shardIndex shard.Index) icontroller.IShardController

GetShardController returns a relevant shard controller with given shard index.

func (*ThreadedShardManager) Init

func (tsm *ThreadedShardManager) Init()

Init initializes the shard manager.

func (*ThreadedShardManager) StartEnabledShardControllers

func (tsm *ThreadedShardManager) StartEnabledShardControllers()

StartEnabledShardControllers triggers the start of all enabled shards controllers.

type ValidationInfo

type ValidationInfo struct {
	Selector iconsensus.Sortitionor
	Pk       []byte
	Sk       []byte
	Vrf      vrf.VRF
}

ValidationInfo wraps the identity validation relevant contributors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL