synctree

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 22 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
}

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)
	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 {
	objecttree.ObjectTree
	synchandler.SyncHandler
	ListenerSetter
	SyncWithPeer(ctx context.Context, peerId string) (err error)
}

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, 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
Code generated by MockGen.
Code generated by MockGen.
mock_updatelistener
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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