storage

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DirMode fs.FileMode = 0755

DirMode is the default dirmode for volumes

Variables

This section is empty.

Functions

This section is empty.

Types

type FSStore

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

FSStore contains all storage data and primitives directly on the FS

func NewFSStore

func NewFSStore(root string) (*FSStore, error)

NewFSStore inits a new filesystem store

func (*FSStore) All

func (s *FSStore) All() ([]*task.Task, error)

All returns all the tasks for this storage

func (*FSStore) Delete

func (s *FSStore) Delete(id string) error

Delete takes an id and delete a task in the fs

func (*FSStore) EnsureVolumesDir

func (s *FSStore) EnsureVolumesDir(t *task.Task) error

EnsureVolumesDir is used to create required volume dirs

func (*FSStore) Filter

func (s *FSStore) Filter(filterFn func(*task.Task) bool) ([]*task.Task, error)

Filter return all the tasks matching the required predicates from the filter function

func (*FSStore) Get

func (s *FSStore) Get(id string) (*task.Task, error)

Get takes an id and return a task

func (*FSStore) GetByCommit

func (s *FSStore) GetByCommit(service, project, branch, commit string, latest bool) (*task.Task, error)

GetByCommit gets the task using the full path from service to commit

func (*FSStore) GetLatest

func (s *FSStore) GetLatest(service, project, branch string) (*task.Task, error)

GetLatest is used to get latest task for a service, project, branch

func (*FSStore) GetVolumePath

func (s *FSStore) GetVolumePath(t *task.Task) string

GetVolumePath is used to get the root volume path of a task

func (*FSStore) SetLatest

func (s *FSStore) SetLatest(t *task.Task) error

SetLatest is used save task as latest for this branch

func (*FSStore) Upsert

func (s *FSStore) Upsert(t *task.Task) error

Upsert takes a task and write it to the underlying fs

type Storage

type Storage interface {
	Upsert(*task.Task) error
	Get(id string) (*task.Task, error)
	GetByCommit(service, project, branch, commit string, latest bool) (*task.Task, error)
	All() ([]*task.Task, error)
	Filter(func(*task.Task) bool) ([]*task.Task, error)
	Delete(id string) error
	SetLatest(*task.Task) error
	GetLatest(service, project, branch string) (*task.Task, error)
	GetVolumePath(*task.Task) string
	EnsureVolumesDir(*task.Task) error
}

Storage describe all storage primitives

Jump to

Keyboard shortcuts

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