storage

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: GPL-3.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepoStore

type RepoStore interface {
	// Create inserts a new Repository in the store.
	Create(repo *model.Repository) error
	// Get returns a Repository given its ID.
	Get(id kallax.ULID) (*model.Repository, error)
	// GetByEndpoints returns the Repositories that have common endpoints with the
	// list of endpoints passed.
	GetByEndpoints(endpoints ...string) ([]*model.Repository, error)
	// SetStatus changes the status of the given repository.
	SetStatus(repo *model.Repository, status model.FetchStatus) error
	// SetEndpoints updates the endpoints of the repository.
	SetEndpoints(repo *model.Repository, endpoints ...string) error
	// UpdateFailed updates the given repository as failed with the given
	// status. No modifications are performed to the repository itself
	// other than setting its status, all the modification to the repo
	// fields must be done before calling this method. That is, changing
	// FetchErrorAt and so on should be done manually before. Refer to the
	// concrete implementation to know what is being updated.
	UpdateFailed(repo *model.Repository, status model.FetchStatus) error
	// Update updates the given repository as successfully fetched.
	// No modifications are performed to the repository other than setting
	// the Fetched status and the time when it was fetched, all other changes
	// should be done to the repo before calling this method. Refer to the
	// concrete implementation to know what is being updated.
	UpdateFetched(repo *model.Repository, fetchedAt time.Time) error
}

RepoStore is the access layer to the storage of repositories.

func FromDatabase

func FromDatabase(db *sql.DB) RepoStore

FromDatabase returns a new repository store that interacts with a PostgreSQL FromDatabase to store all the data.

func Local

func Local() RepoStore

Local creates a new local repository store that needs no database connection.

Jump to

Keyboard shortcuts

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