Documentation
¶
Overview ¶
Package customstore demonstrates two application-owned llm.Store adapters: a durable single-file Store opened with Open, and an optional policy middleware opened with Own or Borrow. Neither imports Human internals.
Index ¶
- Variables
- func Borrow(ctx context.Context, next llm.Store, config Config) (framework.Resource[llm.Store], error)
- func Open(ctx context.Context, config Config) (framework.Resource[llm.Store], error)
- func Own(ctx context.Context, next framework.Resource[llm.Store], config Config) (framework.Resource[llm.Store], error)
- type AuditFunc
- type Config
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSnapshotTooLarge means the next atomic image exceeds the configured // Store limit. The transaction has not reached the filesystem commit point. ErrSnapshotTooLarge = errors.New("custom Store: snapshot too large") // ErrStorePoisoned means an atomic rename may have committed but directory // durability could not be proved. The handle refuses every later operation; // release and reopen is the only reconciliation path. ErrStorePoisoned = errors.New("custom Store: handle poisoned by ambiguous commit") )
Functions ¶
func Borrow ¶
func Borrow( ctx context.Context, next llm.Store, config Config, ) (framework.Resource[llm.Store], error)
Borrow decorates a host-owned Store. Releasing the returned Resource is a no-op; the host must keep next alive until every Human runtime using it has reached Done.
func Open ¶
Open creates an application-owned, durable llm.Store. The example uses a checksummed, versioned JSON snapshot and an fsync + atomic-rename commit. It is deliberately a small single-owner adapter rather than a production database driver: every Update rewrites the complete image, which keeps the transaction and crash boundary visible to embedders implementing their own Store. The parent directory must already exist and is a trusted private directory; this compact example does not defend against a process that can replace entries in that directory or ignore advisory locks. Supported Unix platforms hold a non-blocking advisory lock for the Resource lifetime; other platforms fail construction instead of silently running without cross-process fencing.