Documentation
¶
Overview ¶
Package sqlitestore implements managed inventory using embedded SQLite. SQL and transaction ownership stay here; shared admission rules live in inventory.
Index ¶
- type Store
- func (m *Store) Audit(ctx context.Context, cursor string, limit int) ([]inventory.AuditEvent, string, error)
- func (m *Store) Close() error
- func (m *Store) CreateToken(ctx context.Context, id string, lifetime time.Duration, ...) (inventory.EnrollmentToken, error)
- func (m *Store) GetHost(ctx context.Context, id string) (*inventory.Host, error)
- func (m *Store) ListHosts(ctx context.Context, after string, limit int, pending bool) ([]inventory.Host, error)
- func (m *Store) LookupHost(ctx context.Context, name string) (*inventory.Host, error)
- func (m *Store) RemoveHost(ctx context.Context, id string, expectedVersion string, ...) error
- func (m *Store) RevokeToken(ctx context.Context, id string, event inventory.AuditEvent) error
- func (m *Store) SupportsVersioning() bool
- func (m *Store) UpsertHost(ctx context.Context, proposed inventory.Host, ...) (*inventory.Host, error)
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 ¶
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) CreateToken ¶
func (*Store) LookupHost ¶
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 (*Store) RevokeToken ¶
func (*Store) SupportsVersioning ¶ added in v0.43.0
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.