Documentation ¶
Index ¶
- func CloseTx(tx *db.Tx, err error)
- func CreateObject(ctx context.Context, o *Object) (err error)
- func DeleteObject(ctx context.Context, p string) (err error)
- func DeleteTask(ctx context.Context) (err error)
- func DeleteTaskByName(ctx context.Context, p string) (err error)
- func GetCurrentJobID(ctx context.Context) (id uint64, err error)
- func GetSequence(ctx context.Context) (n uint64, err error)
- func HasObject(ctx context.Context) (b bool, err error)
- func ListObject(ctx context.Context, fn func(*Object)) (err error)
- func NextSequence(ctx context.Context) (n uint64, err error)
- func UpdateCurrentJobID(ctx context.Context, n uint64) (err error)
- type Endpoint
- type Job
- type Object
- 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(s 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 CloseTx ¶
CloseTx will close tx with err. If err is nil, we will try to commit this tx. If err is not nil, we will rollback.
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 GetCurrentJobID ¶
GetCurrentJobID will get current job ID.
func GetSequence ¶
GetSequence will get current bucket's sequence.
func ListObject ¶
ListObject will list current task's object.
func NextSequence ¶
NextSequence will return bucket's next sequence.
Types ¶
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 Job ¶
Job stores job status.
type Object ¶
type Object struct { Key string `msgpack:"p"` IsDir bool `msgpack:"id"` Size int64 `msgpack:"s"` LastModified int64 `msgpack:"lm"` ContentMD5 []byte `msgpack:"cm"` }
Object stores object info.
type Task ¶
type Task struct { Name string `yaml:"name" msgpack:"n"` Type string `yaml:"type" msgpack:"t"` Src *Endpoint `yaml:"source" msgpack:"src"` Dst *Endpoint `yaml:"destination" msgpack:"dst"` Overwrite bool `yaml:"overwrite" msgpack:"o"` IgnoreExisting bool `yaml:"ignore_existing" msgpack:"ie"` IgnoreUnmodified bool `yaml:"ignore_unmodified" msgpack:"iu"` // Data that only stores in database. Status string `yaml:"-" msgpack:"s"` Marker string `yaml:"-" msgpack:"ma"` }
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.