Documentation ¶
Overview ¶
Package redis handles our remote database layer.
Index ¶
- type RedisDB
- func (r *RedisDB) CheckCommandLock(cmdName command.Name) (*command.Lock, error)
- func (r *RedisDB) DeletePullStatus(pull models.PullRequest) error
- func (r *RedisDB) GetLock(project models.Project, workspace string) (*models.ProjectLock, error)
- func (r *RedisDB) GetPullStatus(pull models.PullRequest) (*models.PullStatus, error)
- func (r *RedisDB) List() ([]models.ProjectLock, error)
- func (r *RedisDB) LockCommand(cmdName command.Name, lockTime time.Time) (*command.Lock, error)
- func (r *RedisDB) TryLock(newLock models.ProjectLock) (bool, models.ProjectLock, error)
- func (r *RedisDB) Unlock(project models.Project, workspace string) (*models.ProjectLock, error)
- func (r *RedisDB) UnlockByPull(repoFullName string, pullNum int) ([]models.ProjectLock, error)
- func (r *RedisDB) UnlockCommand(cmdName command.Name) error
- func (r *RedisDB) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, ...) error
- func (r *RedisDB) 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 RedisDB ¶
type RedisDB struct {
// contains filtered or unexported fields
}
Redis is a database using Redis 6
func NewWithClient ¶
NewWithClient is used for testing.
func (*RedisDB) CheckCommandLock ¶
func (*RedisDB) DeletePullStatus ¶
func (r *RedisDB) DeletePullStatus(pull models.PullRequest) error
func (*RedisDB) GetLock ¶
GetLock returns a pointer to the lock for that project and workspace. If there is no lock, it returns a nil pointer.
func (*RedisDB) GetPullStatus ¶
func (r *RedisDB) GetPullStatus(pull models.PullRequest) (*models.PullStatus, error)
func (*RedisDB) List ¶
func (r *RedisDB) List() ([]models.ProjectLock, error)
List lists all current locks.
func (*RedisDB) LockCommand ¶
func (*RedisDB) TryLock ¶
func (r *RedisDB) 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 (*RedisDB) 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 (*RedisDB) UnlockByPull ¶
UnlockByPull deletes all locks associated with that pull request and returns them.
func (*RedisDB) UpdateProjectStatus ¶
func (r *RedisDB) UpdateProjectStatus(pull models.PullRequest, workspace string, repoRelDir string, newStatus models.ProjectPlanStatus) error
UpdateProjectStatus updates pull's status with the latest project results. It returns the new PullStatus object.
func (*RedisDB) UpdatePullWithResults ¶
func (r *RedisDB) UpdatePullWithResults(pull models.PullRequest, newResults []command.ProjectResult) (models.PullStatus, error)