controller

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: 24 Imported by: 1

README

shardprocessor

resharding

Detemine the next shard at H and work in the new shard at H+k
Between the K rounds, it need to create the new shard network connection and init the ledger of new shard

  • At height H: determine the next shard
    • before resharding in this shard, after reshading in this shard:
      1. Do nothing
    • before resharding in this shard, after reshading not in this shard:
      1. Set consensus stopped at height h+k, Since the consensus begins directly after the next round, it is necessary to set the consensus in the resharding round and stop the next round if it needs to stop.
    • before resharding not in this shard, after reshading in this shard:
      1. Set processor enabled
      2. Init ledger
      3. Init ledger complete, set the miner processor status: preparation
      4. Cache the block proposed by others miners
      5. After receive the confirmation of the cache block, verify and accept the block
      6. Broadcast the new enabledshards
    • before resharding not in this shard, after reshading not in this shard:
      1. Do nothing
  • At height H+K: work in the new shard
    • before resharding in this shard, after reshading in this shard:
      1. Update the proof
    • before resharding in this shard, after reshading not in this shard:
      1. Consensus stopped at height h+k by itself
      2. Broadcast the new enabledshards
    • before resharding not in this shard, after reshading in this shard:
      1. Start the next round after receive the confirmation msg
    • before resharding not in this shard, after reshading not in this shard:
      1. Do nothing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RootController

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

RootController is at the upper level of the business logic and is used to schedule work for all shards.

func NewRootController

func NewRootController(cfg *config.Config, connector connection.Connector) *RootController

func (*RootController) GetEnabledShards

func (ctrl *RootController) GetEnabledShards() []shard.Index

GetEnabledShards returns all enabled shard indexes.

func (*RootController) HandleRPCReq

func (ctrl *RootController) HandleRPCReq(req *message.RPCReq) *message.RPCResp

HandleRPCReq should be the root entry for all RPC requests to get some internal state or trigger internal operation.

func (*RootController) NotifyPeerAdd

func (ctrl *RootController) NotifyPeerAdd(cp *connection.ConnPeer)

NotifyPeerAdd notifies all shards a particular peer is connected

func (*RootController) NotifyPeerDone

func (ctrl *RootController) NotifyPeerDone(cp *connection.ConnPeer)

NotifyPeerDone notifies all shards a particular peer is done (disconnected or not needed)

func (*RootController) Start

func (ctrl *RootController) Start()

Start is used to start controller

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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