sync

package
v0.0.0-...-ac41614 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 23 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ENoLocalBucket = errors.New("No such bucket exists locally")

Functions

This section is empty.

Types

type BucketProxy

type BucketProxy interface {
	Name() string
	MerkleTree() MerkleTreeProxy
	GetSyncChildren(nodeID uint32) (SiblingSetIterator, error)
	Merge(mergedKeys map[string]*SiblingSet) error
	Forget(keys [][]byte) error
	Close()
}

type BucketProxyFactory

type BucketProxyFactory interface {
	// Return a set of buckets for which updates can be
	// pushed from the given node to this node/cluster
	IncomingBuckets(peerID string) map[string]bool
	// Return a set of buckets for which updates can be
	// pushed from this node/cluster to the given node
	OutgoingBuckets(peerID string) map[string]bool
	// Create a bucket proxy to the bucket specified in the site
	// that the peer belongs to
	CreateBucketProxy(peerID string, bucket string) (BucketProxy, error)
}

type BucketSyncHTTP

type BucketSyncHTTP struct {
	PartitionPool           PartitionPool
	ClusterConfigController ClusterConfigController
}

func (*BucketSyncHTTP) Attach

func (bucketSync *BucketSyncHTTP) Attach(router *mux.Router)

type CloudBucketProxyFactory

type CloudBucketProxyFactory struct {
	// An intra-cluster client
	Client Client
	// The cluster controller for this node
	ClusterController *ClusterController
	// The partition pool for this node
	PartitionPool PartitionPool
	// The cluster io agent for this node
	ClusterIOAgent ClusterIOAgent
}

func (*CloudBucketProxyFactory) CreateBucketProxy

func (cloudBucketProxyFactory *CloudBucketProxyFactory) CreateBucketProxy(peerID string, bucketName string) (BucketProxy, error)

func (*CloudBucketProxyFactory) IncomingBuckets

func (cloudBucketProxyFactory *CloudBucketProxyFactory) IncomingBuckets(peerID string) map[string]bool

func (*CloudBucketProxyFactory) OutgoingBuckets

func (cloudBucketProxyFactory *CloudBucketProxyFactory) OutgoingBuckets(peerID string) map[string]bool

type CloudLocalBucketProxy

type CloudLocalBucketProxy struct {
	Bucket         Bucket
	SiteID         string
	SitePool       SitePool
	ClusterIOAgent ClusterIOAgent
}

func (*CloudLocalBucketProxy) Close

func (bucketProxy *CloudLocalBucketProxy) Close()

func (*CloudLocalBucketProxy) Forget

func (bucketProxy *CloudLocalBucketProxy) Forget(keys [][]byte) error

func (*CloudLocalBucketProxy) GetSyncChildren

func (bucketProxy *CloudLocalBucketProxy) GetSyncChildren(nodeID uint32) (SiblingSetIterator, error)

func (*CloudLocalBucketProxy) Merge

func (bucketProxy *CloudLocalBucketProxy) Merge(mergedKeys map[string]*SiblingSet) error

func (*CloudLocalBucketProxy) MerkleTree

func (bucketProxy *CloudLocalBucketProxy) MerkleTree() MerkleTreeProxy

func (*CloudLocalBucketProxy) Name

func (bucketProxy *CloudLocalBucketProxy) Name() string

type CloudRemoteBucketProxy

type CloudRemoteBucketProxy struct {
	Client         Client
	PeerAddress    PeerAddress
	SiteID         string
	BucketName     string
	ClusterIOAgent ClusterIOAgent
	// contains filtered or unexported fields
}

func (*CloudRemoteBucketProxy) Close

func (bucketProxy *CloudRemoteBucketProxy) Close()

func (*CloudRemoteBucketProxy) Forget

func (bucketProxy *CloudRemoteBucketProxy) Forget(keys [][]byte) error

func (*CloudRemoteBucketProxy) GetSyncChildren

func (bucketProxy *CloudRemoteBucketProxy) GetSyncChildren(nodeID uint32) (SiblingSetIterator, error)

func (*CloudRemoteBucketProxy) Merge

func (bucketProxy *CloudRemoteBucketProxy) Merge(mergedKeys map[string]*SiblingSet) error

func (*CloudRemoteBucketProxy) MerkleTree

func (bucketProxy *CloudRemoteBucketProxy) MerkleTree() MerkleTreeProxy

