synctree

package
v0.4.28 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSyncTreeClosed  = errors.New("sync tree is closed")
	ErrSyncTreeDeleted = errors.New("sync tree is deleted")
)
View Source
var (
	ErrMessageIsRequest    = errors.New("message is request")
	ErrMessageIsNotRequest = errors.New("message is not request")
	ErrMoreThanOneRequest  = errors.New("more than one request for same peer")
)
View Source
var (
	ErrNoResponsiblePeers = errors.New("no responsible peers")
)

Functions

This section is empty.

Types

type BuildDeps

type BuildDeps struct {
	SpaceId            string
	SyncClient         SyncClient
	Configuration      nodeconf.NodeConf
	HeadNotifiable     HeadNotifiable
	Listener           updatelistener.UpdateListener
	AclList            list.AclList
	SpaceStorage       spacestorage.SpaceStorage
	TreeStorage        treestorage.TreeStorage
	OnClose            func(id string)
	SyncStatus         syncstatus.StatusUpdater
	PeerGetter         ResponsiblePeersGetter
	BuildObjectTree    objecttree.BuildObjectTreeFunc
	ValidateObjectTree objecttree.ValidatorFunc
}

type HeadNotifiable

type HeadNotifiable interface {
	UpdateHeads(id string, heads []string)
}

type ListenerSetter

type ListenerSetter interface {
	SetListener(listener updatelistener.UpdateListener)
}

type ReceiveQueue

type ReceiveQueue interface {
	AddMessage(senderId string, msg *treechangeproto.TreeSyncMessage, replyId string) (queueFull bool)
	GetMessage(senderId string) (msg *treechangeproto.TreeSyncMessage, replyId string, err error)
	ClearQueue(senderId string)
}

type RequestFactory added in v0.2.0

type RequestFactory interface {
	CreateHeadUpdate(t objecttree.ObjectTree, added []*treechangeproto.RawTreeChangeWithId) (msg *treechangeproto.TreeSyncMessage)
	CreateNewTreeRequest() (msg *treechangeproto.TreeSyncMessage)
	CreateEmptyFullSyncRequest(t objecttree.ObjectTree) (req *treechangeproto.TreeSyncMessage)
	CreateFullSyncRequest(t objecttree.ObjectTree, theirHeads, theirSnapshotPath []string) (req *treechangeproto.TreeSyncMessage, err error)
	CreateFullSyncResponse(t objecttree.ObjectTree, theirHeads, theirSnapshotPath []string) (*treechangeproto.TreeSyncMessage, error)
}

func NewRequestFactory added in v0.2.0

func NewRequestFactory() RequestFactory

type ResponsiblePeersGetter

type ResponsiblePeersGetter interface {
	GetResponsiblePeers(ctx context.Context) (peers []peer.Peer, err error)
}

type SyncClient added in v0.2.0

type SyncClient interface {
	RequestFactory
	Broadcast(msg *treechangeproto.TreeSyncMessage)
	SendUpdate(peerId, objectId string, msg *treechangeproto.TreeSyncMessage) (err error)
	QueueRequest(peerId, objectId string, msg *treechangeproto.TreeSyncMessage) (err error)
	SendRequest(ctx context.Context, peerId, objectId string, msg *treechangeproto.TreeSyncMessage) (reply *spacesyncproto.ObjectSyncMessage, err error)
}

func NewSyncClient added in v0.2.0

func NewSyncClient(spaceId string, requestManager requestmanager.RequestManager, peerManager peermanager.PeerManager) SyncClient

type SyncTree

type SyncTree interface {
	synchandler.SyncHandler
	ListenerSetter
	SyncWithPeer(ctx context.Context, p peer.Peer) (err error)
	// contains filtered or unexported methods
}

func BuildSyncTreeOrGetRemote

func BuildSyncTreeOrGetRemote(ctx context.Context, id string, deps BuildDeps) (t SyncTree, err error)

func PutSyncTree

func PutSyncTree(ctx context.Context, payload treestorage.TreeStorageCreatePayload, deps BuildDeps) (t SyncTree, err error)

type TreeSyncProtocol added in v0.2.0

type TreeSyncProtocol interface {
	HeadUpdate(ctx context.Context, senderId string, protoVersion uint32, update *treechangeproto.TreeHeadUpdate) (request *treechangeproto.TreeSyncMessage, err error)
	FullSyncRequest(ctx context.Context, senderId string, request *treechangeproto.TreeFullSyncRequest) (response *treechangeproto.TreeSyncMessage, err error)
	FullSyncResponse(ctx context.Context, senderId string, response *treechangeproto.TreeFullSyncResponse) (err error)
}

Directories

Path Synopsis
Package mock_synctree is a generated GoMock package.
Package mock_synctree is a generated GoMock package.
mock_updatelistener
Package mock_updatelistener is a generated GoMock package.
Package mock_updatelistener is a generated GoMock package.

Jump to

Keyboard shortcuts

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