Help us shape the future of Go! Take the 2026 Go Developer Survey

sqlitestore

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package sqlitestore implements managed inventory using embedded SQLite. SQL and transaction ownership stay here; shared admission rules live in inventory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store owns host persistence, admission, and authorization lookups. Each mutation checks conflicts and commits the host, token, and audit changes in one transaction. Reads return independent, coherent snapshots; there is no application cache or separate index to rebuild after a restart.

func Open

func Open(path string) (*Store, error)

Open opens a private SQLite database at path, creating its schema if needed. Storage, schema, or validation errors fail startup.

func (*Store) Audit

func (m *Store) Audit(ctx context.Context, cursor string, limit int) ([]inventory.AuditEvent, string, error)

Audit uses SQLite row positions only to resume this backend's scan. They are not audit event fields or a cross-backend ordering guarantee.

func (*Store) Close

func (m *Store) Close() error

func (*Store) CreateToken

func (m *Store) CreateToken(ctx context.Context, id string, lifetime time.Duration, event inventory.AuditEvent) (inventory.EnrollmentToken, error)

func (*Store) GetHost added in v0.43.0

func (m *Store) GetHost(ctx context.Context, id string) (*inventory.Host, error)

func (*Store) ListHosts added in v0.43.0

func (m *Store) ListHosts(ctx context.Context, after string, limit int, pending bool) ([]inventory.Host, error)

func (*Store) LookupHost

func (m *Store) LookupHost(ctx context.Context, name string) (*inventory.Host, error)

LookupHost reads current host facts in one snapshot. Exact names take precedence over active wildcard names.

func (*Store) RemoveHost added in v0.43.0

func (m *Store) RemoveHost(ctx context.Context, id string, expectedVersion string, event inventory.AuditEvent) error

func (*Store) RevokeToken

func (m *Store) RevokeToken(ctx context.Context, id string, event inventory.AuditEvent) error

func (*Store) SupportsVersioning added in v0.43.0

func (m *Store) SupportsVersioning() bool

func (*Store) UpsertHost added in v0.43.0

func (m *Store) UpsertHost(ctx context.Context, proposed inventory.Host, conditions inventory.WriteConditions, event inventory.AuditEvent) (*inventory.Host, error)

UpsertHost applies the write conditions and commits host, token, and audit changes in one SQLite transaction. Enrollment and review policy stay upstream.

Jump to

Keyboard shortcuts

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