syncer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPath    = fmt.Errorf("invalid vault kv path")
	ErrTransform      = fmt.Errorf("transform error")
	ErrInvalidMeta    = fmt.Errorf("invalid vault meta")
	ErrInvalidInfo    = fmt.Errorf("invalid sync info")
	ErrInvalidBucket  = fmt.Errorf("invalid sync info bucket")
	ErrInvalidIndex   = fmt.Errorf("invalid sync info index")
	ErrInvalidInsight = fmt.Errorf("invalid insight")
	ErrUnknownOp      = fmt.Errorf("unknown operation")
	ErrCorrupted      = fmt.Errorf("I got ¡™£¢∞NeuRALyzED§¶•ªº! Sync info in corrupted state")
	ErrInitialize     = fmt.Errorf("Nope, not gonna work! Sync info not initialized")
)
View Source
var IgnoreDeletes = false

Functions

func CompareBuckets

func CompareBuckets(origin Bucket, destination Bucket) ([]Task, []Task, []Task, []error)

func FetchAndSave

func FetchAndSave(ctx context.Context,
	wg *sync.WaitGroup, workerId int,
	originVault *vault.Client, destinationVault *vault.Client,
	info *Info, pack transformer.Pack,
	inTaskCh chan Task, errCh chan error)

func GenerateInsight

func GenerateInsight(ctx context.Context,
	wg *sync.WaitGroup, workerId int,
	v *vault.Client, i *Info,
	inPathCh chan string, errCh chan error)

func InfoFromConsul

func InfoFromConsul(c *consul.Client, i *Info, syncPath string) (err error)

func InfoToConsul

func InfoToConsul(c *consul.Client, i *Info, syncPath string) error

Types

type Bucket

type Bucket map[string]Insight

type Info

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

func NewInfo

func NewInfo(size int, h hash.Hash) (*Info, error)

func (*Info) Compare

func (origin *Info) Compare(destination *Info) ([]Task, []Task, []Task, []error)

func (*Info) Delete

func (i *Info) Delete(path string) (int, error)

func (*Info) GetBucket

func (i *Info) GetBucket(id int) (Bucket, error)

func (*Info) GetIndex

func (i *Info) GetIndex() ([]string, error)

func (*Info) Put

func (i *Info) Put(path string, insight Insight) (int, error)

func (*Info) Reindex

func (i *Info) Reindex() error

type Insight

type Insight struct {
	Version    int64  `json:"version"`
	UpdateTime string `json:"updateTime"`
	Type       string `json:"type"`
}

type KVV2Meta

type KVV2Meta struct {
	CurrentVersion      int64
	UpdatedTime         string
	CurrentDeletionTime string
	Destroyed           bool
}

type Task

type Task struct {
	Path    string
	Op      string
	Insight Insight
}

Jump to

Keyboard shortcuts

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