Documentation
¶
Overview ¶
Package store provides the single-host storage and authorization boundary. Every publication is one SQLite transaction, including its immutable content, current pointer, retry receipt, and audit record.
Index ¶
- type Error
- type Principal
- type Store
- func (s *Store) Audit(ctx context.Context, p Principal, limit int) ([]protocol.AuditEvent, error)
- func (s *Store) Authenticate(ctx context.Context, token string) (Principal, error)
- func (s *Store) Close() error
- func (s *Store) CreateToken(ctx context.Context, agentID, scope string) (string, error)
- func (s *Store) Get(ctx context.Context, p Principal, key string) (protocol.Artifact, error)
- func (s *Store) Identity(ctx context.Context, p Principal) (protocol.Identity, error)
- func (s *Store) List(ctx context.Context, p Principal) ([]protocol.Artifact, error)
- func (s *Store) Publish(ctx context.Context, p Principal, r protocol.PublishRequest) (protocol.PublishResult, error)
- func (s *Store) PublishPinned(ctx context.Context, p Principal, r protocol.PublishRequest, ...) (protocol.PublishResult, error)
- func (s *Store) RevokeAgent(ctx context.Context, agentID string) error
- func (s *Store) Sync(ctx context.Context, p Principal, request protocol.SyncRequest) (protocol.SyncPage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Principal ¶
Principal is established by Authenticate. Store operations verify it again, so constructing a Principal alone does not grant access.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func Open ¶
Open creates or opens a local SQLite database. New directories are private; existing parent directories retain their permissions. SQLite must reside on a local filesystem, not a shared network volume.
func (*Store) Audit ¶
Audit returns at most 1000 events in the principal's scope, newest first. Nonpositive limits use the default of 100.
func (*Store) Authenticate ¶
func (*Store) CreateToken ¶
CreateToken creates a new immutable agent identity. The plaintext token is returned once; only its SHA-256 digest is persisted. Revoked agent IDs cannot be recycled, preserving the meaning of audit and idempotency records.
func (*Store) List ¶
List returns metadata for at most the first 1000 current artifacts ordered by key. Content is deliberately omitted to keep list responses bounded; Get fetches an individual artifact's content.
func (*Store) Publish ¶
func (s *Store) Publish(ctx context.Context, p Principal, r protocol.PublishRequest) (protocol.PublishResult, error)
Publish applies compare-and-swap within the authenticated scope. A successful operation ID is permanently bound to the complete original request. Retries return that original version even after newer versions have been published.
func (*Store) PublishPinned ¶ added in v0.8.0
func (s *Store) PublishPinned(ctx context.Context, p Principal, r protocol.PublishRequest, expected protocol.Identity) (protocol.PublishResult, error)
PublishPinned adds a rejection-only identity precondition inside the existing CAS transaction. It never grants the supplied scope or agent any authority.