gosync

package
v0.0.0-...-a867615 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package gosync implements backup and restore between a local file directory and an Amazon AWS S3 bucket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config defines the configuration and context for a sync operation.

func NewConfig

func NewConfig() *Config

NewConfig creates a new configuration, starting with default values, then potentially overriden from CLI flags. Since this is parsing the CLI, it can only be called only once - and it's a feature, not a bug, intended to discourage simultaneous processing with different configs

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig provides a default configuration

func (*Config) ProcessFiles

func (c *Config) ProcessFiles()

ProcessFiles performs a check on all files, checking what files or S3 objects should be changed. If we re not in the xxxmock mode, changes will be made asynchroneously.

func (*Config) ProcessObjects

func (c *Config) ProcessObjects()

ProcessObjects performs a check on all s3 objects, checking what S3 or files changes are needed. If we are not in the xxxMock mode, changes will be made asynchroneously.

func (*Config) RemoveAllEmptyDirs

func (c *Config) RemoveAllEmptyDirs()

RemoveAllEmptyDirs remove all empty directories from the source file. Mostly useful after a restore, if file folder was not initially empty. Never called implicitely on backup/restore. Special care is taken to ensure nested empty dirs are also removed.

func (*Config) SetMode

func (c *Config) SetMode(m Mode) *Config

SetMode sets the mode for the sync operation (backup or restore)

func (*Config) SetPerm

func (c *Config) SetPerm(dirPermission os.FileMode) *Config

SetPerm sets the permission (FileMode) to use when creating missing directories.

func (*Config) String

func (c *Config) String() string

type DstObject

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

DstObject describes the S3 object in the target bucket.

func (*DstObject) String

func (o *DstObject) String() string

type Mode

type Mode int

Mode indicates in what direction we are synchronizing, and if modifications are actually made.

const (
	ModeBackupMock Mode = iota // File => S3
	ModeBackup

	ModeRestoreMock // S3 => File
	ModeRestore

	ModeCleanEmptyDirs
)

Dining the Mode constants. xxxMock means no operation is actually performed.

func (*Mode) String

func (m *Mode) String() string

type SrcFile

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

SrcFile describe the source file locally. Dirs are ignored.

func (*SrcFile) String

func (s *SrcFile) String() string

Jump to

Keyboard shortcuts

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