syncer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareHashes

func CompareHashes(src, dst string) (string, string, error)

func Copy

func Copy(src string, dst string) error

Copies the whole directory recursively

func GetHashFromFile

func GetHashFromFile(path string) (string, error)

Get a sha256 from a single file

Used in conjunction with

GetHashFromPath() and GetHashFromTarget()

To check which files to copy over when syncing

func GetHashFromPath

func GetHashFromPath(path string) (string, error)

The same as

GetHashFromTarget(config.Target)

But doesn't require the use of config.Target

func GetHashFromTarget

func GetHashFromTarget(target config.Target) (string, error)

This version relies on 3rd party packages and a virtual filesystem

Get a general checksum of a whole directory, which is derived from the files in it

func IsTargetInDestination added in v0.0.2

func IsTargetInDestination(target config.Target) bool

Types

type Syncer

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

func NewSyncer

func NewSyncer(target config.Target) *Syncer

Call to create a new syncer

Should call this on every new target

func (*Syncer) CheckChanges

func (s *Syncer) CheckChanges() bool

if there is a change, return true

func (*Syncer) Free

func (s *Syncer) Free() bool

Free all the memory the struct takes up and return true if successful

func (*Syncer) Sync

func (s *Syncer) Sync()

Only actually syncs if the hash has changed, Always updates the hash to the new value afterwards

No copying occurs if the hash has not changed

Jump to

Keyboard shortcuts

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