Documentation ¶
Overview ¶
Package db handles our database layer.
Index ¶
- type BoltDB
- func (b *BoltDB) CheckCommandLock(cmdName command.Name) (*command.Lock, error)
- func (b *BoltDB) DeletePullStatus(pull models.PullRequest) error
- func (b *BoltDB) GetLock(p models.Project, workspace string) (*models.ProjectLock, error)
- func (b *BoltDB) GetPullStatus(pull models.PullRequest) (*models.PullStatus, error)
- func (b *BoltDB) List() ([]models.ProjectLock, error)
- func (b *BoltDB) LockCommand(cmdName command.Name, lockTime time.Time) (*command.Lock, error)
- func (b *BoltDB) TryLock(newLock models.ProjectLock) (bool, models.ProjectLock, error)
- func (b *BoltDB) Unlock(p models.Project, workspace string) (*models.ProjectLock, error)
- func (b *BoltDB) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error)
- func (b *BoltDB) UnlockCommand(cmdName command.Name) error
- func (b *BoltDB) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, ...) error
- func (b *BoltDB) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) (models.PullStatus, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltDB ¶
type BoltDB struct {
// contains filtered or unexported fields
}
BoltDB is a database using BoltDB
func New ¶
New returns a valid locker. We need to be able to write to dataDir since bolt stores its data as a file
func (*BoltDB) CheckCommandLock ¶
CheckCommandLock checks if CommandName lock was set. If the lock exists return the pointer to the lock object, otherwise return nil
func (*BoltDB) DeletePullStatus ¶
func (b *BoltDB) DeletePullStatus(pull models.PullRequest) error
DeletePullStatus deletes the status for pull.
func (*BoltDB) GetLock ¶
GetLock returns a pointer to the lock for that project and workspace. If there is no lock, it returns a nil pointer.
func (*BoltDB) GetPullStatus ¶
func (b *BoltDB) GetPullStatus(pull models.PullRequest) (*models.PullStatus, error)
GetPullStatus returns the status for pull. If there is no status, returns a nil pointer.
func (*BoltDB) List ¶
func (b *BoltDB) List() ([]models.ProjectLock, error)
List lists all current locks.
func (*BoltDB) LockCommand ¶
LockCommand attempts to create a new lock for a CommandName. If the lock doesn't exists, it will create a lock and return a pointer to it. If the lock already exists, it will return an "lock already exists" error
func (*BoltDB) TryLock ¶
func (b *BoltDB) TryLock(newLock models.ProjectLock) (bool, models.ProjectLock, error)
TryLock attempts to create a new lock. If the lock is acquired, it will return true and the lock returned will be newLock. If the lock is not acquired, it will return false and the current lock that is preventing this lock from being acquired.
func (*BoltDB) Unlock ¶
Unlock attempts to unlock the project and workspace. If there is no lock, then it will return a nil pointer. If there is a lock, then it will delete it, and then return a pointer to the deleted lock.
func (*BoltDB) UnlockByPull ¶
UnlockByPull deletes all locks associated with that pull request and returns them.
func (*BoltDB) UnlockCommand ¶
UnlockCommand removes CommandName lock if present. If there are no lock it returns an error.
func (*BoltDB) UpdateProjectStatus ¶
func (b *BoltDB) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) error
UpdateProjectStatus updates project status.
func (*BoltDB) UpdatePullWithResults ¶
func (b *BoltDB) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) (models.PullStatus, error)
UpdatePullWithResults updates pull's status with the latest project results. It returns the new PullStatus object.