cache

package
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinLRUSize     = 128
	MaxLRUSize     = 1024
	DefaultLRUSize = 256
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocCacheEventHandlerFunc

type AllocCacheEventHandlerFunc func(event AllocEvent, location string, data []byte, err error)

AllocCacheEventHandlerFunc is exported

type AllocEvent

type AllocEvent int

AllocEvent is exported

const (
	ALLOC_CREATED_EVENT AllocEvent = iota + 1
	ALLOC_CHANGED_EVENT
	ALLOC_REMOVED_EVENT
)

func (AllocEvent) String

func (event AllocEvent) String() string

type AllocStore

type AllocStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

AllocStore is exported

func NewAllocStore

func NewAllocStore(callback AllocCacheEventHandlerFunc) *AllocStore

NewAllocStore is exported

func (*AllocStore) ClearAlloc

func (store *AllocStore) ClearAlloc()

ClearAlloc is exported

func (*AllocStore) CreateAlloc

func (store *AllocStore) CreateAlloc(location string, data []byte)

CreateAlloc is exported

func (*AllocStore) CreateAllocJob

func (store *AllocStore) CreateAllocJob(location string, key string, jobId string)

CreateAllocJob is exported create jobdata to location alloc.

func (*AllocStore) GetAlloc

func (store *AllocStore) GetAlloc(location string) *models.JobsAlloc

GetAlloc is exported return location jobsalloc.

func (*AllocStore) GetAllocJob

func (store *AllocStore) GetAllocJob(location string, jobId string) *models.JobData

GetAllocJob is exported return location alloc's jobdata.

func (*AllocStore) GetAllocJobIds

func (store *AllocStore) GetAllocJobIds(location string, key string) []string

GetAllocJobIds is exported return all jobs ids contained in location key.

func (*AllocStore) HasAlloc

func (store *AllocStore) HasAlloc(location string) bool

HasAlloc is exported

func (*AllocStore) HasAllocJobId

func (store *AllocStore) HasAllocJobId(location string, jobId string) bool

HasAllocJobId is exported

func (*AllocStore) RemoveAlloc

func (store *AllocStore) RemoveAlloc(location string)

RemoveAlloc is exported

func (*AllocStore) RemoveAllocJob

func (store *AllocStore) RemoveAllocJob(location string, jobId string)

RemoveAllocJob is exported remove jobdata to location alloc.

func (*AllocStore) RemoveAllocJobs

func (store *AllocStore) RemoveAllocJobs(location string, jobIds []string)

RemoveAllocJobs is exported

func (*AllocStore) SetAllocJobsKey

func (store *AllocStore) SetAllocJobsKey(location string, jobs map[string]string)

SetAllocJobsKey is exported set location alloc's jobs key.

func (*AllocStore) UpdateAllocJobs

func (store *AllocStore) UpdateAllocJobs(location string, jobIds []string)

UpdateAllocJobs is exported update location's jobIds version & alloc version.

type CacheConfigs

type CacheConfigs struct {
	LRUSize                 int
	StorageBackend          types.Backend
	StorageDriverParameters types.Parameters
	AllocHandlerFunc        AllocCacheEventHandlerFunc
	NodeHandlerFunc         NodeCacheEventHandlerFunc
	ReadLocationAllocFunc   ReadLocationAllocFunc
	ProcLocationAllocFunc   ProcLocationAllocFunc
}

CacheConfigs is exported

type CacheRepository

type CacheRepository struct {
	// contains filtered or unexported fields
}

CacheRepository is expotred

func NewCacheRepository

func NewCacheRepository(configs *CacheConfigs) (*CacheRepository, error)

NewCacheRepository is expotred

func (*CacheRepository) ChangeLocationAlloc

func (cacheRepository *CacheRepository) ChangeLocationAlloc(location string)

ChangeLocationAlloc is exported

func (*CacheRepository) ChangeWorker

func (cacheRepository *CacheRepository) ChangeWorker(key string, node *gzkwrapper.NodeData)

ChangeWorker is exported

func (*CacheRepository) ChoiceWorker

func (cacheRepository *CacheRepository) ChoiceWorker(location string, key string, servers []string) *Worker

ChoiceWorker is exported

func (*CacheRepository) Clear

func (cacheRepository *CacheRepository) Clear()

Clear is expotred

func (*CacheRepository) Close

func (cacheRepository *CacheRepository) Close()

Close is exported

func (*CacheRepository) CreateAllocJob

func (cacheRepository *CacheRepository) CreateAllocJob(location string, key string, jobId string)

CreateAllocJob is exported

func (*CacheRepository) CreateLocationAlloc

func (cacheRepository *CacheRepository) CreateLocationAlloc(location string)

CreateLocationAlloc is exported

func (*CacheRepository) CreateWorker

func (cacheRepository *CacheRepository) CreateWorker(key string, node *gzkwrapper.NodeData)

CreateWorker is exported

func (*CacheRepository) GetAlloc