func (*CloudRemoteBucketProxy) Name

func (bucketProxy *CloudRemoteBucketProxy) Name() string

type CloudResponderMerkleNodeIterator

type CloudResponderMerkleNodeIterator struct {
	MerkleKeys   rest.MerkleKeys
	CurrentIndex int
}

func (*CloudResponderMerkleNodeIterator) Error

func (*CloudResponderMerkleNodeIterator) Key

func (iter *CloudResponderMerkleNodeIterator) Key() []byte

func (*CloudResponderMerkleNodeIterator) LocalVersion

func (iter *CloudResponderMerkleNodeIterator) LocalVersion() uint64

func (*CloudResponderMerkleNodeIterator) Next

func (*CloudResponderMerkleNodeIterator) Prefix

func (iter *CloudResponderMerkleNodeIterator) Prefix() []byte

func (*CloudResponderMerkleNodeIterator) Release

func (iter *CloudResponderMerkleNodeIterator) Release()

func (*CloudResponderMerkleNodeIterator) Value

func (iter *CloudResponderMerkleNodeIterator) Value() *SiblingSet

type CloudResponderMerkleTreeProxy

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

func (*CloudResponderMerkleTreeProxy) Depth

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) Depth() uint8

func (*CloudResponderMerkleTreeProxy) Error

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) Error() error

func (*CloudResponderMerkleTreeProxy) LeftChild

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) LeftChild(nodeID uint32) uint32

func (*CloudResponderMerkleTreeProxy) Level

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) Level(nodeID uint32) uint8

func (*CloudResponderMerkleTreeProxy) NodeHash

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) NodeHash(nodeID uint32) Hash

func (*CloudResponderMerkleTreeProxy) NodeLimit

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) NodeLimit() uint32

func (*CloudResponderMerkleTreeProxy) RightChild

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) RightChild(nodeID uint32) uint32

func (*CloudResponderMerkleTreeProxy) RootNode

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) RootNode() uint32

func (*CloudResponderMerkleTreeProxy) TranslateNode

func (cloudResponderMerkleProxy *CloudResponderMerkleTreeProxy) TranslateNode(nodeID uint32, depth uint8) uint32

type DirectMerkleTreeProxy

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

func (*DirectMerkleTreeProxy) Depth

func (directMerkleProxy *DirectMerkleTreeProxy) Depth() uint8

func (*DirectMerkleTreeProxy) Error

func (directMerkleProxy *DirectMerkleTreeProxy) Error() error

func (*DirectMerkleTreeProxy) LeftChild

func (directMerkleProxy *DirectMerkleTreeProxy) LeftChild(nodeID uint32) uint32

func (*DirectMerkleTreeProxy) Level

func (directMerkleProxy *DirectMerkleTreeProxy) Level(nodeID uint32) uint8

func (*DirectMerkleTreeProxy) MerkleTree

func (directMerkleProxy *DirectMerkleTreeProxy) MerkleTree() *MerkleTree

func (*DirectMerkleTreeProxy) NodeHash

func (directMerkleProxy *DirectMerkleTreeProxy) NodeHash(nodeID uint32) Hash

func (*DirectMerkleTreeProxy) NodeLimit

func (directMerkleProxy *DirectMerkleTreeProxy) NodeLimit() uint32

func (*DirectMerkleTreeProxy) RightChild

func (directMerkleProxy *DirectMerkleTreeProxy) RightChild(nodeID uint32) uint32

func (*DirectMerkleTreeProxy) RootNode

func (directMerkleProxy *DirectMerkleTreeProxy) RootNode() uint32

func (*DirectMerkleTreeProxy) TranslateNode

func (directMerkleProxy *DirectMerkleTreeProxy) TranslateNode(nodeID uint32, depth uint8) uint32

type MerkleTreeProxy

type MerkleTreeProxy interface {
	RootNode() uint32
	Depth() uint8
	NodeLimit() uint32
	Level(nodeID uint32) uint8
	LeftChild(nodeID uint32) uint32
	RightChild(nodeID uint32) uint32
	NodeHash(nodeID uint32) Hash
	TranslateNode(nodeID uint32, depth uint8) uint32
	Error() error
}

type MultiSyncScheduler

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

Optimized for cloud servers that need to coordinate sync sessions with hundreds or thousands of relays at once. Tries to ensure that for any particular peer, sync sessions with that peer are scheduled periodically attempting to minimize jitter between the scheduled time and the actual time.

