store

package
Version: v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountNodes

func CountNodes(c context.Context) (int, error)

func CountRepos

func CountRepos(c context.Context) (int, error)

func CountUsers

func CountUsers(c context.Context) (int, error)

func CreateBuild

func CreateBuild(c context.Context, build *model.Build, jobs ...*model.Job) error

func CreateJob

func CreateJob(c context.Context, job *model.Job) error

func CreateKey

func CreateKey(c context.Context, key *model.Key) error

func CreateNode

func CreateNode(c context.Context, node *model.Node) error

func CreateRepo

func CreateRepo(c context.Context, repo *model.Repo) error

func CreateUser

func CreateUser(c context.Context, user *model.User) error

func DeleteKey

func DeleteKey(c context.Context, key *model.Key) error

func DeleteNode

func DeleteNode(c context.Context, node *model.Node) error

func DeleteRepo

func DeleteRepo(c context.Context, repo *model.Repo) error

func DeleteUser

func DeleteUser(c context.Context, user *model.User) error

func GetBuild

func GetBuild(c context.Context, id int64) (*model.Build, error)

func GetBuildCommit

func GetBuildCommit(c context.Context, repo *model.Repo, sha, branch string) (*model.Build, error)

func GetBuildLast

func GetBuildLast(c context.Context, repo *model.Repo, branch string) (*model.Build, error)

func GetBuildLastBefore

func GetBuildLastBefore(c context.Context, repo *model.Repo, branch string, number int64) (*model.Build, error)

func GetBuildList

func GetBuildList(c context.Context, repo *model.Repo) ([]*model.Build, error)

func GetBuildNumber

func GetBuildNumber(c context.Context, repo *model.Repo, num int) (*model.Build, error)

func GetBuildRef

func GetBuildRef(c context.Context, repo *model.Repo, ref string) (*model.Build, error)

func GetJob

func GetJob(c context.Context, id int64) (*model.Job, error)

func GetJobList

func GetJobList(c context.Context, build *model.Build) ([]*model.Job, error)

func GetJobNumber

func GetJobNumber(c context.Context, build *model.Build, num int) (*model.Job, error)

func GetKey

func GetKey(c context.Context, repo *model.Repo) (*model.Key, error)

func GetNode

func GetNode(c context.Context, id int64) (*model.Node, error)

func GetNodeList

func GetNodeList(c context.Context) ([]*model.Node, error)

func GetRepo

func GetRepo(c context.Context, id int64) (*model.Repo, error)

func GetRepoListOf

func GetRepoListOf(c context.Context, listof []*model.RepoLite) ([]*model.Repo, error)

func GetRepoName

func GetRepoName(c context.Context, name string) (*model.Repo, error)

func GetRepoOwnerName

func GetRepoOwnerName(c context.Context, owner, name string) (*model.Repo, error)

func GetUser

func GetUser(c context.Context, id int64) (*model.User, error)

func GetUserFeed

func GetUserFeed(c context.Context, listof []*model.RepoLite) ([]*model.Feed, error)

func GetUserList

func GetUserList(c context.Context) ([]*model.User, error)

func GetUserLogin

func GetUserLogin(c context.Context, login string) (*model.User, error)

func ReadLog

func ReadLog(c context.Context, job *model.Job) (io.ReadCloser, error)

func ToContext

func ToContext(c Setter, store Store)

ToContext adds the Store to this context if it supports the Setter interface.

func UpdateBuild

func UpdateBuild(c context.Context, build *model.Build) error

func UpdateJob

func UpdateJob(c context.Context, job *model.Job) error

func UpdateKey

func UpdateKey(c context.Context, key *model.Key) error

func UpdateNode

func UpdateNode(c context.Context, node *model.Node) error

func UpdateRepo

func UpdateRepo(c context.Context, repo *model.Repo) error

func UpdateUser

func UpdateUser(c context.Context, user *model.User) error

func WriteLog

func WriteLog(c context.Context, job *model.Job, r io.Reader) error

Types

type BuildStore

