Documentation ¶
Index ¶
- Constants
- func BanAccount(email string) error
- func CleanupLogs(expiration time.Duration)
- func CreateAccount(u *Account) error
- func EnsureAccountIndex() error
- func EnsureJobLogIndex()
- func GetJobLatestLogListByJobIds(jobIds []string) (m map[string]*JobLatestLog, err error)
- func UpdateAccount(query bson.M, change bson.M) error
- type Account
- type JobLatestLog
- type JobLog
- type Role
- type StatExecuted
- type UserStatus
Constants ¶
View Source
const ( Coll_JobLog = "job_log" Coll_JobLatestLog = "job_latest_log" Coll_Stat = "stat" )
View Source
const (
Coll_Account = "account"
)
Variables ¶
This section is empty.
Functions ¶
func BanAccount ¶
func CleanupLogs ¶
func CreateAccount ¶
func EnsureAccountIndex ¶
func EnsureAccountIndex() error
func EnsureJobLogIndex ¶
func EnsureJobLogIndex()
func GetJobLatestLogListByJobIds ¶
func GetJobLatestLogListByJobIds(jobIds []string) (m map[string]*JobLatestLog, err error)
Types ¶
type Account ¶
type Account struct { ID bson.ObjectId `bson:"_id" json:"id"` Role Role `bson:"role" json:"role"` Email string `bson:"email" json:"email"` Password string `bson:"password" json:"password"` Salt string `bson:"salt" json:"salt"` Status UserStatus `bson:"status" json:"status"` Session string `bson:"session" json:"-"` // If true, role and status are unchangeable, email and password can be change by it self only. Unchangeable bool `bson:"unchangeable" json:"-"` CreateTime time.Time `bson:"createTime" json:"createTime"` }
func GetAccountByEmail ¶
type JobLatestLog ¶
type JobLatestLog struct { JobLog `bson:",inline"` RefLogId string `bson:"refLogId,omitempty" json:"refLogId"` }
func GetJobLatestLogList ¶
type JobLog ¶
type JobLog struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` JobId string `bson:"jobId" json:"jobId"` // 任务 Id,索引 JobGroup string `bson:"jobGroup" json:"jobGroup"` // 任务分组,配合 Id 跳转用 User string `bson:"user" json:"user"` // 执行此次任务的用户 Name string `bson:"name" json:"name"` // 任务名称 Node string `bson:"node" json:"node"` // 运行此次任务的节点 id,索引 Hostname string `bson:"hostname" json:"hostname"` // 运行此次任务的节点主机名称,索引 IP string `bson:"ip" json:"ip"` // 运行此次任务的节点主机IP,索引 Command string `bson:"command" json:"command,omitempty"` // 执行的命令,包括参数 Output string `bson:"output" json:"output,omitempty"` // 任务输出的所有内容 Success bool `bson:"success" json:"success"` // 是否执行成功 BeginTime time.Time `bson:"beginTime" json:"beginTime"` // 任务开始执行时间,精确到毫秒,索引 EndTime time.Time `bson:"endTime" json:"endTime"` // 任务执行完毕时间,精确到毫秒 Cleanup time.Time `bson:"cleanup,omitempty" json:"-"` // 日志清除时间标志 }
任务执行记录
type StatExecuted ¶
type StatExecuted struct { Total int64 `bson:"total" json:"total"` Successed int64 `bson:"successed" json:"successed"` Failed int64 `bson:"failed" json:"failed"` Date string `bson:"date" json:"date"` }
func JobLogDailyStat ¶
func JobLogDailyStat(begin, end time.Time) (ls []*StatExecuted, err error)
func JobLogStat ¶
func JobLogStat() (s *StatExecuted, err error)
type UserStatus ¶
type UserStatus int
const ( UserBanned UserStatus = -1 UserActived UserStatus = 1 )
func (UserStatus) Defined ¶
func (s UserStatus) Defined() bool
Click to show internal directories.
Click to hide internal directories.