sync

package
v0.10.13 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ADD - addition detected
	ADD = 1
	// REMOVE - removal detected
	REMOVE = 2
)

Variables

This section is empty.

Functions

func PerformSync

func PerformSync(store Store, local []FileRef, remote []FileRef) (added int, removed int, err error)

PerformSync - sync all files to the remote server

func TestIdempotent

func TestIdempotent(config Config, cfg *models.Config) error

TestIdempotent - run the sync twice and check for differences

Types

type Config

type Config struct {
	Profile        string
	Region         string
	Bucket         string
	BucketRootPath string
	FileRootPath   string
}

Config - sync configuration

type FileRef

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

FileRef - reference to a file could be local or remote

func (*FileRef) String

func (f *FileRef) String() string

String - convert file ref to string

type FileRefCollection

type FileRefCollection []FileRef

FileRefCollection - a list of file refs

func (*FileRefCollection) GetReader

func (c *FileRefCollection) GetReader() *bytes.Reader

GetReader -

func (*FileRefCollection) Parse

func (c *FileRefCollection) Parse(reader io.Reader) error

Parse the file references

func (*FileRefCollection) Print

func (c *FileRefCollection) Print()

Print -

type LocalStore

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

LocalStore -

func NewLocalStore

func NewLocalStore(config Config) (*LocalStore, error)

NewLocalStore - create a new store

func (*LocalStore) List

func (store *LocalStore) List() (FileRefCollection, error)

List - list the local files and their hashes

type S3Store

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

S3Store - s3 store

func NewS3Store

func NewS3Store(config Config) (*S3Store, error)

NewS3Store - create a new store

func (*S3Store) Delete

func (store *S3Store) Delete(wg *sync.WaitGroup, f FileRef) error

Delete - delete file from S3

func (*S3Store) List

func (store *S3Store) List() (FileRefCollection, error)

List - list all files

func (*S3Store) Upload

func (store *S3Store) Upload(wg *sync.WaitGroup, f FileRef) error

Upload - upload file to s3

func (*S3Store) UploadFileIndex

func (store *S3Store) UploadFileIndex(f FileRefCollection) error

UploadFileIndex - the file index

type Store

type Store interface {
	List() (FileRefCollection, error)
	Upload(wg *sync.WaitGroup, file FileRef) error
	Delete(wg *sync.WaitGroup, file FileRef) error
	UploadFileIndex(FileRefCollection) error
}

Store - a place to store the site files

type Summary

type Summary struct {
	FilesRemoved            int           `json:"filesRemoved"`
	FilesAdded              int           `json:"filesAdded"`
	FilesTotal              int           `json:"filesTotal"`
	RenderDuration          time.Duration `json:"renderDuration"`
	ChangesDetectedDuration time.Duration `json:"changesDetectedDuration"`
	UploadDuration          time.Duration `json:"uploadDuration"`
	ErrorCount              int           `json:"errorCount"`
	Logs                    []string      `json:"logs"`
}

Summary of the sync process

func Execute

func Execute(config Config) (*Summary, error)

Execute - start a sync

func (*Summary) ToJSON

func (s *Summary) ToJSON() string

ToJSON renders the summary to json

type Sync

type Sync struct {
	Config Config
	Store  Store
}

Sync -

Jump to

Keyboard shortcuts

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