Documentation ¶
Index ¶
- type BelaurStore
- type BoltStore
- func (s *BoltStore) BhojpurStore() persist.BatchAdapter
- func (s *BoltStore) Close() error
- func (s *BoltStore) CreatePermissionsIfNotExisting() error
- func (s *BoltStore) CreatePipelineGet() ([]belaur.CreatePipeline, error)
- func (s *BoltStore) CreatePipelinePut(p *belaur.CreatePipeline) error
- func (s *BoltStore) GetSHAPair(pipelineID int) (ok bool, pair belaur.SHAPair, err error)
- func (s *BoltStore) Init(dataPath string) error
- func (s *BoltStore) PipelineDelete(id int) error
- func (s *BoltStore) PipelineGet(id int) (*belaur.Pipeline, error)
- func (s *BoltStore) PipelineGetAllRuns() ([]belaur.PipelineRun, error)
- func (s *BoltStore) PipelineGetAllRunsByPipelineID(pipelineID int) ([]belaur.PipelineRun, error)
- func (s *BoltStore) PipelineGetByName(n string) (*belaur.Pipeline, error)
- func (s *BoltStore) PipelineGetLatestRun(pipelineID int) (*belaur.PipelineRun, error)
- func (s *BoltStore) PipelineGetRunByID(runID string) (*belaur.PipelineRun, error)
- func (s *BoltStore) PipelineGetRunByPipelineIDAndID(pipelineid int, runid int) (*belaur.PipelineRun, error)
- func (s *BoltStore) PipelineGetRunHighestID(p *belaur.Pipeline) (int, error)
- func (s *BoltStore) PipelineGetScheduled(limit int) ([]*belaur.PipelineRun, error)
- func (s *BoltStore) PipelinePut(p *belaur.Pipeline) error
- func (s *BoltStore) PipelinePutRun(r *belaur.PipelineRun) error
- func (s *BoltStore) PipelineRunDelete(uniqueID string) error
- func (s *BoltStore) SettingsGet() (*belaur.StoreConfig, error)
- func (s *BoltStore) SettingsPut(c *belaur.StoreConfig) error
- func (s *BoltStore) UpsertSHAPair(pair belaur.SHAPair) error
- func (s *BoltStore) UserAuth(u *belaur.User, updateLastLogin bool) (*belaur.User, error)
- func (s *BoltStore) UserDelete(u string) error
- func (s *BoltStore) UserGet(username string) (*belaur.User, error)
- func (s *BoltStore) UserGetAll() ([]belaur.User, error)
- func (s *BoltStore) UserPermissionsDelete(username string) error
- func (s *BoltStore) UserPermissionsGet(username string) (*belaur.UserPermission, error)
- func (s *BoltStore) UserPermissionsPut(perms *belaur.UserPermission) error
- func (s *BoltStore) UserPut(u *belaur.User, encryptPassword bool) error
- func (s *BoltStore) WorkerDelete(id string) error
- func (s *BoltStore) WorkerDeleteAll() error
- func (s *BoltStore) WorkerGet(id string) (*belaur.Worker, error)
- func (s *BoltStore) WorkerGetAll() ([]*belaur.Worker, error)
- func (s *BoltStore) WorkerPut(w *belaur.Worker) error
- type SettingsStore
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 (*BoltStore) BhojpurStore ¶
func (s *BoltStore) BhojpurStore() persist.BatchAdapter
BhojpurStore is as a getter for the Bhojpur Policy store adapter.
func (*BoltStore) CreatePermissionsIfNotExisting ¶
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 ¶
GetSHAPair returns a pair of shas for this pipeline run.
func (*BoltStore) Init ¶
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 ¶
PipelineDelete deletes the pipeline with the given id.
func (*BoltStore) PipelineGet ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
UserDelete deletes the given user.
func (*BoltStore) UserGet ¶
UserGet looks up a user by given username. Returns nil if user was not found.
func (*BoltStore) UserGetAll ¶
UserGetAll returns all stored users.
func (*BoltStore) UserPermissionsDelete ¶
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 ¶
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 ¶
WorkerDelete deletes a worker by the given identifier.
func (*BoltStore) WorkerDeleteAll ¶
WorkerDeleteAll deletes all worker objects in the bucket.
func (*BoltStore) WorkerGetAll ¶
WorkerGetAll returns all existing worker objects from the store. It returns an error when the action failed.
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.