-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsync.go
More file actions
24 lines (20 loc) · 854 Bytes
/
sync.go
File metadata and controls
24 lines (20 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package syncbox
// Constants for the action to sync
const (
ActionAdd = "add"
ActionDelete = "delete"
ActionRename = "rename"
ActionUpdate = "update"
ActionGet = "get"
)
// FileManipulator function type that do CRUD on files
type FileManipulator func(rootPath string, unrootPath string, file *File, peer *Peer) error
// DirManipulator function type that do CRUD on dirs
type DirManipulator func(rootPath string, unrootPath string, dir *Dir, peer *Peer) error
// Syncer is the interface to send file CRUD requests
type Syncer interface {
AddFile(rootPath string, unrootPath string, file *File, peer *Peer) error
DeleteFile(rootPath string, unrootPath string, file *File, peer *Peer) error
AddDir(rootPath string, unrootPath string, dir *Dir, peer *Peer) error
DeleteDir(rootPath string, unrootPath string, dir *Dir, peer *Peer) error
}