Documentation ¶
Index ¶
- Constants
- Variables
- func BackupDB(r render.Render, req *http.Request)
- func BackupDelete(r render.Render, params martini.Params, let *Lainlet, req *http.Request)
- func BackupFileInfoOrFileList(r render.Render, params martini.Params, let *Lainlet, req *http.Request)
- func BackupMigrate(r render.Render, req *http.Request, params martini.Params, let *Lainlet)
- func BackupMigrateIncrement(r render.Render, req *http.Request, params martini.Params, let *Lainlet)
- func BackupRecover(r render.Render, req *http.Request, params martini.Params, let *Lainlet)
- func BackupRecoverIncrement(r render.Render, req *http.Request, params martini.Params, let *Lainlet)
- func CronAction(r render.Render, params martini.Params, let *Lainlet)
- func CronOnce(r render.Render, params martini.Params, let *Lainlet)
- func GetAllCronJobs(r render.Render, let *Lainlet)
- func GetBackup(r render.Render, params martini.Params, req *http.Request, let *Lainlet)
- func GetCronJob(r render.Render, params martini.Params, let *Lainlet)
- func GetCronJobs(r render.Render, req *http.Request, params martini.Params, let *Lainlet)
- func GetCronRecord(r render.Render, params martini.Params, let *Lainlet)
- func GetCronRecordV2(r render.Render, params martini.Params)
- func GetCronRecords(r render.Render, req *http.Request, params martini.Params, let *Lainlet)
- func GetCronRecordsV2(r render.Render, params martini.Params, req *http.Request)
- func GetIncrementBackupFileList(r render.Render, params martini.Params, let *Lainlet)
- func NotFound(r render.Render)
- func Notify(r render.Render, req *http.Request)
- func Serve(addr string, lainlet *Lainlet)
- func ServerCronJobs(r render.Render, params martini.Params, let *Lainlet)
- func ServerCronStats(r render.Render, params martini.Params)
- func ServerDebug(r render.Render, params martini.Params)
- type Annotation
- type Backend
- func (end *Backend) BackupDelete(files []string) error
- func (end *Backend) BackupInfo(file string) (BackupEntity, error)
- func (end *Backend) BackupRecover(namespace, file, destDir string, extra map[string]string) (string, error)
- func (end *Backend) BackupRecoverIncrement(namespace, dir, destDir string, files []string, extra map[string]string) (string, error)
- func (end *Backend) CronAction(id, action string) (string, error)
- func (end *Backend) CronOnce(id string) (string, error)
- func (end *Backend) Debug() (map[string]interface{}, error)
- func (end *Backend) FixCronJobArgs(action string, args crond.FuncArg)
- func (end *Backend) GetBackup(volumes ...string) ([]BackupEntity, error)
- func (end *Backend) GetBackupInfo(file string) (BackupEntity, error)
- func (end *Backend) GetCronJob(id string) (crond.Job, error)
- func (end *Backend) GetCronJobs(appname string, query map[string]string) ([]crond.EntrySpec, error)
- func (end *Backend) GetCronRecordById(id string) (crond.JobRecord, error)
- func (end *Backend) GetCronRecords(appname string, query map[string]string) ([]crond.JobRecord, error)
- func (end *Backend) GetNotify() ([]string, error)
- func (end *Backend) IncrementBackupFileList(dir string) ([]api.FInfo, error)
- func (end *Backend) RawRequest(method, uri string, data url.Values) ([]byte, error)
- func (end *Backend) RemoveNotify(addr string) error
- func (end *Backend) SetCronJobs(jobs []crond.Job) error
- func (end *Backend) SetNotify(addr string) error
- func (end *Backend) StartCrond() error
- func (end *Backend) StopCrond() error
- type BackupEntity
- type BackupInfo
- type Controller
- func (c *Controller) BackupFileInfo(proc, file string) (BackupEntity, error)
- func (c *Controller) BackupRecover(proc, volume, file string, from int, to int) (string, error)
- func (c *Controller) CronAction(id, action string) (string, error)
- func (c *Controller) CronOnce(id string) (string, error)
- func (c *Controller) DeleteBackup(proc string, files []string) error
- func (c *Controller) GetBackup(proc string, volumes ...string) ([]BackupEntity, error)
- func (c *Controller) GetCronJob(id string) (crond.Job, error)
- func (c *Controller) GetCronJobs(query map[string]string) ([]crond.EntrySpec, error)
- func (c *Controller) GetCronRecordById(id string) (crond.JobRecord, error)
- func (c *Controller) GetCronRecords(query map[string]string) ([]crond.JobRecord, error)
- func (c *Controller) IncrementBackupFileList(proc, dir string) ([]api.FInfo, error)
- func (c *Controller) IncrementBackupRecover(proc, volume string, from, to int, backupDir string, files []string) (string, error)
- type Lainlet
- func (ll *Lainlet) AbsDir(app, proc string, instanceNo int, volume string) string
- func (ll *Lainlet) BroadcastCronJobs(nodes []string)
- func (ll *Lainlet) CheckBackend()
- func (ll *Lainlet) DictKey(app, proc string) string
- func (ll *Lainlet) GetCoreInfo(app string) map[string][]lainlet.PodInfoForBackupctl
- func (ll *Lainlet) GetJobs() map[string][]crond.Job
- func (ll *Lainlet) GetNode(app, proc string, instanceNo int) (string, error)
- func (ll *Lainlet) GetNodes(app, proc string) ([]string, error)
- func (ll *Lainlet) ProcFullName(app, proc string) (string, bool)
- func (ll *Lainlet) UpdateCronJobs() []string
- func (ll *Lainlet) VolumeAbs(app, proc string, volumes ...string) ([]string, error)
- func (ll *Lainlet) Volumes(app, proc string) ([]string, error)
- func (ll *Lainlet) Watcher()
Constants ¶
View Source
const ( VOLUME_ROOT = "/data/lain/volumes" BackupFunc = "backup" ExpireFunc = "backup_expire" ExpireSchedule = "* * * * *" NotifyURI = "/api/v2/system/notify" )
Variables ¶
View Source
var ( Advertise = "127.0.0.1" DaemonPort = 9002 DaemonApiPrefix = "/api/v1" )
Functions ¶
func BackupDelete ¶
func BackupMigrate ¶
func BackupMigrateIncrement ¶
func BackupRecover ¶
func BackupRecoverIncrement ¶
func GetAllCronJobs ¶
func GetCronJobs ¶
func GetCronRecords ¶
func GetCronRecordsV2 ¶
Types ¶
type Annotation ¶
type Annotation struct { Mountpoint []string `json:"mountpoint"` Backup []BackupInfo `json:"backup"` }
annotation in body shoule be like this:
{ "mountpoint": [ "hello.lain.local/foo", "hello.lain" ], "backup": [ { "procname": "hello.web.web", "expire": "30d", "schedule": "0 0 5 0 0", "volume": "/dev/registry", "preRun": "./backup.sh", "postRun": "end.sh", } ] }
type Backend ¶
func NewBackend ¶
func (*Backend) BackupDelete ¶
func (*Backend) BackupInfo ¶
func (end *Backend) BackupInfo(file string) (BackupEntity, error)
func (*Backend) BackupRecover ¶
func (*Backend) BackupRecoverIncrement ¶
func (*Backend) FixCronJobArgs ¶
func (*Backend) GetBackup ¶
func (end *Backend) GetBackup(volumes ...string) ([]BackupEntity, error)
func (*Backend) GetBackupInfo ¶
func (end *Backend) GetBackupInfo(file string) (BackupEntity, error)
func (*Backend) GetCronJobs ¶
func (*Backend) GetCronRecordById ¶
func (*Backend) GetCronRecords ¶
func (*Backend) IncrementBackupFileList ¶
func (*Backend) RawRequest ¶
func (*Backend) RemoveNotify ¶
func (*Backend) StartCrond ¶
type BackupEntity ¶
type BackupInfo ¶
type BackupInfo struct { AppName string `json:"appname"` ProcName string `json:"procname"` Containers []string `json:"containers"` InstanceNo int `json:"instanceNo"` Volume string `json:"volume"` Expire string `json:"expire"` Schedule string `json:"schedule"` PreRun string `json:"preRun"` PostRun string `json:"postRun"` Mode string `json:"mode"` }
func (*BackupInfo) ArchiveName ¶
func (bi *BackupInfo) ArchiveName() string
func (*BackupInfo) Dir ¶
func (bi *BackupInfo) Dir() string
func (*BackupInfo) Valid ¶
func (bi *BackupInfo) Valid() bool
type Controller ¶
type Controller struct { App string // contains filtered or unexported fields }
func NewController ¶
func NewController(app string, lainlet *Lainlet) *Controller
func (*Controller) BackupFileInfo ¶
func (c *Controller) BackupFileInfo(proc, file string) (BackupEntity, error)
func (*Controller) BackupRecover ¶
func (*Controller) CronAction ¶
func (c *Controller) CronAction(id, action string) (string, error)
func (*Controller) DeleteBackup ¶
func (c *Controller) DeleteBackup(proc string, files []string) error
func (*Controller) GetBackup ¶
func (c *Controller) GetBackup(proc string, volumes ...string) ([]BackupEntity, error)
func (*Controller) GetCronJob ¶
func (c *Controller) GetCronJob(id string) (crond.Job, error)
func (*Controller) GetCronJobs ¶
func (*Controller) GetCronRecordById ¶
func (c *Controller) GetCronRecordById(id string) (crond.JobRecord, error)
func (*Controller) GetCronRecords ¶
func (*Controller) IncrementBackupFileList ¶
func (c *Controller) IncrementBackupFileList(proc, dir string) ([]api.FInfo, error)
func (*Controller) IncrementBackupRecover ¶
type Lainlet ¶
type Lainlet struct { Addr string // contains filtered or unexported fields }
func NewLainlet ¶
func (*Lainlet) BroadcastCronJobs ¶
func (*Lainlet) CheckBackend ¶
func (ll *Lainlet) CheckBackend()
func (*Lainlet) GetCoreInfo ¶
func (ll *Lainlet) GetCoreInfo(app string) map[string][]lainlet.PodInfoForBackupctl
func (*Lainlet) UpdateCronJobs ¶
iterate the Lainlet.data, generate jobs for every node jobs stored into Lainlet.cronJobs
Click to show internal directories.
Click to hide internal directories.