persistence

package
v0.0.0-...-ede0ace Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PersistenceError

type PersistenceError interface {
	Error() string
	ErrorType() PersistenceErrorType
}

type PersistenceErrorType

type PersistenceErrorType int
const (
	NotFound PersistenceErrorType = 1 + iota
	Conflict
	OtherError
)

type Repository

type Repository interface {

	// job creation. If the job already has an id,
	// an PersistenceError is returned.
	CreateJob(job *model.Job, ctx context.Context) (*model.Job, PersistenceError)

	// get an existing job identified by the id parameter.
	GetJob(id []byte, ctx context.Context) (*model.Job, PersistenceError)

	// get all existing jobs
	GetJobs(ctx context.Context) ([]*model.Job, PersistenceError)

	// create or update the jobExecution of the job identified by the given id
	UpsertJobExecution(ctx context.Context, jobId string, execution *model.JobExecution) (*model.JobExecution, PersistenceError)

	// get an existing user identified by the id parameter.
	GetUser(id string, ctx context.Context) (*model.User, PersistenceError)

	// docker registry creation. If the docker regitry already has an id,
	// an PersistenceError is returned.
	CreateDockerRegistry(registry *model.DockerRegistry, ctx context.Context) (*model.DockerRegistry, PersistenceError)

	// get an existing docker registry identified by the id parameter.
	GetDockerRegistry(id []byte, ctx context.Context) (*model.DockerRegistry, PersistenceError)

	// get all existing docker registries.
	GetDockerRegistries(ctx context.Context) ([]*model.DockerRegistry, PersistenceError)

	// delete one existing docker registry
	DeleteDockerRegistry(id []byte) PersistenceError

	// update one existing docker registry
	UpdateDockerRegistry(id []byte, registry *model.DockerRegistryUpdate, ctx context.Context) (*model.DockerRegistry, PersistenceError)

	// this call will block until the underlying
	// connection or persistence system is open.
	WaitClose()
}

data access layer. Expose functions that allow manipulating data regardless of the underlying persistence system

func GetRepository

func GetRepository(conf *configuration.Conf) Repository

return an instance of Repository configured with given configuration. for the moment, only the 'in-memory' persistence layer is supported

Jump to

Keyboard shortcuts

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