headsync

package
v0.13.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const CName = "common.commonspace.headsync"

Variables

This section is empty.

Functions

Types

type Client

type Client interface {
	HeadSync(ctx context.Context, in *spacesyncproto.HeadSyncRequest) (*spacesyncproto.HeadSyncResponse, error)
}

type DiffManager added in v0.9.5

type DiffManager struct {
	// contains filtered or unexported fields
}

DiffManager holds the current diff (DiffType_V3).

Upgrading the diff algorithm to a next DiffType requires a coexistence period, see how V2/V3 lived together before V2 removal (git history up to this commit): a DiffContainer with old/new diffs filled by DiffManager, dual hashes in statestorage, a switch by req.DiffType in HandleRangeRequest and by resp.DiffType in remote.DiffTypeCheck, so that the newest common type wins. The old type can be dropped once the secureservice compatibleVersions exclude all peers that don't support the new one.

Note for that future upgrade: V3-only responders (this code and the node's HeadSync handler) reject unknown diff types with an error instead of answering with their best supported type, so a V(n+1) requester must treat such an error as "type unsupported" and fall back to requesting V(n).

func NewDiffManager added in v0.9.5

func NewDiffManager(
	diff ldiff.Diff,
	storage spacestorage.SpaceStorage,
	syncAcl syncacl.SyncAcl,
	log logger.CtxLogger,
	ctx context.Context,
	deletionState deletionstate.ObjectDeletionState,
) *DiffManager

func (*DiffManager) AllIds added in v0.9.5

func (dm *DiffManager) AllIds() []string

func (*DiffManager) FillDiff added in v0.9.5

func (dm *DiffManager) FillDiff(ctx context.Context) error

func (*DiffManager) HandleRangeRequest added in v0.9.5

func (dm *DiffManager) HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)

func (*DiffManager) TryDiff added in v0.9.5

func (dm *DiffManager) TryDiff(ctx context.Context, rdiff RemoteDiff) (newIds, changedIds, removedIds []string, err error)

func (*DiffManager) UpdateHeads added in v0.9.5

func (dm *DiffManager) UpdateHeads(update headstorage.HeadsEntry)

type DiffSyncer

type DiffSyncer interface {
	Sync(ctx context.Context) error
	Init()
	Run()
	Close()
}

type HeadSync

type HeadSync interface {
	app.ComponentRunnable
	ExternalIds() []string
	AllIds() []string
	DiffSync(ctx context.Context) error
	HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)
}

func New added in v0.2.0

func New() HeadSync

type RemoteDiff added in v0.3.11

type RemoteDiff interface {
	ldiff.Remote
	// DiffTypeCheck asks the remote for its total hash and compares it with the local diff
	DiffTypeCheck(ctx context.Context, diff ldiff.Diff) (needsSync bool, err error)
}

func NewRemoteDiff

func NewRemoteDiff(spaceId string, client Client) RemoteDiff

type TreeHeads

type TreeHeads struct {
	Id    string
	Heads []string
}

Directories

Path Synopsis
mock_headstorage
Package mock_headstorage is a generated GoMock package.
Package mock_headstorage is a generated GoMock package.
Package mock_headsync is a generated GoMock package.
Package mock_headsync is a generated GoMock package.
mock_statestorage
Package mock_statestorage is a generated GoMock package.
Package mock_statestorage is a generated GoMock package.

Jump to

Keyboard shortcuts

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