store

package
v0.0.0-...-d892afd Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BelaurStore

type BelaurStore interface {
	SettingsStore
	Init(dataPath string) error
	Close() error
	CreatePipelinePut(createPipeline *belaur.CreatePipeline) error
	CreatePipelineGet() (listOfPipelines []belaur.CreatePipeline, err error)
	PipelinePut(pipeline *belaur.Pipeline) error
	PipelineGet(id int) (pipeline *belaur.Pipeline, err error)
	PipelineGetByName(name string) (pipline *belaur.Pipeline, err error)
	PipelineGetRunHighestID(pipeline *belaur.Pipeline) (id int, err error)
	PipelinePutRun(r *belaur.PipelineRun) error
	PipelineGetScheduled(limit int) ([]*belaur.PipelineRun, error)
	PipelineGetRunByPipelineIDAndID(pipelineid int, runid int) (*belaur.PipelineRun, error)
	PipelineGetAllRuns() ([]belaur.PipelineRun, error)
	PipelineGetAllRunsByPipelineID(pipelineID int) ([]belaur.PipelineRun, error)
	PipelineGetLatestRun(pipelineID int) (*belaur.PipelineRun, error)
	PipelineGetRunByID(runID string) (*belaur.PipelineRun, error)
	PipelineDelete(id int) error
	PipelineRunDelete(uniqueID string) error
	UserPut(u *belaur.User, encryptPassword bool) error
	UserAuth(u *belaur.User, updateLastLogin bool) (*belaur.User, error)
	UserGet(username string) (*belaur.User, error)
	UserGetAll() ([]belaur.User, error)
	UserDelete(u string) error
	UserPermissionsPut(perms *belaur.UserPermission) error
	UserPermissionsGet(username string) (*belaur.UserPermission, error)
	UserPermissionsDelete(username string) error
	WorkerPut(w *belaur.Worker) error
	WorkerGetAll() ([]*belaur.Worker, error)
	WorkerDelete(id string) error
	WorkerDeleteAll() error
	WorkerGet(id string) (*belaur.Worker, error)
	UpsertSHAPair(pair belaur.SHAPair) error
	GetSHAPair(pipelineID int) (bool, belaur.SHAPair, error)
	BhojpurStore() persist.BatchAdapter
}

BelaurStore is the interface that defines methods needed to store pipeline and user related information.

type BoltStore

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

BoltStore represents the access type for store

func NewBoltStore

func NewBoltStore() *BoltStore

NewBoltStore creates a new instance of Store.

func (*BoltStore) BhojpurStore

func (s *BoltStore) BhojpurStore() persist.BatchAdapter

BhojpurStore is as a getter for the Bhojpur Policy store adapter.

func (*BoltStore) Close

func (s *BoltStore) Close() error

Close closes the active boltdb connection.

func (*BoltStore) CreatePermissionsIfNotExisting

func (s *BoltStore) CreatePermissionsIfNotExisting() error

CreatePermissionsIfNotExisting iterates any existing users and creates default permissions if they don't exist. This is most probably when they have upgraded to the Bhojpur Belaur version where permissions was added.

func (*BoltStore) CreatePipelineGet

func (s *BoltStore) CreatePipelineGet() ([]belaur.CreatePipeline, error)

CreatePipelineGet returns all available create pipeline objects in the store.

func (*BoltStore) CreatePipelinePut

func (s *BoltStore) CreatePipelinePut(p *belaur.CreatePipeline) error

CreatePipelinePut adds a pipeline which is not yet compiled but is about to.

func (*BoltStore) GetSHAPair

func (s *BoltStore) GetSHAPair(pipelineID int) (ok bool, pair belaur.SHAPair, err error)

GetSHAPair returns a pair of shas for this pipeline run.

func (*BoltStore) Init

func (s *BoltStore) Init(dataPath string) error

Init creates the data folder if not exists, generates private key and bolt database. This should be called only once per database because bolt holds a lock on the database file.

func (*BoltStore) PipelineDelete

func (s *BoltStore) PipelineDelete(id int) error

PipelineDelete deletes the pipeline with the given id.

func (*BoltStore) PipelineGet

func (s *BoltStore) PipelineGet(id int) (*belaur.Pipeline, error)

PipelineGet gets a pipeline by given id.

func (*BoltStore) PipelineGetAllRuns

func (s *BoltStore) PipelineGetAllRuns() ([]belaur.PipelineRun, error)

PipelineGetAllRuns loads all existing pipeline runs.

func (*BoltStore) PipelineGetAllRunsByPipelineID

func (s *BoltStore) PipelineGetAllRunsByPipelineID(pipelineID int) ([]belaur.PipelineRun, error)

PipelineGetAllRunsByPipelineID looks for all pipeline runs by the given pipeline id.

func (*BoltStore) PipelineGetByName

func (s *BoltStore) PipelineGetByName(n string) (*belaur.Pipeline, error)

PipelineGetByName looks up a pipeline by the given name. Returns nil if pipeline was not found.

func (*BoltStore) PipelineGetLatestRun

