sync

package
v0.2300.7 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGetDiff          = "GetDiff"
	MaxGetDiffResponseTime = 15 * time.Second
)

Constants related to the GetDiff method.

View Source
const (
	MethodGetCheckpointChunk          = "GetCheckpointChunk"
	MaxGetCheckpointChunkResponseTime = 60 * time.Second
)

Constants related to the GetCheckpointChunk method.

View Source
const (
	MethodGetCheckpoints = "GetCheckpoints"
)

Constants related to the GetCheckpoints method.

View Source
const StorageSyncProtocolID = "storagesync"

StorageSyncProtocolID is a unique protocol identifier for the storage sync protocol.

Variables

View Source
var StorageSyncProtocolVersion = version.Version{Major: 2, Minor: 0, Patch: 0}

StorageSyncProtocolVersion is the supported version of the storage sync protocol.

Functions

func NewServer

func NewServer(chainContext string, runtimeID common.Namespace, backend storage.Backend) rpc.Server

NewServer creates a new storage sync protocol server.

Types

type Checkpoint added in v0.2202.0

type Checkpoint struct {
	*checkpoint.Metadata

	// Peers are the feedback structures of all the peers that have advertised this checkpoint.
	Peers []rpc.PeerFeedback
}

Checkpoint contains checkpoint metadata together with peer information.

type Client

type Client interface {
	// GetDiff requests a write log of entries that must be applied to get from the first given root
	// to the second one.
	GetDiff(ctx context.Context, request *GetDiffRequest) (*GetDiffResponse, rpc.PeerFeedback, error)

	// GetCheckpoints returns a list of checkpoint metadata for all known checkpoints.
	GetCheckpoints(ctx context.Context, request *GetCheckpointsRequest) ([]*Checkpoint, error)

	// GetCheckpointChunk requests a specific checkpoint chunk.
	GetCheckpointChunk(
		ctx context.Context,
		request *GetCheckpointChunkRequest,
		cp *Checkpoint,
	) (*GetCheckpointChunkResponse, rpc.PeerFeedback, error)
}

Client is a storage sync protocol client.

func NewClient

func NewClient(p2p rpc.P2P, chainContext string, runtimeID common.Namespace) Client

NewClient creates a new storage sync protocol client.

type GetCheckpointChunkRequest

type GetCheckpointChunkRequest struct {
	Version uint16       `json:"version"`
	Root    storage.Root `json:"root"`
	Index   uint64       `json:"index"`
	Digest  hash.Hash    `json:"digest"`
}

GetCheckpointChunkRequest is a GetCheckpointChunk request.

type GetCheckpointChunkResponse

type GetCheckpointChunkResponse struct {
	Chunk []byte `json:"chunk,omitempty"`
}

GetCheckpointChunkResponse is a respose to a GetCheckpointChunk request.

type GetCheckpointsRequest

type GetCheckpointsRequest struct {
	Version uint16 `json:"version"`
}

GetCheckpointsRequest is a GetCheckpoints request.

type GetCheckpointsResponse

type GetCheckpointsResponse struct {
	Checkpoints []*checkpoint.Metadata `json:"checkpoints,omitempty"`
}

GetCheckpointsResponse is a response to a GetCheckpoints request.

type GetDiffRequest

type GetDiffRequest struct {
	StartRoot storage.Root `json:"start_root"`
	EndRoot   storage.Root `json:"end_root"`
}

GetDiffRequest is a GetDiff request.

type GetDiffResponse

type GetDiffResponse struct {
	WriteLog storage.WriteLog `json:"write_log,omitempty"`
}

GetDiffResponse is a response to a GetDiff request.

Jump to

Keyboard shortcuts

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