Documentation ¶
Overview ¶
Package state provides the persistent storage layer for the PCI query results.
Index ¶
- Constants
- Variables
- func CreateTable(ctx context.Context, db *sql.DB) error
- func FindEvent(ctx context.Context, db *sql.DB, event Event) (bool, error)
- func InsertEvent(ctx context.Context, db *sql.DB, event Event) error
- func Purge(ctx context.Context, db *sql.DB, opts ...OpOption) (int, error)
- type Event
- type Op
- type OpOption
Constants ¶
View Source
const ( // unix timestamp in seconds when the event was observed ColumnUnixSeconds = "unix_seconds" // "lspci -vv" ColumnDataSource = "data_source" // "acs_enabled" ColumnEventType = "event_type" // reasons for the events ColumnReasons = "reasons" )
View Source
const DefaultRetentionPeriod = 128 * time.Hour
View Source
const TableNamePCIEvents = "components_pci_events"
Variables ¶
View Source
var ErrInvalidLimit = errors.New("limit must be greater than or equal to 0")
Functions ¶
Types ¶
type OpOption ¶
type OpOption func(*Op)
func WithBefore ¶
WithBefore sets the before timestamp for the delete queries. If not specified, it deletes all events.
func WithSince ¶
WithSince sets the since timestamp for the select queries. If not specified, it returns all events.
func WithSortUnixSecondsAscendingOrder ¶
func WithSortUnixSecondsAscendingOrder() OpOption
WithSortUnixSecondsAscendingOrder sorts the events by unix_seconds in ascending order, meaning its read query returns the oldest events first.
func WithSortUnixSecondsDescendingOrder ¶
func WithSortUnixSecondsDescendingOrder() OpOption
WithSortUnixSecondsDescendingOrder sorts the events by unix_seconds in descending order, meaning its read query returns the newest events first.
Click to show internal directories.
Click to hide internal directories.