db

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTransactionBegin    = errors.New("transaction begin error")
	ErrTransactionRollback = errors.New("transaction rollback error")
	ErrTransactionCommit   = errors.New("transaction commit error")
)

Errors which may occur in transactional operations

Functions

This section is empty.

Types

type DB

type DB interface {
	CreateTemplate(ctx context.Context, solution kube_types.SolutionTemplate) error
	UpdateTemplate(ctx context.Context, solution kube_types.SolutionTemplate) error
	DeleteTemplate(ctx context.Context, solution string) error
	GetTemplatesList(ctx context.Context, isAdmin bool) (*kube_types.SolutionsTemplatesList, error)
	GetTemplate(ctx context.Context, name string) (*kube_types.SolutionTemplate, error)
	ActivateTemplate(ctx context.Context, solution string) error
	DeactivateTemplate(ctx context.Context, solution string) error

	GetSolutionsList(ctx context.Context, userID string) (*kube_types.SolutionsList, error)
	GetNamespaceSolutionsList(ctx context.Context, namespace string) (*kube_types.SolutionsList, error)
	GetSolution(ctx context.Context, namespace, solutionName string) (*kube_types.Solution, error)
	AddSolution(ctx context.Context, solution kube_types.Solution, userID, templateID, uuid, env string) error
	DeleteSolution(ctx context.Context, namespace, solutionName string) error
	CompletelyDeleteSolution(ctx context.Context, namespace, solutionName string) error
	CompletelyDeleteSolutions(ctx context.Context, userID string) error
	CompletelyDeleteNamespaceSolutions(ctx context.Context, namespace string) error

	// Perform operations inside transaction
	// Transaction commits if `f` returns nil error, rollbacks and forwards error otherwise
	// May return ErrTransactionBegin if transaction start failed,
	// ErrTransactionCommit if commit failed, ErrTransactionRollback if rollback failed
	Transactional(ctx context.Context, f func(ctx context.Context, tx DB) error) error

	io.Closer
}

DB is an interface for persistent data storage (also sometimes called DAO).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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