datalayer

package
v0.0.0-...-e6eacfd Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBLayer

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

DBLayer is an DataLayer instance that interacts with the Cassandra database

func NewDBLayer

func NewDBLayer(s *gocql.Session) *DBLayer

NewDBLayer returns a data layer object

func (*DBLayer) CreateBuild

func (dl *DBLayer) CreateBuild(req *lib.BuildRequest) (gocql.UUID, error)

CreateBuild inserts a new build into the DB returning the ID

func (*DBLayer) DeleteBuild

func (dl *DBLayer) DeleteBuild(id gocql.UUID) error

DeleteBuild removes a build from the DB. Only used in case of queue full when we can't actually do a build

func (*DBLayer) GetBuildByID

func (dl *DBLayer) GetBuildByID(id gocql.UUID) (*lib.BuildStatusResponse, error)

GetBuildByID fetches a build object from the DB

func (*DBLayer) GetBuildOutput

func (dl *DBLayer) GetBuildOutput(id gocql.UUID, column string) ([]lib.BuildEvent, error)

GetBuildOutput returns an array of stream events from the database

func (*DBLayer) SaveBuildOutput

func (dl *DBLayer) SaveBuildOutput(id gocql.UUID, output []lib.BuildEvent, column string) error

SaveBuildOutput serializes an array of stream events to the database

func (*DBLayer) SetBuildCompletedTimestamp

func (dl *DBLayer) SetBuildCompletedTimestamp(id gocql.UUID) error

SetBuildCompletedTimestamp sets the completed timestamp on a build to time.Now()

func (*DBLayer) SetBuildFlags

func (dl *DBLayer) SetBuildFlags(id gocql.UUID, flags map[string]bool) error

SetBuildFlags sets the boolean flags on the build object Caller must ensure that the flags passed in are valid

func (*DBLayer) SetBuildState

func (dl *DBLayer) SetBuildState(id gocql.UUID, state lib.BuildStatusResponse_BuildState) error

SetBuildState sets the state of a build

func (*DBLayer) SetBuildTimeMetric

func (dl *DBLayer) SetBuildTimeMetric(id gocql.UUID, metric string) error

SetBuildTimeMetric sets a build metric to time.Now() metric is the name of the column to update if metric is a *_completed column, it will also compute and persist the duration

func (*DBLayer) SetDockerImageSizesMetric

func (dl *DBLayer) SetDockerImageSizesMetric(id gocql.UUID, size int64, vsize int64) error

SetDockerImageSizesMetric sets the docker image sizes for a build

type DataLayer

type DataLayer interface {
	CreateBuild(*lib.BuildRequest) (gocql.UUID, error)
	GetBuildByID(gocql.UUID) (*lib.BuildStatusResponse, error)
	SetBuildFlags(gocql.UUID, map[string]bool) error
	SetBuildCompletedTimestamp(gocql.UUID) error
	SetBuildState(gocql.UUID, lib.BuildStatusResponse_BuildState) error
	DeleteBuild(gocql.UUID) error
	SetBuildTimeMetric(gocql.UUID, string) error
	SetDockerImageSizesMetric(gocql.UUID, int64, int64) error
	SaveBuildOutput(gocql.UUID, []lib.BuildEvent, string) error
	GetBuildOutput(gocql.UUID, string) ([]lib.BuildEvent, error)
}

DataLayer describes an object that interacts with the persistant data store

Jump to

Keyboard shortcuts

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