store

package
v0.0.0-...-3d4bac1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the interface to the redis store

func NewClient

func NewClient(l *zap.SugaredLogger, name string, opts config.Store) (*Client, error)

NewClient sets up a new client for the redis store

func (*Client) Close

func (c *Client) Close() error

Close disconnects the client from Redis

func (*Client) RepoJobs

func (c *Client) RepoJobs() *RepoJobsClient

RepoJobs returns a client for managing repo job entries

func (*Client) Reset

func (c *Client) Reset()

Reset drops all keys

type RepoJob

type RepoJob struct {
	ID uuid.UUID

	Owner          string
	Repo           string
	InstallationID string
}

RepoJob denotes a repository processing job

type RepoJobState

type RepoJobState struct {
	Analysis   *StateMeta
	GitHubSync *StateMeta
}

RepoJobState denotes the state of a job

type RepoJobsClient

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

RepoJobsClient exposes an API for interacting with repo job entries

func (*RepoJobsClient) Dequeue

func (r *RepoJobsClient) Dequeue(timeout time.Duration) (<-chan *RepoJob, <-chan error)

Dequeue grabs the next repo job

func (*RepoJobsClient) GetState

func (r *RepoJobsClient) GetState(jobID uuid.UUID) (*RepoJobState, error)

GetState retrieves the state of the given job ID

func (*RepoJobsClient) Queue

func (r *RepoJobsClient) Queue(job *RepoJob) error

Queue queues a repo for update

func (*RepoJobsClient) SetState

func (r *RepoJobsClient) SetState(jobID uuid.UUID, state *RepoJobState) error

SetState updates the state of the given job ID with the given state

type State

type State int

State denotes the state of a job

const (
	// StateNoProgress indicates nothing has happened yet
	StateNoProgress State = iota + 1

	// StateInProgress indicates that the job is in progress
	StateInProgress

	// StateDone indicates the job was completed
	StateDone

	// StateError indicates something went wrong
	StateError
)

type StateMeta

type StateMeta struct {
	State   State
	Message string
	Meta    map[string]interface{}
}

StateMeta wraps State for additional metadata

func ParseState

func ParseState(v interface{}) *StateMeta

ParseState casts given interface to a State

Jump to

Keyboard shortcuts

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