sync

package
v0.0.0-...-e38a99a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	contract.Status
	contract.FileInfo
	// Action the action of file change
	Action action.Action `json:"action"`
	// BaseUrl the base url of file server
	BaseUrl string `json:"base_url"`
}

Message a message of the remote file change

type Sync

type Sync interface {
	// Create create the path
	Create(path string) error
	// Write write the data to path
	Write(path string) error
	// Remove remove the path
	Remove(path string) error
	// Rename rename the path
	Rename(path string) error
	// Chmod change the mode of path
	Chmod(path string) error
	// IsDir is a dir the path
	IsDir(path string) (bool, error)
	// SyncOnce sync the path to dest once
	SyncOnce(path string) error
	// Source the source file system
	Source() core.VFS
	// Dest the destination file system
	Dest() core.VFS
}

Sync a file sync interface

func NewDiskSync

func NewDiskSync(source, dest core.VFS, enableLogicallyDelete bool) (s Sync, err error)

NewDiskSync create a diskSync instance source is source path to read dest is dest path to write

func NewPushClientSync

func NewPushClientSync(source, dest core.VFS, enableTLS bool, users []*auth.User, enableLogicallyDelete bool) (Sync, error)

func NewRemoteClientSync

func NewRemoteClientSync(source, dest core.VFS, users []*auth.User, enableLogicallyDelete bool) (Sync, error)

NewRemoteClientSync create an instance of remoteClientSync to receive the file change message and execute it

func NewRemoteServerSync

func NewRemoteServerSync(source, dest core.VFS, enableTLS bool, certFile string, keyFile string, users []*auth.User, enableLogicallyDelete bool) (Sync, error)

NewRemoteServerSync create an instance of remoteServerSync execute send file change message

func NewRemoteSync

func NewRemoteSync(source, dest core.VFS, enableTLS bool, certFile string, keyFile string, users []*auth.User, enableLogicallyDelete bool) (Sync, error)

NewRemoteSync auto create an instance of remoteServerSync or remoteClientSync according to source and dest

func NewSync

func NewSync(source core.VFS, dest core.VFS, enableTLS bool, certFile string, keyFile string, users []*auth.User, enableLogicallyDelete bool) (Sync, error)

NewSync auto create an instance of the expected sync according to source and dest

Jump to

Keyboard shortcuts

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