func (s *BoltStore) PipelineGetLatestRun(pipelineID int) (*belaur.PipelineRun, error)

PipelineGetLatestRun returns the latest run by the given pipeline id.

func (*BoltStore) PipelineGetRunByID

func (s *BoltStore) PipelineGetRunByID(runID string) (*belaur.PipelineRun, error)

PipelineGetRunByID returns the pipeline run by internal unique id.

func (*BoltStore) PipelineGetRunByPipelineIDAndID

func (s *BoltStore) PipelineGetRunByPipelineIDAndID(pipelineid int, runid int) (*belaur.PipelineRun, error)

PipelineGetRunByPipelineIDAndID looks for pipeline run by given pipeline id and run id.

func (*BoltStore) PipelineGetRunHighestID

func (s *BoltStore) PipelineGetRunHighestID(p *belaur.Pipeline) (int, error)

PipelineGetRunHighestID looks for the highest public id for the given pipeline.

func (*BoltStore) PipelineGetScheduled

func (s *BoltStore) PipelineGetScheduled(limit int) ([]*belaur.PipelineRun, error)

PipelineGetScheduled returns the scheduled pipelines with a return limit.

func (*BoltStore) PipelinePut

func (s *BoltStore) PipelinePut(p *belaur.Pipeline) error

PipelinePut puts a pipeline into the store. On persist, the pipeline will get a unique id.

func (*BoltStore) PipelinePutRun

func (s *BoltStore) PipelinePutRun(r *belaur.PipelineRun) error

PipelinePutRun takes the given pipeline run and puts it into the store. If a pipeline run already exists in the store it will be overwritten.

func (*BoltStore) PipelineRunDelete

func (s *BoltStore) PipelineRunDelete(uniqueID string) error

PipelineRunDelete deletes the pipeline run with the given id.

func (*BoltStore) SettingsGet

func (s *BoltStore) SettingsGet() (*belaur.StoreConfig, error)

SettingsGet gets a pipeline by given id.

func (*BoltStore) SettingsPut

func (s *BoltStore) SettingsPut(c *belaur.StoreConfig) error

SettingsPut puts settings into the store.

func (*BoltStore) UpsertSHAPair

func (s *BoltStore) UpsertSHAPair(pair belaur.SHAPair) error

UpsertSHAPair creates or updates a record for a SHA pair of the original SHA and the rebuilt Worker SHA for a pipeline.

func (*BoltStore) UserAuth

func (s *BoltStore) UserAuth(u *belaur.User, updateLastLogin bool) (*belaur.User, error)

UserAuth looks up a user by given username. Then it compares passwords and returns user obj if given password is valid. Returns nil if password was wrong or user not found.

func (*BoltStore) UserDelete

func (s *BoltStore) UserDelete(u string) error

UserDelete deletes the given user.

func (*BoltStore) UserGet

func (s *BoltStore) UserGet(username string) (*belaur.User, error)

UserGet looks up a user by given username. Returns nil if user was not found.

func (*BoltStore) UserGetAll

func (s *BoltStore) UserGetAll() ([]belaur.User, error)

UserGetAll returns all stored users.

func (*BoltStore) UserPermissionsDelete

func (s *BoltStore) UserPermissionsDelete(username string) error

UserPermissionsDelete deletes permission data for a given username.

func (*BoltStore) UserPermissionsGet

func (s *BoltStore) UserPermissionsGet(username string) (*belaur.UserPermission, error)

UserPermissionsGet gets the permission data for a given username.

func (*BoltStore) UserPermissionsPut

func (s *BoltStore) UserPermissionsPut(perms *belaur.UserPermission) error

UserPermissionsPut adds or updates user permissions.

func (*BoltStore) UserPut

func (s *BoltStore) UserPut(u *belaur.User, encryptPassword bool) error

UserPut takes the given user and saves it to the bolt database. User will be overwritten if it already exists. It also clears the password field afterwards.

func (*BoltStore) WorkerDelete

func (s *BoltStore) WorkerDelete(id string) error

WorkerDelete deletes a worker by the given identifier.

func (*BoltStore) WorkerDeleteAll

func (s *BoltStore) WorkerDeleteAll() error

WorkerDeleteAll deletes all worker objects in the bucket.

func (*BoltStore) WorkerGet

func (s *BoltStore) WorkerGet(id string) (*belaur.Worker, error)

WorkerGet gets a worker by the given identifier.

func (*BoltStore) WorkerGetAll

func (s *BoltStore) WorkerGetAll() ([]*belaur.Worker, error)

WorkerGetAll returns all existing worker objects from the store. It returns an error when the action failed.

func (*BoltStore) WorkerPut

func (s *BoltStore) WorkerPut(w *belaur.Worker) error

WorkerPut stores the given worker in the bolt database. Worker object will be overwritten in case it already exist.

type SettingsStore

type SettingsStore interface {
	SettingsPut(config *belaur.StoreConfig) error
	SettingsGet() (*belaur.StoreConfig, error)
}

SettingsStore is the interface that defines methods needed to save settings config into the store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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