Documentation ¶
Index ¶
Constants ¶
View Source
const (
FileSystemTypeMock = "mock"
)
Variables ¶
This section is empty.
Functions ¶
func CompareEntry ¶
Types ¶
type Connector ¶
type Connector interface { // Copy source to target system. Target path must include file name. // Connector callbacks onSuccess or onFailure to tell an result. // Copy operation may block to wait I/O. Copy(source Entry, target Path, onSuccess func(pair CopyPair, copied Entry), onFailure func(pair CopyPair, err FileSystemError)) // Start up the connector Startup(qd eq_queue.Definition) (err FileSystemError) // Clean up connector Shutdown() (err FileSystemError) }
type CopyPair ¶
func NewCopyPair ¶
type Entry ¶
type Entry interface { // Name of the entry. Name() string // Path of the entry. Path() Path // Size of the entry. Size() int64 // Modification time. ModTime() time.Time // Content hash. ContentHash() (string, FileSystemError) // True when the entry is a file. IsFile() bool // True when the entry is a folder. IsFolder() bool // Convert as serializable data AsData() EntryData }
func NewMockFileEntry ¶
func NewMockFolderEntry ¶
type EntryData ¶
type EntryData struct { FileSystemType string `json:"file_system_type"` EntryName string `json:"name"` EntryPath string `json:"path"` EntrySize int64 `json:"size"` EntryModTime time.Time `json:"mod_time"` EntryIsFile bool `json:"is_file"` EntryIsFolder bool `json:"is_folder"` Attributes map[string]interface{} `json:"attributes,omitempty"` }
type FileSystem ¶
type FileSystem interface { // List entries of the path. List(path Path) (entries []Entry, err FileSystemError) // Retrieve entry of the path. Info(path Path) (entry Entry, err FileSystemError) // Delete path. Delete(path Path) (err FileSystemError) // Create folder. Returns created entry on success, otherwise returns nil for entry. CreateFolder(path Path) (entry Entry, err FileSystemError) // Deserialize entry from entry data. // Returns err if the format is not valid for this file system. Entry(data EntryData) (entry Entry, err FileSystemError) // Deserialize path from path data. Path(data PathData) (path Path, err FileSystemError) // Deserialize shard from shard data. Shard(data ShardData) (shard Shard, err FileSystemError) // Type of file system FileSystemType() string // Operation complexity parameter in this file system OperationalComplexity(entries []Entry) (complexity int64) }
Abstract file system interface.
type FileSystemError ¶
type FileSystemError interface { error // True if a path is not found. IsPathNotFound() bool // True if an operation detect conflict of the path. IsConflict() bool // True if the user doesn't have permissions to write to the target. IsNoPermission() bool // True if the file system doesn't have enough available space to write more data. IsInsufficientSpace() bool // True if the file system doesn't allow name of the entry. IsDisallowedName() bool // True if the entry data is not valid for this file system. IsInvalidEntryDataFormat() bool // True if the error is for testing IsMockError() bool }
func NewLowLevelError ¶
func NewLowLevelError(ge error) FileSystemError
type MockEntry ¶
func (MockEntry) ContentHash ¶
func (z MockEntry) ContentHash() (string, FileSystemError)
type Path ¶
type Path interface { // Base name of the path entry. Base() string // Cleaned absolute path in the file system. Path() string // Shard of the path. Shard() Shard // Ancestor path. Returns root path if this instance is root. Ancestor() Path // Returns descendant path with pathFragment. Descendant(pathFragment ...string) Path // True if the path indicates root path of the namespace. IsRoot() bool // Serialize AsData() PathData }
func NewMockPath ¶
type PathData ¶
type Shard ¶
type Shard interface { // string representation of Shard ID. // Drive letter, or server name for windows file system (e.g. C:, \\SERVER\). // Or namespace ID (shared_folder_id/team_folder_id) of Dropbox file system. Id() string // Serialize AsData() ShardData }
Shard is for load balancing factor.
Click to show internal directories.
Click to hide internal directories.