synctree

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedMessageType  = errors.New("unexpected message type")
	ErrUnexpectedRequestType  = errors.New("unexpected request type")
	ErrUnexpectedResponseType = errors.New("unexpected response type")
)
View Source
var (
	ErrSyncTreeClosed  = errors.New("sync tree is closed")
	ErrSyncTreeDeleted = errors.New("sync tree is deleted")
)
View Source
var (
	ErrNoResponsiblePeers = errors.New("no responsible peers")
)

Functions

func NewRequest added in v0.5.0

func NewRequest(peerId, spaceId, objectId string, heads []string, snapshotPath []string, root *treechangeproto.RawTreeChangeWithId) *objectmessages.Request

func NewSyncHandler added in v0.5.0

func NewSyncHandler(tree SyncTree, syncClient SyncClient, spaceId string) syncdeps.ObjectSyncHandler

Types

type BroadcastOptions added in v0.5.0

type BroadcastOptions struct {
	EmptyPeers []string
}

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 InnerHeadUpdate added in v0.5.0

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

func (*InnerHeadUpdate) Heads added in v0.5.0

func (h *InnerHeadUpdate) Heads() []string

func (*InnerHeadUpdate) Marshall added in v0.5.0

func (h *InnerHeadUpdate) Marshall(data objectmessages.ObjectMeta) ([]byte, error)

func (*InnerHeadUpdate) MsgSize added in v0.5.0

func (h *InnerHeadUpdate) MsgSize() (size uint64)

func (*InnerHeadUpdate) Prepare added in v0.5.0

func (h *InnerHeadUpdate) Prepare() error

type InnerRequest added in v0.5.0

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

func (*InnerRequest) Marshall added in v0.5.0

func (r *InnerRequest) Marshall() ([]byte, error)

func (*InnerRequest) MsgSize added in v0.5.0

func (r *InnerRequest) MsgSize() uint64

type ListenerSetter

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

type RequestFactory added in v0.2.0

type RequestFactory interface {
	CreateHeadUpdate(t objecttree.ObjectTree, ignoredPeer string, added []*treechangeproto.RawTreeChangeWithId) (headUpdate *objectmessages.HeadUpdate, err error)
	CreateNewTreeRequest(peerId, objectId string) *objectmessages.Request
	CreateFullSyncRequest(peerId string, t objecttree.ObjectTree) *objectmessages.Request
	CreateResponseProducer(t objecttree.ObjectTree, theirHeads, theirSnapshotPath []string) (response.ResponseProducer, error)
}

func NewRequestFactory added in v0.2.0

func NewRequestFactory(spaceId string) 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(ctx context.Context, headUpdate *objectmessages.HeadUpdate) error
	SendTreeRequest(ctx context.Context, req syncdeps.Request, collector syncdeps.ResponseCollector) (err error)
	QueueRequest(ctx context.Context, req syncdeps.Request) (err error)
}

func NewSyncClient added in v0.2.0

func NewSyncClient(spaceId string, syncService sync.SyncService) SyncClient

type SyncTree

type SyncTree interface {
	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)

Directories

Path Synopsis
Package mock_synctree is a generated GoMock package.
Package mock_synctree is a generated GoMock package.
mock_response
Package mock_response is a generated GoMock package.
Package mock_response 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