jsondb

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFile

func ParseFile(file string) (*model.Status, error)

Types

type Store

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

Store is the interfact to store dags status in local. It stores status in JSON format in a directory as per each dagFile. 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 New

func New(dir, dagsDir string) *Store

New creates a new Store with default configuration.

func (*Store) Close

func (store *Store) Close() error

func (*Store) Compact

func (store *Store) Compact(_, original string) error

Compact creates a new file with only the latest data and removes old data.

func (*Store) FindByRequestId

func (store *Store) FindByRequestId(dagFile string, requestId string) (*model.StatusFile, error)

FindByRequestId finds a status file by requestId.

func (*Store) Open

func (store *Store) Open(dagFile string, t time.Time, requestId string) error

func (*Store) ReadStatusRecent

func (store *Store) ReadStatusRecent(dagFile string, n int) []*model.StatusFile

ReadStatusHist returns a list of status files.

func (*Store) ReadStatusToday

func (store *Store) ReadStatusToday(dagFile string) (*model.Status, error)

ReadStatusToday returns a list of status files.

func (*Store) RemoveAll

func (store *Store) RemoveAll(dagFile string) error

RemoveAll removes all files in a directory.

func (*Store) RemoveOld

func (store *Store) RemoveOld(dagFile string, retentionDays int) error

RemoveOld removes old files.

func (*Store) Rename

func (store *Store) Rename(oldName, newName string) error

func (*Store) Update

func (store *Store) Update(dagFile, requestId string, s *model.Status) error

func (*Store) Write

func (store *Store) Write(s *model.Status) error

Jump to

Keyboard shortcuts

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