Documentation
¶
Index ¶
- func CreateObject(ctx context.Context, o Object) (err error)
- func DeleteObject(ctx context.Context, o Object) (err error)
- func DeleteTask(ctx context.Context) (err error)
- func DeleteTaskByName(ctx context.Context, p string) (err error)
- func HasDirectoryObject(ctx context.Context) (b bool, err error)
- func HasPartialObject(ctx context.Context) (b bool, err error)
- func HasParts(ctx context.Context, key string) (b bool, err error)
- func HasSingleObject(ctx context.Context) (b bool, err error)
- type DirectoryObject
- type Endpoint
- type Object
- type PartialObject
- type SingleObject
- type Task
- func GetTask(ctx context.Context) (t *Task, err error)
- func GetTaskByName(ctx context.Context, p string) (t *Task, err error)
- func ListTask(ctx context.Context) (t []*Task, err error)
- func LoadTask(name, taskPath string) (t *Task, err error)
- func LoadTaskFromContent(content []byte) (t *Task, err error)
- func LoadTaskFromFilePath(filePath string) (t *Task, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateObject ¶
CreateObject will create an object in db.
func DeleteObject ¶
DeleteObject will delete an object.
func DeleteTask ¶
DeleteTask will delete a task from content.
func DeleteTaskByName ¶
DeleteTaskByName will delete a task by it's name.
func HasDirectoryObject ¶
HasDirectoryObject will check whether db has not finished directory object.
func HasPartialObject ¶
HasPartialObject will check whether db has not finished partial object.
Types ¶
type DirectoryObject ¶
DirectoryObject is the object for directory.
func NextDirectoryObject ¶
func NextDirectoryObject(ctx context.Context, p string) (o *DirectoryObject, err error)
NextDirectoryObject will return the next directory object after p.
type Endpoint ¶
type Endpoint struct {
Type string `yaml:"type" msgpack:"t"`
Path string `yaml:"path" msgpack:"p"`
Options map[string]interface{} `yaml:"options" msgpack:"o"`
}
Endpoint store data for endpoint.
type PartialObject ¶
type PartialObject struct {
Key string `msgpack:"p"`
Size int64 `msgpack:"s"`
Offset int64 `msgpack:"of"`
MD5 string `msgpack:"cm"`
TotalNumber int `msgpack:"tn"`
PartNumber int `msgpack:"pn"`
UploadID string `msgpack:"uid"`
}
PartialObject is a partial object.
func NextPartialObject ¶
NextPartialObject will return the next single object after p.
type SingleObject ¶
type SingleObject struct {
Key string `msgpack:"p"`
Size int64 `msgpack:"s"`
LastModified int64 `msgpack:"lm"`
MD5 string `msgpack:"cm"`
}
SingleObject is a single object.
func NextSingleObject ¶
func NextSingleObject(ctx context.Context, p string) (o *SingleObject, err error)
NextSingleObject will return the next single object after p.
type Task ¶
type Task struct {
Type string `yaml:"type" msgpack:"t"`
Src *Endpoint `yaml:"source" msgpack:"src"`
Dst *Endpoint `yaml:"destination" msgpack:"dst"`
IgnoreExisting string `yaml:"ignore_existing" msgpack:"ie"`
MultipartBoundarySize int64 `yaml:"multipart_boundary_size" msgpack:"mbs"`
// Data that only stores in database.
Name string `yaml:"-" msgpack:"n"`
Status string `yaml:"-" msgpack:"s"`
// Date that only keep in memory.
Handle func(ctx context.Context, o Object) (err error) `yaml:"-" msgpack:"-"`
}
Task store all data for a task.
func GetTaskByName ¶
GetTaskByName will get task by it's name.
func LoadTaskFromContent ¶
LoadTaskFromContent will load config from file content.
func LoadTaskFromFilePath ¶
LoadTaskFromFilePath will load config from specific file path.