xidsxidstate

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package xidsxidstate provides the persistent storage layer for the nvidia query results.

Index

Constants

View Source
const (
	// unix timestamp in seconds when the event was observed
	ColumnUnixSeconds = "unix_seconds"

	// either "nvml" or "dmesg"
	ColumnDataSource = "data_source"

	// either "xid" or "sxid"
	ColumnEventType = "event_type"

	// event id; xid or sxid
	ColumnEventID = "event_id"

	// event details; dmesg log line
	ColumnEventDetails = "event_details"
)
View Source
const TableNameXidSXidEventHistory = "components_accelerator_nvidia_query_xid_sxid_event_history"

Variables

View Source
var ErrInvalidLimit = errors.New("limit must be greater than or equal to 0")

Functions

func CreateTableXidSXidEventHistory

func CreateTableXidSXidEventHistory(ctx context.Context, db *sql.DB) error

func FindEvent

func FindEvent(ctx context.Context, db *sql.DB, event Event) (bool, error)

func InsertEvent

func InsertEvent(ctx context.Context, db *sql.DB, event Event) error

func Purge

func Purge(ctx context.Context, db *sql.DB, opts ...OpOption) (int, error)

Types

type Event

type Event struct {
	UnixSeconds  int64
	DataSource   string
	EventType    string
	EventID      int64
	EventDetails string
}

func ReadEvents

func ReadEvents(ctx context.Context, db *sql.DB, opts ...OpOption) ([]Event, error)

Returns nil if no event is found.

func (Event) ToSXidDetail

func (e Event) ToSXidDetail() *nvidia_query_sxid.Detail

func (Event) ToXidDetail

func (e Event) ToXidDetail() *nvidia_query_xid.Detail

type Op

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

type OpOption

type OpOption func(*Op)

func WithBefore

func WithBefore(t time.Time) OpOption

WithBefore sets the before timestamp for the delete queries. If not specified, it deletes all events.

func WithLimit

func WithLimit(limit int) OpOption

func WithSince

func WithSince(t time.Time) OpOption

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.

Jump to

Keyboard shortcuts

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