sync

package
v3.7.8 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sync will sync multiple stores

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

Option sets Sync Options

func Stores

func Stores(stores ...store.Store) Option

Stores sets the layers that make up the sync

func SyncInterval

func SyncInterval(d time.Duration) Option

nolint: golint,revive SyncInterval sets the duration between syncs from L0 to L1

func SyncMultiplier

func SyncMultiplier(i int64) Option

nolint: golint,revive SyncMultiplier sets the multiplication factor for time to wait each sync layer

type Options

type Options struct {
	// Stores represents layers in the sync in ascending order. L0, L1, L2, etc
	Stores []store.Store
	// SyncInterval is the duration between syncs from L0 to L1
	SyncInterval time.Duration
	// SyncMultiplier is the multiplication factor between each store.
	SyncMultiplier int64
}

Options represents Sync options

type Sync

type Sync interface {
	// Implements the store interface
	store.Store
	// Force a full sync
	Sync() error
}

Sync implements a sync in for stores

func NewSync

func NewSync(opts ...Option) Sync

NewSync returns a new Sync

Jump to

Keyboard shortcuts

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