Documentation ¶
Overview ¶
Package db handles our database layer.
Index ¶
- type BoltDB
- func (b *BoltDB) DeleteProjectStatus(pull models.PullRequest, workspace string, repoRelDir string) 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) 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) UpdatePullWithResults(pull models.PullRequest, newResults []models.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) DeleteProjectStatus ¶
func (b *BoltDB) DeleteProjectStatus(pull models.PullRequest, workspace string, repoRelDir string) error
DeleteProjectStatus deletes all project statuses under pull that match workspace and repoRelDir.
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) 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) UpdatePullWithResults ¶
func (b *BoltDB) UpdatePullWithResults(pull models.PullRequest, newResults []models.ProjectResult) (models.PullStatus, error)
UpdatePullWithResults updates pull's status with the latest project results. It returns the new PullStatus object.