sync

package
v0.2201.6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Constants related to the GetDiff method.

View Source
const (
	MethodGetCheckpoints              = "GetCheckpoints"
	MaxGetCheckpointsResponseTime     = 5 * time.Second
	MaxGetCheckpointsParallelRequests = 5
)

Constants related to the GetCheckpoints method.

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

Constants related to the GetCheckpointChunk 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: 1, Minor: 0, Patch: 0}

StorageSyncProtocolVersion is the supported version of the storage sync protocol.

Functions

func NewServer

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

NewServer creates a new storage sync protocol server.

Types

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) (*GetCheckpointsResponse, error)

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

Client is a storage sync protocol client.

func NewClient

func NewClient(p2p rpc.P2P, 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