database

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionDB added in v0.4.0

type ExecutionDB interface {
	Find(executionHash hash.Hash) (*execution.Execution, error)
	Save(execution *execution.Execution) error
	OpenTransaction() (ExecutionTransaction, error)
	io.Closer
}

ExecutionDB exposes all the functionalities

type ExecutionTransaction added in v0.11.0

type ExecutionTransaction interface {
	Find(executionHash hash.Hash) (*execution.Execution, error)
	Save(execution *execution.Execution) error
	Commit() error
	Discard()
}

ExecutionTransaction is the transaction handle.

type InstanceDB added in v0.11.0

type InstanceDB interface {
	// Exist check if instance with given hash exist.
	Exist(hash hash.Hash) (bool, error)

	// Get retrives instance by instance hash.
	Get(hash hash.Hash) (*instance.Instance, error)

	// GetAll retrieves all instances.
	GetAll() ([]*instance.Instance, error)

	// Save saves instance to database.
	Save(i *instance.Instance) error

	// Delete an instance by instance hash.
	Delete(hash hash.Hash) error

	// Close closes underlying database connection.
	Close() error
}

InstanceDB describes the API of Instance database.

type LevelDBExecutionDB added in v0.4.0

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

LevelDBExecutionDB is a concrete implementation of the DB interface

func NewExecutionDB added in v0.4.0

func NewExecutionDB(path string) (*LevelDBExecutionDB, error)

NewExecutionDB creates a new DB instance

func (*LevelDBExecutionDB) Close added in v0.4.0

func (db *LevelDBExecutionDB) Close() error

Close closes database.

func (*LevelDBExecutionDB) Find added in v0.4.0

func (db *LevelDBExecutionDB) Find(executionHash hash.Hash) (*execution.Execution, error)

Find the execution based on an executionHash, returns an error if not found

func (*LevelDBExecutionDB) OpenTransaction added in v0.11.0

func (db *LevelDBExecutionDB) OpenTransaction() (ExecutionTransaction, error)

OpenTransaction opens an atomic DB transaction. Only one transaction can be opened at a time.

func (*LevelDBExecutionDB) Save added in v0.4.0

func (db *LevelDBExecutionDB) Save(execution *execution.Execution) error

Save an instance of executable in the database Returns an error if anything from marshaling to database saving goes wrong

type LevelDBExecutionTransaction added in v0.11.0

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

LevelDBExecutionTransaction is the transaction handle.

func (*LevelDBExecutionTransaction) Commit added in v0.11.0

func (tx *LevelDBExecutionTransaction) Commit() error

Commit commits the transaction.

func (*LevelDBExecutionTransaction) Discard added in v0.11.0

func (tx *LevelDBExecutionTransaction) Discard()

Discard discards the transaction.

func (*LevelDBExecutionTransaction) Find added in v0.11.0

func (tx *LevelDBExecutionTransaction) Find(executionHash hash.Hash) (*execution.Execution, error)

Find the execution based on an executionHash, returns an error if not found

func (*LevelDBExecutionTransaction) Save added in v0.11.0

Save an instance of executable in the database Returns an error if anything from marshaling to database saving goes wrong

type LevelDBInstanceDB added in v0.11.0

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

LevelDBInstanceDB is a database for storing services' instances.

func NewInstanceDB added in v0.11.0

func NewInstanceDB(path string) (*LevelDBInstanceDB, error)

NewInstanceDB returns the database which is located under given path.

func (*LevelDBInstanceDB) Close added in v0.11.0

func (d *LevelDBInstanceDB) Close() error

Close closes database.

func (*LevelDBInstanceDB) Delete added in v0.11.0

func (d *LevelDBInstanceDB) Delete(hash hash.Hash) error

Delete deletes an instance from database.

func (*LevelDBInstanceDB) Exist added in v0.14.0

func (d *LevelDBInstanceDB) Exist(hash hash.Hash) (bool, error)

Exist check if instance with given hash exist.

func (*LevelDBInstanceDB) Get added in v0.11.0

func (d *LevelDBInstanceDB) Get(hash hash.Hash) (*instance.Instance, error)

Get retrives instance by instance hash.

func (*LevelDBInstanceDB) GetAll added in v0.11.0

func (d *LevelDBInstanceDB) GetAll() ([]*instance.Instance, error)

GetAll retrieves all instances.

func (*LevelDBInstanceDB) Save added in v0.11.0

Save saves instance to database.

type LevelDBProcessDB added in v0.14.0

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

LevelDBProcessDB is a database for storing processes definition.

func NewProcessDB added in v0.14.0

func NewProcessDB(path string) (*LevelDBProcessDB, error)

NewProcessDB returns the database which is located under given path.

func (*LevelDBProcessDB) All added in v0.14.0

func (d *LevelDBProcessDB) All() ([]*process.Process, error)

All returns every process in database.

func (*LevelDBProcessDB) Close added in v0.14.0

func (d *LevelDBProcessDB) Close() error

Close closes database.

func (*LevelDBProcessDB) Delete added in v0.14.0

func (d *LevelDBProcessDB) Delete(hash hash.Hash) error

Delete deletes process from database.

func (*LevelDBProcessDB) Get added in v0.14.0

func (d *LevelDBProcessDB) Get(hash hash.Hash) (*process.Process, error)

Get retrives process from database.

func (*LevelDBProcessDB) Save added in v0.14.0

func (d *LevelDBProcessDB) Save(s *process.Process) error

Save stores process in database. If there is an another process that uses the same sid, it'll be deleted.

type ProcessDB added in v0.14.0

type ProcessDB interface {
	// Save saves a process to database.
	Save(s *process.Process) error

	// Get gets a process from database by its unique hash.
	Get(hash hash.Hash) (*process.Process, error)

	// Delete deletes a process from database by its unique hash.
	Delete(hash hash.Hash) error

	// All returns all processes from database.
	All() ([]*process.Process, error)

	// Close closes underlying database connection.
	Close() error
}

ProcessDB describes the API of database package.

type ServiceDB

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

ServiceDB is a database for storing service definition.

func NewServiceDB

func NewServiceDB(s store.Store, cdc *codec.Codec) *ServiceDB

NewServiceDB returns the database which is located under given path.

func (*ServiceDB) All

func (d *ServiceDB) All() ([]*service.Service, error)

All returns every service in database.

func (*ServiceDB) Close

func (d *ServiceDB) Close() error

Close closes database.

func (*ServiceDB) Delete

func (d *ServiceDB) Delete(hash hash.Hash) error

Delete deletes service from database.

func (*ServiceDB) Exist added in v0.14.0

func (d *ServiceDB) Exist(hash hash.Hash) (bool, error)

Exist check if service with given hash exist.

func (*ServiceDB) Get

func (d *ServiceDB) Get(hash hash.Hash) (*service.Service, error)

Get retrives service from database.

func (*ServiceDB) Save

func (d *ServiceDB) Save(s *service.Service) error

Save stores service in database. If there is an another service that uses the same sid, it'll be deleted.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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