syncer

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorIsNotDirectory = errors.New("the input dir is not a directory")
	ErrorEmptyDirectory = errors.New("the dir is empty")
)
View Source
var (
	ErrorNilOption = errors.New("the option is not set")
)

Functions

This section is empty.

Types

type LocalSyncer

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

func (*LocalSyncer) Persistent

func (s *LocalSyncer) Persistent(ctx context.Context, key string, data io.Reader) (string, error)

func (*LocalSyncer) PickOne

func (s *LocalSyncer) PickOne(ctx context.Context) (string, error)

type Option

type Option struct {
	Endpoint     string
	AccessID     string
	AccessSecret string
	BucketName   string
	Region       string
}

type S3Syncer

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

func (*S3Syncer) Persistent

func (s *S3Syncer) Persistent(ctx context.Context, key string, data io.Reader) (string, error)

func (*S3Syncer) PickOne

func (s *S3Syncer) PickOne(ctx context.Context) (string, error)

type Synchronizer

type Synchronizer interface {
	// Persistent - save data
	Persistent(ctx context.Context, key string, data io.Reader) (location string, err error)

	// PickOne - randomly pick one
	PickOne(ctx context.Context) (location string, err error)
}

Synchronizer - sync remote data into local

func NewLocalSyncer

func NewLocalSyncer(dir string) (Synchronizer, error)

func NewS3Syncer

func NewS3Syncer(opt *Option) (Synchronizer, error)

Jump to

Keyboard shortcuts

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