diffsync

package
v0.2505.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package diffsync defines wire protocol together with client/server implementations for the diff sync protocol, used for runtime block sync.

Index

Constants

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

Constants related to the GetDiff method.

View Source
const DiffSyncProtocolID = "diffsync"

DiffSyncProtocolID is a unique protocol identifier for the diff sync protocol.

Variables

View Source
var DiffSyncProtocolVersion = version.Version{Major: 1, Minor: 0, Patch: 0}

DiffSyncProtocolVersion is the supported version of the diff sync protocol.

Functions

func NewServer

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

NewServer creates a new diff sync protocol server.

func ProtocolID

func ProtocolID(chainContext string, runtimeID common.Namespace) core.ProtocolID

ProtocolID returns the runtime diff sync protocol ID.

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)
}

Client is a diff sync protocol client.

func NewClient

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

NewClient creates a new diff sync protocol client.

Moreover, it ensures underlying p2p service starts tracking protocol peers.

type GetDiffRequest

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

GetDiffRequest is a GetDiff request.

type GetDiffResponse

type GetDiffResponse struct {
	WriteLog api.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