type BuildStore interface {
	// Get gets a build by unique ID.
	Get(int64) (*model.Build, error)

	// GetNumber gets a build by number.
	GetNumber(*model.Repo, int) (*model.Build, error)

	// GetRef gets a build by its ref.
	GetRef(*model.Repo, string) (*model.Build, error)

	// GetCommit gets a build by its commit sha.
	GetCommit(*model.Repo, string, string) (*model.Build, error)

	// GetLast gets the last build for the branch.
	GetLast(*model.Repo, string) (*model.Build, error)

	// GetLastBefore gets the last build before build number N.
	GetLastBefore(*model.Repo, string, int64) (*model.Build, error)

	// GetList gets a list of builds for the repository
	GetList(*model.Repo) ([]*model.Build, error)

	// Create creates a new build and jobs.
	Create(*model.Build, ...*model.Job) error

	// Update updates a build.
	Update(*model.Build) error
}

type JobStore

type JobStore interface {
	// Get gets a job by unique ID.
	Get(int64) (*model.Job, error)

	// GetNumber gets a job by number.
	GetNumber(*model.Build, int) (*model.Job, error)

	// GetList gets a list of all users in the system.
	GetList(*model.Build) ([]*model.Job, error)

	// Create creates a job.
	Create(*model.Job) error

	// Update updates a job.
	Update(*model.Job) error
}

type KeyStore

type KeyStore interface {
	// Get gets a key by unique repository ID.
	Get(*model.Repo) (*model.Key, error)

	// Create creates a new key.
	Create(*model.Key) error

	// Update updates a user key.
	Update(*model.Key) error

	// Delete deletes a user key.
	Delete(*model.Key) error
}

type LogStore

type LogStore interface {
	// Read reads the Job logs from the datastore.
	Read(*model.Job) (io.ReadCloser, error)

	// Write writes the job logs to the datastore.
	Write(*model.Job, io.Reader) error
}

type NodeStore

type NodeStore interface {
	// Get gets a user by unique ID.
	Get(int64) (*model.Node, error)

	// GetList gets a list of all nodes in the system.
	GetList() ([]*model.Node, error)

	// Count gets a count of all nodes in the system.
	Count() (int, error)

	// Create creates a node.
	Create(*model.Node) error

	// Update updates a node.
	Update(*model.Node) error

	// Delete deletes a node.
	Delete(*model.Node) error
}

type RepoStore

type RepoStore interface {
	// Get gets a repo by unique ID.
	Get(int64) (*model.Repo, error)

	// GetLogin gets a repo by its full name.
	GetName(string) (*model.Repo, error)

	// GetListOf gets the list of enumerated repos in the system.
	GetListOf([]*model.RepoLite) ([]*model.Repo, error)

	// Count gets a count of all repos in the system.
	Count() (int, error)

	// Create creates a new repository.
	Create(*model.Repo) error

	// Update updates a user repository.
	Update(*model.Repo) error

	// Delete deletes a user repository.
	Delete(*model.Repo) error
}

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

type Store

type Store interface {
	Nodes() NodeStore
	Users() UserStore
	Repos() RepoStore
	Keys() KeyStore
	Builds() BuildStore
	Jobs() JobStore
	Logs() LogStore
}

func FromContext

func FromContext(c context.Context) Store

FromContext returns the Store associated with this context.

func New

func New(
	nodes NodeStore,
	users UserStore,
	repos RepoStore,
	keys KeyStore,
	builds BuildStore,
	jobs JobStore,
	logs LogStore,
) Store

type UserStore

type UserStore interface {
	// Get gets a user by unique ID.
	Get(int64) (*model.User, error)

	// GetLogin gets a user by unique Login name.
	GetLogin(string) (*model.User, error)

	// GetList gets a list of all users in the system.
	GetList() ([]*model.User, error)

	// GetFeed gets a user activity feed.
	GetFeed([]*model.RepoLite) ([]*model.Feed, error)

	// Count gets a count of all users in the system.
	Count() (int, error)

	// Create creates a new user account.
	Create(*model.User) error

	// Update updates a user account.
	Update(*model.User) error

	// Delete deletes a user account.
	Delete(*model.User) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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