func (cacheRepository *CacheRepository) GetAlloc(location string) *models.JobsAlloc

GetAlloc is exported

func (*CacheRepository) GetAllocData

func (cacheRepository *CacheRepository) GetAllocData(location string) *models.JobsAllocData

GetAllocData is exported

func (*CacheRepository) GetAllocJob

func (cacheRepository *CacheRepository) GetAllocJob(location string, jobId string) *models.JobData

GetAllocJob is exported

func (*CacheRepository) GetAllocJobIds

func (cacheRepository *CacheRepository) GetAllocJobIds(location string, key string) []string

GetAllocJobIds is exported

func (*CacheRepository) GetJob

func (cacheRepository *CacheRepository) GetJob(jobid string) *models.Job

GetJob is exported

func (*CacheRepository) GetLocation

func (cacheRepository *CacheRepository) GetLocation(location string) *models.WorkLocation

GetLocation is exported

func (*CacheRepository) GetLocationGroup

func (cacheRepository *CacheRepository) GetLocationGroup(location string, groupid string) *models.Group

GetLocationGroup is exported

func (*CacheRepository) GetLocationGroups

func (cacheRepository *CacheRepository) GetLocationGroups(location string) []*models.Group

GetLocationGroups is exported

func (*CacheRepository) GetLocationServers

func (cacheRepository *CacheRepository) GetLocationServers(location string) []*models.Server

GetLocationServers is exported

func (*CacheRepository) GetLocationSimpleJobs

func (cacheRepository *CacheRepository) GetLocationSimpleJobs(location string) []*models.SimpleJob

GetLocationSimpleJobs is exported

func (*CacheRepository) GetLocationsName

func (cacheRepository *CacheRepository) GetLocationsName() []string

GetLocationsName is exported

func (*CacheRepository) GetRawJob

func (cacheRepository *CacheRepository) GetRawJob(jobid string) *models.Job

GetRawJob is exported

func (*CacheRepository) GetSimpleJob

func (cacheRepository *CacheRepository) GetSimpleJob(jobid string) *models.SimpleJob

GetSimpleJob is exported

func (*CacheRepository) GetWorker

func (cacheRepository *CacheRepository) GetWorker(key string) *Worker

GetWorker is exported

func (*CacheRepository) GetWorkers

func (cacheRepository *CacheRepository) GetWorkers(location string) []*Worker

GetWorkers is exported

func (*CacheRepository) HasAlloc

func (cacheRepository *CacheRepository) HasAlloc(location string) bool

HasAlloc is exported

func (*CacheRepository) HasAllocJobId

func (cacheRepository *CacheRepository) HasAllocJobId(location string, jobId string) bool

HasAllocJobId is exported

func (*CacheRepository) InitLocalStorageLocations

func (cacheRepository *CacheRepository) InitLocalStorageLocations()

InitLocalStorageLocations is exported

func (*CacheRepository) Open

func (cacheRepository *CacheRepository) Open() error

Open is exported

func (*CacheRepository) RemoveAllocJob

func (cacheRepository *CacheRepository) RemoveAllocJob(location string, jobId string)

RemoveAllocJob is exported

func (*CacheRepository) RemoveAllocJobs

func (cacheRepository *CacheRepository) RemoveAllocJobs(location string, jobIds []string)

RemoveAllocJobs is exported

func (*CacheRepository) RemoveJob

func (cacheRepository *CacheRepository) RemoveJob(jobid string)

RemoveJob is exported

func (*CacheRepository) RemoveJobs

func (cacheRepository *CacheRepository) RemoveJobs(jobIds []string)

RemoveJobs is exported

func (*CacheRepository) RemoveLocationAlloc

func (cacheRepository *CacheRepository) RemoveLocationAlloc(location string)

RemoveLocationAlloc is exported

func (*CacheRepository) RemoveWorker

func (cacheRepository *CacheRepository) RemoveWorker(key string, node *gzkwrapper.NodeData)

RemoveWorker is exported

func (*CacheRepository) SetAllocJobsKey

func (cacheRepository *CacheRepository) SetAllocJobsKey(location string, jobs map[string]string)

SetAllocJobsKey is exported

func (*CacheRepository) SetJobAction

func (cacheRepository *CacheRepository) SetJobAction(location string, jobid string, action string)

SetJobAction is exported

func (*CacheRepository) SetJobExecute

func (cacheRepository *CacheRepository) SetJobExecute(jobid string, state int, execerr string, execat time.Time, nextat time.Time)

SetJobExecute is exported

func (*CacheRepository) SetJobLog

func (cacheRepository *CacheRepository) SetJobLog(joblog *models.JobLog)

SetJobLog is exported

func (*CacheRepository) SetJobNextAt

func (cacheRepository *CacheRepository) SetJobNextAt(jobid string, nextat time.Time)

SetJobNextAt is exported

func (*CacheRepository) SetJobState

func (cacheRepository *CacheRepository) SetJobState(jobid string, state int)

SetJobState is exported

