sqlitestore

package
v0.41.0 Latest Latest
Warning

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

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

Documentation

Overview

Package sqlitestore implements managed inventory using embedded SQLite. SQL, admission checks, and transaction ownership stay here; callers use inventory.Store.

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, audit, and inventory revision 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) AddPattern

func (m *Store) AddPattern(ctx context.Context, actor string, p inventory.Proposal) (*inventory.HostRecord, error)

AddPattern declares an active fleet rule as an administrative operation. Its attributes and admission checks are the same as an approved proposal; creation and its audit event commit together.

func (*Store) Audit

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

func (*Store) Change

func (m *Store) Change(ctx context.Context, actor, action, id string, revision uint64, p *inventory.Proposal) (*inventory.HostRecord, error)

func (*Store) Close

func (m *Store) Close() error

func (*Store) CreateToken

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

func (*Store) Enroll

func (m *Store) Enroll(ctx context.Context, p inventory.Proposal, token string) (*inventory.HostRecord, error)

func (*Store) Get

func (m *Store) Get(ctx context.Context, id string) (*inventory.HostRecord, error)

func (*Store) List

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

func (*Store) LookupHost

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

LookupHost reads current host facts and the inventory revision in the same snapshot. Exact names take precedence over active pattern records.

func (*Store) RevokeToken

func (m *Store) RevokeToken(ctx context.Context, actor, id string) error

func (*Store) Tokens

func (m *Store) Tokens(ctx context.Context, after string, limit int) ([]inventory.EnrollmentToken, error)

Jump to

Keyboard shortcuts

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