store

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrJobAlreadyExists = errors.New("job with same key already exists")
	ErrJobNotFound      = errors.New("job not found")
)

Functions

This section is empty.

Types

type CommandsHandler

type CommandsHandler interface {
	GetHandlers() map[uint64]func(WritableState, []byte) (interface{}, error)
}

type JobInfo

type JobInfo struct {
	State jobs.State
	// contains filtered or unexported fields
}

type ReadonlyState

type ReadonlyState interface {
	GetJob(key string) (*JobInfo, error)
	GetJobsByType(jobType string) []JobInfo
	GetAllJobs() []JobInfo
	GetPeerJobsKeys(peerID string) []string
	GetUnassignedJobsKeys() []string
	GetPeers() []string
}

type Store

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

func NewStore

func NewStore(handler CommandsHandler, typeProvider provider.TypeProvider) *Store

func (*Store) Apply

func (s *Store) Apply(l *raft.Log) interface{}

func (*Store) Restore

func (s *Store) Restore(rc io.ReadCloser) error

func (*Store) Snapshot

func (s *Store) Snapshot() (raft.FSMSnapshot, error)

func (*Store) VisitReadonlyState

func (s *Store) VisitReadonlyState(f func(ReadonlyState))

type WritableState

type WritableState interface {
	ReadonlyState
	InsertJob(job jobs.Job) error
	AcquireJob(key string, peerID string)
	DeleteJob(key string)
	UnassignPeer(peerID string)
	ApplyPostExecution(jobKey, err string, executedTime time.Time)
	AddPeer(peerID string)
	RemovePeer(peerID string)
}

Jump to

Keyboard shortcuts

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