memdb

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GaiaMemDB

type GaiaMemDB interface {
	// SyncStore syncs the memdb with the store.
	SyncStore() error

	// GetAllWorker returns all worker.
	GetAllWorker() []*gaia.Worker

	// UpsertWorker inserts or updates the given worker in the memdb.
	// If persist is true, the given worker will be persisted in the store.
	UpsertWorker(w *gaia.Worker, persist bool) error

	// GetWorker returns a worker by the given identifier.
	GetWorker(id string) (*gaia.Worker, error)

	// DeleteWorker deletes a worker by the given identifier.
	// If persist is true, the worker will also be deleted from the store.
	DeleteWorker(id string, persist bool) error

	// InsertPipelineRun inserts a pipeline run in the memdb.
	InsertPipelineRun(p *gaia.PipelineRun) error

	// PopPipelineRun gets the oldest pipeline run by tags and removes it immediately
	// from the memdb.
	PopPipelineRun(tags []string) (*gaia.PipelineRun, error)

	// DeletePipelineRun deletes the given pipeline run from the memdb.
	DeletePipelineRun(runID string) error

	// InsertDockerWorker inserts a docker worker into the memdb.
	InsertDockerWorker(w *docker.Worker) error

	// GetDockerWorker gets the docker worker by the given worker id.
	GetDockerWorker(workerID string) (*docker.Worker, error)

	// DeleteDockerWorker deletes the docker worker by then given worker id.
	DeleteDockerWorker(workerID string) error

	// GetAllDockerWorker gets all docker worker.
	GetAllDockerWorker() ([]*docker.Worker, error)
}

GaiaMemDB is the interface used to talk to the MemDB implementation.

func InitMemDB

func InitMemDB(s store.GaiaStore) (GaiaMemDB, error)

InitMemDB initiates a new memdb db.

type MemDB

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

MemDB represents the implementation of the MemDB interface.

func (*MemDB) DeleteDockerWorker

func (m *MemDB) DeleteDockerWorker(workerID string) error

DeleteDockerWorker deletes the docker worker by then given worker id.

func (*MemDB) DeletePipelineRun

func (m *MemDB) DeletePipelineRun(runID string) error

DeletePipelineRun deletes the given pipeline run from the memdb.

func (*MemDB) DeleteWorker

func (m *MemDB) DeleteWorker(id string, persist bool) error

DeleteWorker deletes a worker from the memdb. If persist is true, the worker will also be deleted from the store.

func (*MemDB) GetAllDockerWorker

func (m *MemDB) GetAllDockerWorker() ([]*docker.Worker, error)

GetAllDockerWorker gets all docker worker.

func (*MemDB) GetAllWorker

func (m *MemDB) GetAllWorker() []*gaia.Worker

GetAllWorker returns all worker.

func (*MemDB) GetDockerWorker

func (m *MemDB) GetDockerWorker(workerID string) (*docker.Worker, error)

GetDockerWorker returns the docker worker by the given worker id.

func (*MemDB) GetWorker

func (m *MemDB) GetWorker(id string) (*gaia.Worker, error)

GetWorker returns a worker by the given identifier.

func (*MemDB) InsertDockerWorker

func (m *MemDB) InsertDockerWorker(w *docker.Worker) error

InsertDockerWorker inserts a docker worker into the memdb.

func (*MemDB) InsertPipelineRun

func (m *MemDB) InsertPipelineRun(p *gaia.PipelineRun) error

InsertPipelineRun inserts a pipeline run into the memdb.

func (*MemDB) PopPipelineRun

func (m *MemDB) PopPipelineRun(tags []string) (*gaia.PipelineRun, error)

PopPipelineRun gets the oldest pipeline run filtered by tags and removes it immediately from the memdb.

func (*MemDB) SyncStore

func (m *MemDB) SyncStore() error

SyncStore syncs the memdb with the store.

func (*MemDB) UpsertWorker

func (m *MemDB) UpsertWorker(w *gaia.Worker, persist bool) error

UpsertWorker inserts or updates the given worker in the memdb. If persist is true, the given worker will be persisted in the store.

Jump to

Keyboard shortcuts

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