Documentation ¶
Index ¶
- Variables
- func ParseFile(file string) (*models.Status, error)
- type Config
- type Database
- func (db *Database) Compact(configPath, original string) error
- func (db *Database) FindByRequestId(configPath string, requestId string) (*models.StatusFile, error)
- func (db *Database) MoveData(oldPath, newPath string) error
- func (db *Database) NewWriter(configPath string, t time.Time, requestId string) (*Writer, string, error)
- func (db *Database) ReadStatusHist(configPath string, n int) []*models.StatusFile
- func (db *Database) ReadStatusToday(configPath string) (*models.Status, error)
- func (db *Database) RemoveAll(configPath string) error
- func (db *Database) RemoveOld(configPath string, retentionDays int) error
- type Writer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Config ¶
type Config struct {
Dir string
}
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig is the default configuration for Database.
type Database ¶
type Database struct {
*Config
}
Database is the interfact to store workflow status in local. It stores status in JSON format in a directory as per each configPath. Multiple JSON data can be stored in a single file and each data is separated by newline. When a data is updated, it appends a new line to the file. Only the latest data in a single file can be read. When Compact is called, it removes old data. Compact must be called only once per file.
func (*Database) Compact ¶
Compact creates a new file with only the latest data and removes old data.
func (*Database) FindByRequestId ¶
func (db *Database) FindByRequestId(configPath string, requestId string) (*models.StatusFile, error)
FindByRequestId finds a status file by requestId.
func (*Database) NewWriter ¶
func (db *Database) NewWriter(configPath string, t time.Time, requestId string) (*Writer, string, error)
NewWriter creates a new writer for a status.
func (*Database) ReadStatusHist ¶
func (db *Database) ReadStatusHist(configPath string, n int) []*models.StatusFile
ReadStatusHist returns a list of status files.
func (*Database) ReadStatusToday ¶
ReadStatusToday returns a list of status files.