Documentation ¶
Index ¶
- Constants
- func NewflatedtokenReader(reader Conn) *flatedtokenReader
- func SplitURI(uri string) (string, string, string, error)
- func SplitURIS(uri string) (string, int, string, string, error)
- func TrimPrepath(prepath string) string
- type Attribs
- type Conn
- func (conn *Conn) Close() error
- func (conn *Conn) Read(p []byte) (n int, err error)
- func (conn *Conn) ReadByte() (byte, error)
- func (conn *Conn) ReadInt() (int32, error)
- func (conn *Conn) ReadLong() (int64, error)
- func (conn *Conn) ReadShort() (int16, error)
- func (conn *Conn) ReadVarint() (int64, error)
- func (conn *Conn) Write(p []byte) (n int, err error)
- func (conn *Conn) WriteByte(data byte) error
- func (conn *Conn) WriteInt(data int32) error
- func (conn *Conn) WriteLong(data int64) error
- func (conn *Conn) WriteShort(data int16) error
- type Exclusion
- type FS
- type File
- type FileInfo
- type FileList
- type FileMetadata
- type FileMode
- type MuxReader
- type MuxReaderV0
- type Receiver
- func (r *Receiver) BuildArgs() string
- func (r *Receiver) FileCleaner(localList FileList, deleteList []int) error
- func (r *Receiver) FileDownloader(localList FileList) error
- func (r *Receiver) FinalPhase() error
- func (r *Receiver) Generator(remoteList FileList, downloadList []int, symlinks map[string][]byte) error
- func (r *Receiver) RecvFileList() (FileList, map[string][]byte, error)
- func (r *Receiver) SendExclusions() error
- func (r *Receiver) StartMuxIn()
- func (r *Receiver) Sync() error
- type SSH
- type SendReceiver
- type Sender
- type SumChunk
- type SumStruct
Constants ¶
const ( END_FLAG = 0 TOKEN_LONG = 0x20 TOKENRUN_LONG = 0x21 DEFLATED_DATA = 0x40 TOKEN_REL = 0x80 TOKENRUN_REL = 0xc0 )
const ( RSYNC_VERSION = "@RSYNCD: 27.0\n" RSYNCD_OK = "@RSYNCD: OK" RSYNC_EXIT = "@RSYNCD: EXIT" K = 1 << 10 M = 1 << 20 G = 1 << 30 MAXPATHLEN = 1024 INDEX_END = int32(-1) EXCLUSION_END = int32(0) END1 = '\n' END2 = '\x00' PHASE_END = int32(-1) // ARGUMENTS ARG_SERVER = "--server" ARG_SENDER = "--sender" ARG_SYMLINK = "-l" ARG_RECURSIVE = "-r" ARG_PERMS = "-p" SAMPLE_ARGS = "--server\n--sender\n-l\n-p\n-r\n-t\n.\n" SAMPLE_LIST_ARGS = "--server\n--sender\n--list-only\n-l\n-p\n-r\n-t\n.\n" // For Multiplex(1 byte) MUX_BASE = 7 MSG_DATA = 0 MSG_ERROR_XFER = 1 MSG_INFO = 2 MSG_ERROR = 3 MSG_WARNING = 4 MSG_IO_ERROR = 22 MSG_NOOP = 42 MSG_SUCCESS = 100 MSG_DELETED = 101 MSG_NO_SEND = 102 // For FILE LIST(1 byte) FLIST_END = 0x00 FLIST_TOP_LEVEL = 0x01 /* needed for remote --delete */ FLIST_MODE_SAME = 0x02 /* mode is repeat */ FLIST_RDEV_SAME = 0x04 /* rdev is repeat */ FLIST_UID_SAME = 0x08 /* uid is repeat */ FLIST_GID_SAME = 0x10 /* gid is repeat */ FLIST_NAME_SAME = 0x20 /* name is repeat */ FLIST_NAME_LONG = 0x40 /* name >255 bytes */ FLIST_TIME_SAME = 0x80 /* time is repeat */ // File type S_IFMT = 0170000 /* Type of file */ S_IFREG = 0100000 /* Regular file. */ S_IFDIR = 0040000 /* Directory. */ S_IFLNK = 0120000 /* Symbolic link. */ S_IFCHR = 0020000 /* Character device. */ S_IFBLK = 0060000 /* Block device. */ S_IFIFO = 0010000 /* FIFO. */ S_IFSOCK = 0140000 /* Socket. */ )
Variables ¶
This section is empty.
Functions ¶
func NewflatedtokenReader ¶
func NewflatedtokenReader(reader Conn) *flatedtokenReader
func TrimPrepath ¶
The path always has a trailing slash appended
Types ¶
type Attribs ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
io.ReadWriteCloser This struct has two main attributes, both of them can be used for a plain socket or an SSH
func (*Conn) Close ¶
TODO: If both writer and reader are based on a same Connection (socket, SSH), how to close them twice?
func (*Conn) ReadVarint ¶
func (*Conn) WriteShort ¶
type Exclusion ¶
type Exclusion struct {
// contains filtered or unexported fields
}
Filter List
func (*Exclusion) SendExlusion ¶
This is only called by the client
type FS ¶
type FS interface { Put(fileName string, content io.Reader, fileSize int64, metadata FileMetadata) (written int64, err error) //Get(fileName string, metadata FileMetadata) (File, error) GetURI(path string) (string, error) Delete(fileName string, mode FileMode) error List() (FileList, error) }
File System: need to handle all type of files: regular, folder, symlink, etc
type FileList ¶
type FileList []FileInfo
type FileMetadata ¶
type MuxReader ¶
type MuxReader struct {
// contains filtered or unexported fields
}
func NewMuxReader ¶
func NewMuxReader(reader io.ReadCloser) *MuxReader
type MuxReaderV0 ¶
type MuxReaderV0 struct { Data chan byte // contains filtered or unexported fields }
func NewMuxReaderV0 ¶
func NewMuxReaderV0(reader io.ReadCloser) *MuxReaderV0
func (*MuxReaderV0) Close ¶
func (r *MuxReaderV0) Close() error
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver:
1. Receive File list 2. Request files by sending files' index 3. Receive Files, pass the files to storage
func (*Receiver) FileCleaner ¶
Clean up local files
func (*Receiver) FileDownloader ¶
TODO: It is better to update files in goroutine
func (*Receiver) FinalPhase ¶
func (*Receiver) Generator ¶
func (r *Receiver) Generator(remoteList FileList, downloadList []int, symlinks map[string][]byte) error
Generator: handle files: if it's a regular file, send its index. Otherwise, put them to storage
func (*Receiver) RecvFileList ¶
Return a filelist from remote
func (*Receiver) SendExclusions ¶
type SendReceiver ¶
type SendReceiver interface {
Sync() error
}
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}