func NewMultiSyncScheduler

func NewMultiSyncScheduler(syncPeriod time.Duration) *MultiSyncScheduler

func (*MultiSyncScheduler) AddPeer

func (syncScheduler *MultiSyncScheduler) AddPeer(peerID string, buckets []string)

func (*MultiSyncScheduler) Advance

func (syncScheduler *MultiSyncScheduler) Advance()

func (*MultiSyncScheduler) Next

func (syncScheduler *MultiSyncScheduler) Next() (string, string)

func (*MultiSyncScheduler) RemovePeer

func (syncScheduler *MultiSyncScheduler) RemovePeer(peerID string)

func (*MultiSyncScheduler) Schedule

func (syncScheduler *MultiSyncScheduler) Schedule(peerID string)

type Peer

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

func NewPeer

func NewPeer(id string, buckets []string) *Peer

func (*Peer) Advance

func (peer *Peer) Advance()

func (*Peer) NextBucket

func (peer *Peer) NextBucket() string

type PeerHeap

type PeerHeap []*Peer

func (PeerHeap) Len

func (h PeerHeap) Len() int

func (PeerHeap) Less

func (h PeerHeap) Less(i, j int) bool

func (*PeerHeap) Pop

func (h *PeerHeap) Pop() interface{}

func (*PeerHeap) Push

func (h *PeerHeap) Push(x interface{})

func (PeerHeap) Swap

func (h PeerHeap) Swap(i, j int)

type PeriodicSyncScheduler

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

Sync queue optimized for relays that provides a new sync partner at a fixed rate

func NewPeriodicSyncScheduler

func NewPeriodicSyncScheduler(syncPeriod time.Duration) *PeriodicSyncScheduler

func (*PeriodicSyncScheduler) AddPeer

func (syncScheduler *PeriodicSyncScheduler) AddPeer(peerID string, buckets []string)

func (*PeriodicSyncScheduler) Advance

func (syncScheduler *PeriodicSyncScheduler) Advance()

func (*PeriodicSyncScheduler) Next

func (syncScheduler *PeriodicSyncScheduler) Next() (string, string)

func (*PeriodicSyncScheduler) RemovePeer

func (syncScheduler *PeriodicSyncScheduler) RemovePeer(peerID string)

func (*PeriodicSyncScheduler) Schedule

func (syncScheduler *PeriodicSyncScheduler) Schedule(peerID string)

type RelayBucketProxy

type RelayBucketProxy struct {
	Bucket   Bucket
	SiteID   string
	SitePool SitePool
}

func (*RelayBucketProxy) Close

func (relayBucketProxy *RelayBucketProxy) Close()

func (*RelayBucketProxy) Forget

func (relayBucketProxy *RelayBucketProxy) Forget(keys [][]byte) error

func (*RelayBucketProxy) GetSyncChildren

func (relayBucketProxy *RelayBucketProxy) GetSyncChildren(nodeID uint32) (SiblingSetIterator, error)

func (*RelayBucketProxy) Merge

func (relayBucketProxy *RelayBucketProxy) Merge(mergedKeys map[string]*SiblingSet) error

func (*RelayBucketProxy) MerkleTree

func (relayBucketProxy *RelayBucketProxy) MerkleTree() MerkleTreeProxy

func (*RelayBucketProxy) Name

func (relayBucketProxy *RelayBucketProxy) Name() string

type RelayBucketProxyFactory

type RelayBucketProxyFactory struct {
	// The site pool for this node
	SitePool SitePool
}

func (*RelayBucketProxyFactory) CreateBucketProxy

func (relayBucketProxyFactory *RelayBucketProxyFactory) CreateBucketProxy(peerID string, bucketName string) (BucketProxy, error)

func (*RelayBucketProxyFactory) IncomingBuckets

func (relayBucketProxyFactory *RelayBucketProxyFactory) IncomingBuckets(peerID string) map[string]bool

func (*RelayBucketProxyFactory) OutgoingBuckets

func (relayBucketProxyFactory *RelayBucketProxyFactory) OutgoingBuckets(peerID string) map[string]bool

type SyncScheduler

type SyncScheduler interface {
	AddPeer(peerID string, buckets []string)
	RemovePeer(peerID string)
	Next() (string, string)
	Advance()
	Schedule(peerID string)
}

Jump to

Keyboard shortcuts

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