Documentation ¶
Overview ¶
Package datastore manages the bolt data files and the reading and writing data to them
Index ¶
- Variables
- type Log
- type Release
- type Store
- func (ds *Store) AddLog(version, stage, entry string) error
- func (ds *Store) AddRelease(version, fileName string, fileData []byte) error
- func (ds *Store) Close() error
- func (ds *Store) LastRelease() (*Release, error)
- func (ds *Store) LastVersion(stage string) (*Log, error)
- func (ds *Store) Release(version string) (*Release, error)
- func (ds *Store) ReleaseFile(fileKey TimeKey) ([]byte, error)
- func (ds *Store) Releases() ([]*Release, error)
- func (ds *Store) StageLog(version, stage string) (*Log, error)
- func (ds *Store) TrimVersions(maxVersions int) error
- func (ds *Store) VersionLog(version string) ([]*Log, error)
- func (ds *Store) Versions() ([]*Log, error)
- type TimeKey
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("Value not found in datastore")
ErrNotFound is the error returned when a value cannot be found in the store for the given key
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct { When time.Time `json:"when,omitempty"` Version string `json:"version,omitempty"` Stage string `json:"stage,omitempty"` Log string `json:"log,omitempty"` }
Log is a version log entry for a project
type Release ¶
type Release struct { When time.Time `json:"when"` Version string `json:"version"` FileName string `json:"fileName"` FileKey TimeKey `json:"fileKey"` }
Release is a record of the fully built and ready to deploy release file
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a datastore for getting and setting data for a given ironsmith project run on top of a Bolt DB file
func Open ¶
Open opens an existing datastore file, or creates a new one caller is responsible for closing the datastore
func (*Store) AddRelease ¶
AddRelease adds a new Release
func (*Store) LastRelease ¶
LastRelease lists the last release for a project
func (*Store) LastVersion ¶
LastVersion returns the last version in the log for the given stage. If stage is blank, then it returns the last of any stage
func (*Store) ReleaseFile ¶
ReleaseFile returns a specific file from a release for the given file key
func (*Store) TrimVersions ¶
TrimVersions Removes versions from the datastore file until it reaches the maxVersions count
func (*Store) VersionLog ¶
VersionLog returns all the log entries for a given version
type TimeKey ¶
type TimeKey [16]byte
TimeKey is a unique time ordered key for use in the datastore A TimeKey is 32 bits random data + 96 bit UNIX timestamp (64bits seconds + 32 bit nanoseconds)
func NewTimeKey ¶
func NewTimeKey() TimeKey
NewTimeKey returns a newly generated TimeKey based on the current time
func (*TimeKey) MarshalJSON ¶
MarshalJSON implements JSON marshaler
func (TimeKey) UUID ¶
UUID returns the string representation of a TimeKey in Hex format separated by dashes similar to a UUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
func (*TimeKey) UnmarshalJSON ¶
UnmarshalJSON implements JSON unmarshaler