func (*CacheRepository) SetStorageDriverConfigParameters

func (cacheRepository *CacheRepository) SetStorageDriverConfigParameters(parameters types.Parameters)

SetStorageDriverConfigParameters is exported

func (*CacheRepository) UpdateAllocJob

func (cacheRepository *CacheRepository) UpdateAllocJob(location string, jobId string)

UpdateAllocJob is exported

func (*CacheRepository) UpdateAllocJobs

func (cacheRepository *CacheRepository) UpdateAllocJobs(location string, jobIds []string)

UpdateAllocJobs is exported

type LocalStorage

type LocalStorage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LocalStorage is exported

func NewLocalStorage

func NewLocalStorage(lurSize int) *LocalStorage

NewLocalStorage is exported

func (*LocalStorage) AddJob

func (storage *LocalStorage) AddJob(job *models.Job)

AddJob is exported

func (*LocalStorage) Clear

func (storage *LocalStorage) Clear()

Clear is exported

func (*LocalStorage) ContainsLocationServer

func (storage *LocalStorage) ContainsLocationServer(location string, ipaddr string, hostname string) bool

ContainsLocationServer is exported

func (*LocalStorage) GetJob

func (storage *LocalStorage) GetJob(jobid string) *models.Job

GetJob is exported

func (*LocalStorage) GetLocation

func (storage *LocalStorage) GetLocation(location string) *models.WorkLocation

GetLocation is exported

func (*LocalStorage) GetLocationGroup

func (storage *LocalStorage) GetLocationGroup(location string, groupid string) *models.Group

GetLocationGroup is exported

func (*LocalStorage) GetLocationGroups

func (storage *LocalStorage) GetLocationGroups(location string) []*models.Group

GetLocationGroups is exported

func (*LocalStorage) GetLocationServers

func (storage *LocalStorage) GetLocationServers(location string) []*models.Server

GetLocationServers is exported

func (*LocalStorage) GetLocationsName

func (storage *LocalStorage) GetLocationsName() []string

GetLocationsName is exported

func (*LocalStorage) RemoveJob

func (storage *LocalStorage) RemoveJob(jobid string)

RemoveJob is exported

func (*LocalStorage) RemoveLocation

func (storage *LocalStorage) RemoveLocation(location string)

RemoveLocation is exported

func (*LocalStorage) SetLocation

func (storage *LocalStorage) SetLocation(workLocation *models.WorkLocation)

SetLocation is exported

type NodeCacheEventHandlerFunc

type NodeCacheEventHandlerFunc func(event NodeEvent, location string, worker *Worker)

NodeCacheEventHandlerFunc is exported

type NodeEvent

type NodeEvent int

NodeEvent is exported

const (
	NODE_CREATED_EVENT NodeEvent = iota + 1
	NODE_CHANGED_EVENT
	NODE_REMOVED_EVENT
)

func (NodeEvent) String

func (event NodeEvent) String() string

type NodeStore

type NodeStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NodeStore is exported

func NewNodeStore

func NewNodeStore(callback NodeCacheEventHandlerFunc) *NodeStore

NewNodeStore is exported

func (*NodeStore) ChangeWorker

func (store *NodeStore) ChangeWorker(location string, attach *models.AttachData, server *models.Server)

ChangeWorker is exported

func (*NodeStore) ClearWorkers

func (store *NodeStore) ClearWorkers()

ClearWorkers is exported

func (*NodeStore) ContainsLocationWorker

func (store *NodeStore) ContainsLocationWorker(location string, ipaddr string) bool

ContainsLocationWorker is exported

func (*NodeStore) CreateWorker

func (store *NodeStore) CreateWorker(location string, attach *models.AttachData, server *models.Server)

CreateWorker is exported

func (*NodeStore) GetWorker

func (store *NodeStore) GetWorker(key string) *Worker

GetWorker is exported

func (*NodeStore) GetWorkers

func (store *NodeStore) GetWorkers(location string) []*Worker

GetWorkers is exported

func (*NodeStore) HashLocationRangeWorker

func (store *NodeStore) HashLocationRangeWorker(location string, key string, servers []string) *Worker

HashLocationRangeWorker is exported

func (*NodeStore) HashLocationWorker

func (store *NodeStore) HashLocationWorker(location string, key string) *Worker

HashLocationWorker is exported

func (*NodeStore) RemoveLocation

func (store *NodeStore) RemoveLocation(location string)

RemoveLocation is exported

func (*NodeStore) RemoveWorker

func (store *NodeStore) RemoveWorker(location string, key string)

RemoveWorker is exported

type ProcLocationAllocFunc

type ProcLocationAllocFunc func(location string, addServers []*models.Server, delServers []*models.Server)

ProcLocationAllocFunc is exported

type ReadLocationAllocFunc

type ReadLocationAllocFunc func(location string) []byte

ReadLocationAllocFunc is exported read jobs alloc path real data.

type Worker

type Worker struct {
	Location string
	*models.AttachData
	*models.Server
}

Worker is exported

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL