Documentation ¶
Index ¶
- Constants
- type Cache
- func (cache *Cache) Clear()
- func (cache *Cache) GetAllocVersion() int
- func (cache *Cache) GetJob(jobid string) *models.JobBase
- func (cache *Cache) GetJobs() []*models.JobBase
- func (cache *Cache) GetJobsCount() int
- func (cache *Cache) LoadJobs()
- func (cache *Cache) MakeAllocBuffer() ([]byte, error)
- func (cache *Cache) SetAllocBuffer(key string, data []byte) (int, error)
- func (cache *Cache) SetServerConfigsParameter(centerHost string, websiteHost string)
- func (cache *Cache) StartDumpCleaner()
- func (cache *Cache) StopDumpCleaner()
- type CacheConfigs
- type CacheEvent
- type DumpCleaner
- type ErrorCode
- type GetState
- type ICacheHandler
- type IJobGetterHandler
- type JobCacheChangedHandlerFunc
- type JobCacheExceptionHandlerFunc
- type JobGet
- type JobGetError
- type JobGetter
- type JobGetterExceptionHandlerFunc
- type JobGetterHandlerFunc
- type JobStore
- func (store *JobStore) ClearJobs()
- func (store *JobStore) GetAllocVersion() int
- func (store *JobStore) GetJob(jobid string) *models.JobBase
- func (store *JobStore) GetJobs() []*models.JobBase
- func (store *JobStore) GetJobsCount() int
- func (store *JobStore) LoadJobs()
- func (store *JobStore) MakeAllocBuffer() ([]byte, error)
- func (store *JobStore) OnJobGetterExceptionHandlerFunc(workdir string, jobget *JobGet, jobgeterror *JobGetError)
- func (store *JobStore) OnJobGetterHandlerFunc(workdir string, jobbase *models.JobBase)
- func (store *JobStore) SetAllocBuffer(key string, data []byte) error
- func (store *JobStore) SetServerConfigsParameter(centerHost string, websiteHost string)
Constants ¶
const ( ERROR_GETJOBBASE = -1000 //获取任务信息失败 ERROR_READJOBBASE = -1001 //读取任务信息失败 ERROR_PULLJOBFILE = -1002 //拉取任务文件失败 ERROR_DECOMPRESS = -1003 //解压任务文件失败 ERROR_MAKECMDFILE = -1004 //上传任务文件为空,根据Cmd创建脚本文件失败 )
错误值枚举定义
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is exported
func NewCache ¶
func NewCache(configs *CacheConfigs, handler ICacheHandler) *Cache
NewCache is exported
func (*Cache) GetAllocVersion ¶
GetAllocVersion is exported return jobsalloc version
func (*Cache) GetJobsCount ¶
GetJobsCount is exported return jobsalloc job count
func (*Cache) MakeAllocBuffer ¶
MakeAllocBuffer is exported
func (*Cache) SetAllocBuffer ¶
SetAllocBuffer is exported set jobs alloc
func (*Cache) SetServerConfigsParameter ¶
SetServerConfigsParameter is exported
func (*Cache) StartDumpCleaner ¶
func (cache *Cache) StartDumpCleaner()
StartDumpCleaner is exported
type CacheConfigs ¶
type CacheConfigs struct { CenterHost string WebsiteHost string MaxJobs int SaveDirectory string AutoClean bool CleanInterval string PullRecovery string }
CacheConfigs is exported
type CacheEvent ¶
type CacheEvent string
const ( CACHE_EVENT_JOBERROR CacheEvent = "CACHE_EVENT_JOBERROR" CACHE_EVENT_JOBSET CacheEvent = "CACHE_EVENT_JOBSET" CACHE_EVENT_JOBREMOVE CacheEvent = "CACHE_EVENT_JOBREMOVE" )
type DumpCleaner ¶
type DumpCleaner struct { Root string Enabled bool Duration time.Duration // contains filtered or unexported fields }
DumpCleaner is exported
func NewDumpCleaner ¶
func NewDumpCleaner(configs *CacheConfigs) *DumpCleaner
NewDumpCleaner is exported
func (*DumpCleaner) Start ¶
func (dumpCleaner *DumpCleaner) Start()
Start is exported dumpCleaner GC start
func (*DumpCleaner) Stop ¶
func (dumpCleaner *DumpCleaner) Stop()
Stop is exported dumpCleaner GC stop
type ICacheHandler ¶
type ICacheHandler interface { OnJobCacheChangedHandlerFunc(event CacheEvent, jobbase *models.JobBase) OnJobCacheExceptionHandlerFunc(event CacheEvent, workdir string, jobget *JobGet, jobgeterror *JobGetError) }
ICacheHandler is exported
type IJobGetterHandler ¶
type IJobGetterHandler interface { OnJobGetterExceptionHandlerFunc(workdir string, jobget *JobGet, jobgeterror *JobGetError) OnJobGetterHandlerFunc(workdir string, jobbase *models.JobBase) }
IJobGetterHandler is exported
type JobCacheChangedHandlerFunc ¶
type JobCacheChangedHandlerFunc func(event CacheEvent, jobbase *models.JobBase)
func (JobCacheChangedHandlerFunc) OnJobCacheChangedHandlerFunc ¶
func (fn JobCacheChangedHandlerFunc) OnJobCacheChangedHandlerFunc(event CacheEvent, jobbase *models.JobBase)
type JobCacheExceptionHandlerFunc ¶
type JobCacheExceptionHandlerFunc func(event CacheEvent, workdir string, jobget *JobGet, jobgeterror *JobGetError)
func (JobCacheExceptionHandlerFunc) OnJobCacheExceptionHandlerFunc ¶
func (fn JobCacheExceptionHandlerFunc) OnJobCacheExceptionHandlerFunc(event CacheEvent, workdir string, jobget *JobGet, jobgeterror *JobGetError)
type JobGet ¶
type JobGet struct { JobId string //任务编号 JobData *models.JobData //任务分配数据 JobBase *models.JobBase //任务基础信息 State GetState //获取状态 }
JobGet is exported 待获取的Job状态信息
type JobGetError ¶
JobGetError is exported 错误类型定义
func (*JobGetError) String ¶
func (jobGetError *JobGetError) String() string
type JobGetter ¶
type JobGetter struct { sync.RWMutex //互斥锁对象 Root string //缓存根目录 Recovery time.Duration //恢复拉取间隔 CenterHost string //中心服务器API地址 WebsiteHost string //站点文件服务器API地址 // contains filtered or unexported fields }
JobGetter is exported Job信息获取器 1、主要负责Job基础信息获取和Job文件包下载 2、定时恢复失败Job信息或文件的拉取 3、下载Job文件包成功负责解压生成目录结构,写入job.json信息文件
func NewJobGetter ¶
func NewJobGetter(configs *CacheConfigs, handler IJobGetterHandler) *JobGetter
NewJobGetter is exported
type JobGetterExceptionHandlerFunc ¶
type JobGetterExceptionHandlerFunc func(workdir string, jobget *JobGet, jobgeterror *JobGetError)
func (JobGetterExceptionHandlerFunc) OnJobGetterExceptionHandlerFunc ¶
func (fn JobGetterExceptionHandlerFunc) OnJobGetterExceptionHandlerFunc(workdir string, jobget *JobGet, jobgeterror *JobGetError)
type JobGetterHandlerFunc ¶
func (JobGetterHandlerFunc) OnJobGetterHandlerFunc ¶
func (fn JobGetterHandlerFunc) OnJobGetterHandlerFunc(workdir string, jobbase *models.JobBase)
type JobStore ¶
type JobStore struct { sync.RWMutex //互斥锁对象 IJobGetterHandler //getter回调句柄 // contains filtered or unexported fields }
JobStore is exported
func NewJobStore ¶
func NewJobStore(configs *CacheConfigs, changedCallback JobCacheChangedHandlerFunc, exceptionCallback JobCacheExceptionHandlerFunc) *JobStore
NewJobStore is exported jobs & alloc cache
func (*JobStore) ClearJobs ¶
func (store *JobStore) ClearJobs()
ClearJobs is exported clear all cache jobs and alloc.
func (*JobStore) GetAllocVersion ¶
GetAllocVersion is exported return jobs alloc version.
func (*JobStore) GetJobsCount ¶
GetJobsCount is exported return jobs count from cache alloc.
func (*JobStore) LoadJobs ¶
func (store *JobStore) LoadJobs()
LoadJobs is exported load cache root jobs directory data.
func (*JobStore) MakeAllocBuffer ¶
MakeAllocBuffer is exported
func (*JobStore) OnJobGetterExceptionHandlerFunc ¶
func (store *JobStore) OnJobGetterExceptionHandlerFunc(workdir string, jobget *JobGet, jobgeterror *JobGetError)
OnJobGetterExceptionHandlerFunc is exported
func (*JobStore) OnJobGetterHandlerFunc ¶
OnJobGetterHandlerFunc is exported
func (*JobStore) SetAllocBuffer ¶
SetAllocBuffer is exported alloc changed, set alloc data.
func (*JobStore) SetServerConfigsParameter ¶
SetServerConfigsParameter is exported