Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // S3 backend options S3 struct { Bucket string `long:"bucket" env:"S3_BUCKET" description:"name of the bucket"` Key string `long:"key" default:"state.json" env:"S3_KEY" description:"path to the key"` } `group:"store.s3" namespace:"s3"` // Postgres backend options Postgres struct { Datasource string `long:"datasource" env:"PG_DATASOURCE" description:"postgresql datasource (see database/sql)"` } `group:"store.postgres" namespace:"pg"` // File backend options. This is the default if nothing else is provided File struct { Path string `long:"path" default:".sauron" env:"STORE_FILE_PATH" description:"path of the state file"` } `group:"store.file" namespace:"file"` }
Options contains the parameters necessary to configure a concrete Store implementation
type Store ¶
type Store interface { GetLastUpdate(key WatchKey) (model.Update, error) RecordUpdate(key WatchKey, update model.Update) error SetLastChecked(key WatchKey) error }
Store is the storage layer interface for Sauron
func New ¶
New returns a new concrete Store implementation depending on which options are set. If none, a basic file-backed implementation is returned
func NewPostgres ¶
NewPostgres instantiates a new concrete Store. NewPostgres panics if the dataSource is invalid or if the schema cannot be initialized.
type WatchKey ¶
type WatchKey struct { Repository model.Repository Branch string Path string }
WatchKey is used to retrieve a RepoState from the global state
func Key ¶
func Key(opts model.WatchOptions) WatchKey
Key creates a new WatchKey from a WatchOptions value
func (WatchKey) MarshalText ¶
MarshalText implements the encoding.TextMarshaller interface
func (*WatchKey) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaller interface