router

package
v0.1.0-v3base.6 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LEAF_THRESHOLD is the minimum number of blocks in a range before we stop bisecting
	// and just tag the entire range for synchronization.
	LEAF_THRESHOLD = 10

	// LAYER_THRESHOLD is the maximum recursion depth for bisection.
	// After this depth, we tag the entire remaining range to avoid excessive network calls.
	LAYER_THRESHOLD = 6

	// MAX_PARALLEL_REQUESTS limits concurrent network requests to avoid overwhelming the target node.
	MAX_PARALLEL_REQUESTS = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Datarouter

type Datarouter struct {
	Nodeinfo *types.Nodeinfo
	Comm     communication.Communicator
	// contains filtered or unexported fields
}

func NewDatarouter

func NewDatarouter(nodeinfo *types.Nodeinfo, comm communication.Communicator, wal *WAL.WAL) *Datarouter

func (*Datarouter) ACCOUNTS_SYNC

func (*Datarouter) Authenticate

func (router *Datarouter) Authenticate(ctx context.Context, auth_req *authpb.Auth, remote *types.Nodeinfo) (bool, error)

Let the authentication happens in the Data Router itself rather than doing it outside.

func (*Datarouter) DATA_SYNC

func (*Datarouter) FULL_SYNC

func (router *Datarouter) FULL_SYNC(ctx context.Context, req *priorsyncpb.PriorSync, peerNode types.Nodeinfo, blocknumber uint64, remote *types.Nodeinfo) *priorsyncpb.PriorSyncMessage

func (*Datarouter) HEADER_SYNC

This is the Phase2 function that will take the tagged blocks and send to the server node to get the block headers sync.

func (*Datarouter) HandleAccountsFetch

func (*Datarouter) HandleAccountsSync

func (router *Datarouter) HandleAccountsSync(ctx context.Context, req *accountspb.AccountNonceSyncRequest, remote *types.Nodeinfo, sessionLockedART *accountshelper.LockedART) *accountspb.AccountSyncServerMessage

func (*Datarouter) HandleAvailability

func (*Datarouter) HandleDataSync

func (router *Datarouter) HandleDataSync(ctx context.Context, req *datasyncpb.DataSyncRequest, remote *types.Nodeinfo) *datasyncpb.DataSyncResponse

func (*Datarouter) HandleHeaderSync

func (router *Datarouter) HandleHeaderSync(ctx context.Context, headerSyncReq *headerpb.HeaderSyncRequest, remote *types.Nodeinfo) *headerpb.HeaderSyncResponse

func (*Datarouter) HandleMerkle

func (router *Datarouter) HandleMerkle(ctx context.Context, merkleReq *merklepb.MerkleRequestMessage, remote *types.Nodeinfo) *merklepb.MerkleMessage

func (*Datarouter) HandlePoTSync

func (router *Datarouter) HandlePoTSync(ctx context.Context, req *potspb.PoTSRequest, remote *types.Nodeinfo) *potspb.PoTSResponse

func (*Datarouter) HandlePriorSync

func (router *Datarouter) HandlePriorSync(ctx context.Context, req *priorsyncpb.PriorSyncMessage, remote *types.Nodeinfo) *priorsyncpb.PriorSyncMessage

func (*Datarouter) IsRegistered

func (router *Datarouter) IsRegistered() bool

Check if the router is registered with a client (has a valid UUID)

func (*Datarouter) REQUEST_MERKLE

func (router *Datarouter) REQUEST_MERKLE(ctx context.Context, Range *merklepb.Range, reqConfig *merklepb.SnapshotConfig, remote *types.Nodeinfo) *merklepb.MerkleMessage

REQUEST_MERKLE constructs a merkle tree for the given range and returns it as a snapshot. If reqConfig is provided (non-nil with BlockMerge > 0), it is used for tree construction. Otherwise a default config is calculated (5% of range as BlockMerge).

func (*Datarouter) ResetTTL

func (router *Datarouter) ResetTTL(ctx context.Context, auth_req *authpb.Auth, remote *types.Nodeinfo) error

After the authentication let reset the TTL

func (*Datarouter) SYNC_REQUEST

func (router *Datarouter) SYNC_REQUEST(ctx context.Context, req *priorsyncpb.PriorSync, peerNode types.Nodeinfo, remote *types.Nodeinfo) *priorsyncpb.PriorSyncMessage

func (*Datarouter) WriteAccountsBatch

func (router *Datarouter) WriteAccountsBatch(ctx context.Context, accounts []*accountspb.Account) error

WriteAccountsBatch persists all accounts accumulated from one dispatch worker's persistent stream in a single DB transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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