syncapi

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const SyncProtocolVersion = 1

Variables

View Source
var ErrNotBackrestURI = errors.New("not a backrest URI")
View Source
var (
	ErrRemoteConfigNotFound = errors.New("remote config not found")
)

Functions

func CreateRemoteRepoURI

func CreateRemoteRepoURI(instanceUrl string) (string, error)

func GetRepoConfig

func GetRepoConfig(store RemoteConfigStore, instanceID, repoID string) (*v1.RemoteRepo, error)

func InstanceForBackrestURI

func InstanceForBackrestURI(repoUri string) (string, error)

func IsBackrestRemoteRepoURI

func IsBackrestRemoteRepoURI(repoUri string) bool

func RepoForBackrestURI

func RepoForBackrestURI(repoUri string) (string, error)

Types

type BackrestSyncHandler

type BackrestSyncHandler struct {
	v1connect.UnimplementedBackrestSyncServiceHandler
	// contains filtered or unexported fields
}

func NewBackrestSyncHandler

func NewBackrestSyncHandler(mgr *SyncManager) *BackrestSyncHandler

func (*BackrestSyncHandler) Sync

type Identity

type Identity struct {
	InstanceID string
	// contains filtered or unexported fields
}

func NewIdentity

func NewIdentity(instanceID, credentialFile string) (*Identity, error)

func (*Identity) SignMessage

func (i *Identity) SignMessage(message []byte) ([]byte, error)

func (*Identity) VerifySignature

func (i *Identity) VerifySignature(message, sig []byte) error

type RemoteConfigStore

type RemoteConfigStore interface {
	// Get a remote config for the given instance ID.
	Get(instanceID string) (*v1.RemoteConfig, error)
	// Update or create a remote config for the given instance ID.
	Update(instanceID string, config *v1.RemoteConfig) error
	// Delete a remote config for the given instance ID.
	Delete(instanceID string) error
}

func NewJSONDirRemoteConfigStore

func NewJSONDirRemoteConfigStore(dir string) RemoteConfigStore

type SyncClient

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

func NewSyncClient

func NewSyncClient(mgr *SyncManager, localInstanceID string, peer *v1.Multihost_Peer, oplog *oplog.OpLog) (*SyncClient, error)

func (*SyncClient) GetConnectionState

func (c *SyncClient) GetConnectionState() (v1.SyncConnectionState, string)

func (*SyncClient) RunSync

func (c *SyncClient) RunSync(ctx context.Context)

type SyncManager

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

func NewSyncManager

func NewSyncManager(configMgr *config.ConfigManager, remoteConfigStore RemoteConfigStore, oplog *oplog.OpLog, orchestrator *orchestrator.Orchestrator) *SyncManager

func (*SyncManager) GetSyncClients

func (m *SyncManager) GetSyncClients() map[string]*SyncClient

GetSyncClients returns a copy of the sync clients map. This makes the map safe to read from concurrently.

func (*SyncManager) RunSync

func (m *SyncManager) RunSync(ctx context.Context)

Note: top level function will be called holding the lock, must kick off goroutines and then return.

Jump to

Keyboard shortcuts

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