Documentation
¶
Overview ¶
Package sqlitestore implements managed inventory using embedded SQLite. SQL, admission checks, and transaction ownership stay here; callers use inventory.Store.
Index ¶
- type Store
- func (m *Store) AddPattern(ctx context.Context, actor string, p inventory.Proposal) (*inventory.HostRecord, error)
- func (m *Store) Audit(ctx context.Context, after inventory.AuditSequence, limit int) ([]inventory.AuditEvent, error)
- func (m *Store) Change(ctx context.Context, actor, action, id string, revision uint64, ...) (*inventory.HostRecord, error)
- func (m *Store) Close() error
- func (m *Store) CreateToken(ctx context.Context, actor string, lifetime time.Duration) (inventory.EnrollmentToken, error)
- func (m *Store) Enroll(ctx context.Context, p inventory.Proposal, token string) (*inventory.HostRecord, error)
- func (m *Store) Get(ctx context.Context, id string) (*inventory.HostRecord, error)
- func (m *Store) List(ctx context.Context, after string, limit int, pending bool) ([]inventory.HostRecord, error)
- func (m *Store) LookupHost(ctx context.Context, name string) (*inventory.ResolvedHost, string, error)
- func (m *Store) RevokeToken(ctx context.Context, actor, id string) error
- func (m *Store) Tokens(ctx context.Context, after string, limit int) ([]inventory.EnrollmentToken, 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, 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 ¶
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) CreateToken ¶
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.