Documentation
¶
Overview ¶
Package bbolt provides machine history tracking and traversal using the bbolt K/V database.
Index ¶
- Constants
- func DecTimeRecord(machId string, id uint64, v []byte, tryJson bool) (*amhist.TimeRecord, error)
- func DecTransitionRecord(machId string, id uint64, v []byte, tryJson bool) (*amhist.TransitionRecord, error)
- func Decode(v []byte, out any, tryJson bool) error
- func GetMachine(db *bbolt.DB, id string) (*amhist.MachineRecord, error)
- func ListMachines(db *bbolt.DB) ([]*amhist.MachineRecord, error)
- func NewDb(name string) (*bbolt.DB, error)
- type Config
- type MatcherFn
- type Memory
- func (m *Memory) Config() amhist.BaseConfig
- func (m *Memory) Dispose() error
- func (m *Memory) FindLatest(ctx context.Context, retTx bool, limit int, query amhist.Query) ([]*amhist.MemoryRecord, error)
- func (m *Memory) Machine() am.Api
- func (m *Memory) MachineRecord() *amhist.MachineRecord
- func (m *Memory) Match(ctx context.Context, matcherFn MatcherFn) ([]*amhist.MemoryRecord, error)
- func (m *Memory) Sync() error
Constants ¶
View Source
const ( BuckMachines = "_machines" BuckTransitions = "transitions" BuckTimes = "times" )
Variables ¶
This section is empty.
Functions ¶
func DecTimeRecord ¶
func DecTransitionRecord ¶
func GetMachine ¶
GetMachine returns a machine record for a given machine id.
func ListMachines ¶
func ListMachines(db *bbolt.DB) ([]*amhist.MachineRecord, error)
ListMachines returns a list of all machines in a database.
Types ¶
type Config ¶
type Config struct {
amhist.BaseConfig
EncJson bool
// amount of records to save in bulk (default: 100)
QueueBatch int32
}
type Memory ¶
type Memory struct {
*amhist.BaseMemory
Db *bbolt.DB
// read-only config for this history
Cfg *Config
SavePending atomic.Int32
SaveInProgress atomic.Bool
Saved atomic.Uint64
// Value of Saved at the end of the last GC
SavedGc atomic.Uint64
// contains filtered or unexported fields
}
func (*Memory) Config ¶
func (m *Memory) Config() amhist.BaseConfig
Config is amhist.BaseMemory.Config.
func (*Memory) Dispose ¶
Dispose is amhist.BaseMemory.Dispose. TODO merge with ctx
func (*Memory) FindLatest ¶
func (m *Memory) FindLatest( ctx context.Context, retTx bool, limit int, query amhist.Query, ) ([]*amhist.MemoryRecord, error)
FindLatest is amhist.BaseMemory.FindLatest.
func (*Memory) MachineRecord ¶
func (m *Memory) MachineRecord() *amhist.MachineRecord
MachineRecord is amhist.BaseMemory.MachineRecord.
Click to show internal directories.
Click to hide internal directories.