state

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0, MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ErrNotAssigned = errorString("tasks must be acquired through pop task")
View Source
const ErrWrongWorker = errorString("task already acquired by other worker")

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConnector

type DBConnector interface {
	Connect() error
	Name() string
	RetryableError(error) bool
	SqlDB() *sql.DB
}

DBConnector provides an interface for working with the underlying DB implementations

type RecordUpdateStatus added in v0.0.5

type RecordUpdateStatus int
const (
	LATEST_UPDATE     RecordUpdateStatus = 1
	PREVIOUS_UPDATE   RecordUpdateStatus = 2
	UNATTACHED_RECORD RecordUpdateStatus = 10
	ATTACHED_RECORD   RecordUpdateStatus = 11
)

type State

type State interface {
	AssignTask(ctx context.Context, req tasks.PopTask) (tasks.Task, error)
	Get(ctx context.Context, uuid string) (tasks.Task, error)
	GetAll(ctx context.Context) ([]tasks.Task, error)
	GetHead(ctx context.Context) (tasks.RecordUpdate, error)
	Update(ctx context.Context, uuid string, req tasks.UpdateTask) (tasks.Task, error)
	NewStorageTask(ctx context.Context, storageTask tasks.StorageTask) (tasks.Task, error)
	NewRetrievalTask(ctx context.Context, retrievalTask tasks.RetrievalTask) (tasks.Task, error)
	DrainWorker(ctx context.Context, worker string) error
	PublishRecordsFrom(ctx context.Context, worker string) error
	Store(ctx context.Context) Store
}

State provides an interface for presistence.

func NewStateDB

func NewStateDB(ctx context.Context, driver, conn string, identity crypto.PrivKey, recorder metrics.MetricsRecorder) (State, error)

NewStateDB creates a state instance with a given driver and identity

type Store added in v0.0.5

type Store interface {
	Head() (cid.Cid, error)
	Get(cid.Cid) (blockformat.Block, error)
	Set(cid.Cid, []byte) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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