sync

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const QueueStoreKey = "TextileSyncTaskQueue"

Variables

This section is empty.

Functions

func New

func New(
	st store.Store,
	model model.Model,
	kc keychain.Keychain,
	hubAuth hub.HubAuth,
	hb *bucketsClient.Client,
	ht *threadsClient.Client,
	netc *nc.Client,
	cfg config.Config,
	getMirrorBucket GetMirrorBucketFn,
	getBucket GetBucketFn,
	getBucketCtx GetBucketCtxFn,
	addBucketListenerFn AddBucketListenerFn,
) *synchronizer

Creates a new Synchronizer

Types

type AddBucketListenerFn added in v0.0.30

type AddBucketListenerFn func(ctx context.Context, bucketSlug string) error

type EventNotifier added in v0.0.23

type EventNotifier interface {
	SendFileEvent(event events.FileEvent)
}

type GetBucketCtxFn

type GetBucketCtxFn func(ctx context.Context, sDbID string, bucketSlug string, ishub bool, enckey []byte) (context.Context, *thread.ID, error)

type GetBucketFn

type GetBucketFn func(ctx context.Context, slug string) (bucket.BucketInterface, error)

type GetMirrorBucketFn

type GetMirrorBucketFn func(ctx context.Context, slug string) (bucket.BucketInterface, error)

type Synchronizer

type Synchronizer interface {
	NotifyItemAdded(bucket, path string)
	NotifyItemRemoved(bucket, path string)
	NotifyBucketCreated(bucket string, enckey []byte)
	NotifyBucketBackupOn(bucket string)
	NotifyBucketBackupOff(bucket string)
	NotifyBucketRestore(bucket string)
	NotifyFileRestore(bucket, path string)
	NotifyBucketStartup(bucket string)
	NotifyIndexItemAdded(bucket, path, dbId string)
	Start(ctx context.Context)
	RestoreQueue() error
	Shutdown()
	String() string
	AttachNotifier(EventNotifier)
}

type Task

type Task struct {
	ID             string    `json:"id"`
	State          taskState `json:"state"`
	Type           taskType  `json:"type"`
	Args           []string  `json:"args"`
	Parallelizable bool      `json:"parallelizable"`

	// Set to -1 for infinite retries
	MaxRetries int `json:"maxRetries"`
	Retries    int `json:"retries"`
}

Jump to

Keyboard shortcuts

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