Documentation
¶
Index ¶
- Constants
- type Datarouter
- func (router *Datarouter) ACCOUNTS_SYNC(ctx context.Context, req *accountspb.AccountNonceSyncRequest, ...) *accountspb.AccountSyncServerMessage
- func (router *Datarouter) Authenticate(ctx context.Context, auth_req *authpb.Auth, remote *types.Nodeinfo) (bool, error)
- func (router *Datarouter) DATA_SYNC(ctx context.Context, req *datasyncpb.DataSyncRequest) *datasyncpb.DataSyncResponse
- func (router *Datarouter) FULL_SYNC(ctx context.Context, req *priorsyncpb.PriorSync, peerNode types.Nodeinfo, ...) *priorsyncpb.PriorSyncMessage
- func (router *Datarouter) HEADER_SYNC(ctx context.Context, req *headersyncpb.HeaderSyncRequest) *headersyncpb.HeaderSyncResponse
- func (router *Datarouter) HandleAccountsFetch(ctx context.Context, req *accountspb.AccountSyncRequestAccounts, ...) *accountspb.AccountSyncResponse
- func (router *Datarouter) HandleAccountsSync(ctx context.Context, req *accountspb.AccountNonceSyncRequest, ...) *accountspb.AccountSyncServerMessage
- func (router *Datarouter) HandleAvailability(ctx context.Context, req *availabilitypb.AvailabilityRequest, ...) *availabilitypb.AvailabilityResponse
- func (router *Datarouter) HandleDataSync(ctx context.Context, req *datasyncpb.DataSyncRequest, remote *types.Nodeinfo) *datasyncpb.DataSyncResponse
- func (router *Datarouter) HandleHeaderSync(ctx context.Context, headerSyncReq *headerpb.HeaderSyncRequest, ...) *headerpb.HeaderSyncResponse
- func (router *Datarouter) HandleMerkle(ctx context.Context, merkleReq *merklepb.MerkleRequestMessage, ...) *merklepb.MerkleMessage
- func (router *Datarouter) HandlePoTSync(ctx context.Context, req *potspb.PoTSRequest, remote *types.Nodeinfo) *potspb.PoTSResponse
- func (router *Datarouter) HandlePriorSync(ctx context.Context, req *priorsyncpb.PriorSyncMessage, remote *types.Nodeinfo) *priorsyncpb.PriorSyncMessage
- func (router *Datarouter) IsRegistered() bool
- func (router *Datarouter) REQUEST_MERKLE(ctx context.Context, Range *merklepb.Range, reqConfig *merklepb.SnapshotConfig, ...) *merklepb.MerkleMessage
- func (router *Datarouter) ResetTTL(ctx context.Context, auth_req *authpb.Auth, remote *types.Nodeinfo) error
- func (router *Datarouter) SYNC_REQUEST(ctx context.Context, req *priorsyncpb.PriorSync, peerNode types.Nodeinfo, ...) *priorsyncpb.PriorSyncMessage
- func (router *Datarouter) WriteAccountsBatch(ctx context.Context, accounts []*accountspb.Account) error
Constants ¶
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 (router *Datarouter) ACCOUNTS_SYNC(ctx context.Context, req *accountspb.AccountNonceSyncRequest, remote *types.Nodeinfo, sessionLockedART *accountshelper.LockedART) *accountspb.AccountSyncServerMessage
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 (router *Datarouter) DATA_SYNC(ctx context.Context, req *datasyncpb.DataSyncRequest) *datasyncpb.DataSyncResponse
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 ¶
func (router *Datarouter) HEADER_SYNC(ctx context.Context, req *headersyncpb.HeaderSyncRequest) *headersyncpb.HeaderSyncResponse
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 (router *Datarouter) HandleAccountsFetch(ctx context.Context, req *accountspb.AccountSyncRequestAccounts, remote *types.Nodeinfo) *accountspb.AccountSyncResponse
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 (router *Datarouter) HandleAvailability(ctx context.Context, req *availabilitypb.AvailabilityRequest, remote *types.Nodeinfo) *availabilitypb.AvailabilityResponse
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.