Documentation
¶
Index ¶
- func DefaultDir() string
- func Getenv(name string) string
- type AppError
- type AppendOptions
- type Context
- type EncryptedPayload
- type ErrorCode
- type EventPage
- type EventPayload
- type KeyMigrationInfo
- type Node
- type SnapshotInfo
- type Store
- func (s *Store) Append(ctx Context, opts AppendOptions) (string, error)
- func (s *Store) AppendAt(ctx Context, opts AppendOptions, expectedRoot string) (string, error)
- func (s *Store) AppendIdempotent(ctx Context, opts AppendOptions, expectedRoot, requestID, requestHash string, ...) (string, bool, error)
- func (s *Store) AuditLog() ([]Node, error)
- func (s *Store) Close() error
- func (s *Store) ContainsRoot(root string) (bool, error)
- func (s *Store) CreateSnapshot(dir string) (SnapshotInfo, error)
- func (s *Store) CurrentRoot() (string, error)
- func (s *Store) Dir() string
- func (s *Store) EventPage(after string, limit int) (EventPage, error)
- func (s *Store) EventPayloads(eventIDs []string, observedRoot string) ([]EventPayload, error)
- func (s *Store) EventPayloadsBounded(eventIDs []string, observedRoot string, maxBytes int64) ([]EventPayload, error)
- func (s *Store) MetadataEventPageAt(after, observedRoot string, limit int) (EventPage, error)
- func (s *Store) MigrateDataKey(destinationDir, newEncodedKey string) (result KeyMigrationInfo, returnErr error)
- func (s *Store) NamedRef(name string) (string, error)
- func (s *Store) NodePath(hash string) string
- func (s *Store) NodePayload(node Node) ([]byte, error)
- func (s *Store) NodesFromRoot(root string) ([]Node, error)
- func (s *Store) SetClock(now func() time.Time)
- func (s *Store) Snapshot(dest string) (SnapshotInfo, error)
- func (s *Store) SnapshotSizeEstimate() (uint64, error)
- func (s *Store) VerifyAll() (root string, nodes int, err error)
- func (s *Store) VerifyHead() error
- func (s *Store) WriteNamedRef(name string, root string) error
- func (s *Store) WriteNamedRefAt(name, root, expectedRoot string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDir ¶
func DefaultDir() string
DefaultDir is the local store directory used when none is given. A store created before the rename under .stellarjay keeps being used.
Types ¶
type AppendOptions ¶
type EncryptedPayload ¶
type EventPage ¶
type EventPage struct {
Nodes []Node
// Root is the current history tip captured atomically with this page. In the
// append-only linear history, a root captured from the first page remains a
// reachable replay boundary even if later page reads report a newer root.
Root string
// HasMore reports whether more events followed this page at the time of this
// read. A concurrent append can change it on a later request.
HasMore bool
}
type EventPayload ¶
EventPayload is a plaintext payload retrieved by opaque event identity. The identity is currently the event's content hash; callers must treat it as an opaque value and must not derive storage paths from it.
type KeyMigrationInfo ¶
type KeyMigrationInfo struct {
SourceRoot string `json:"source_root"`
DestinationRoot string `json:"destination_root"`
Nodes int `json:"nodes"`
NamedRefs int `json:"named_refs"`
HashMap map[string]string `json:"hash_map"`
}
KeyMigrationInfo describes an offline migration to a new data key. Node hashes necessarily change because the ciphertext is content-addressed.
type Node ¶
type Node struct {
Schema int `json:"schema"`
Hash string `json:"hash"`
Type string `json:"type"`
EntityID string `json:"entity_id,omitempty"`
Parents []string `json:"parents"`
Payload json.RawMessage `json:"payload,omitempty"`
SealedPayload *EncryptedPayload `json:"sealed_payload,omitempty"`
Actor string `json:"actor"`
Role string `json:"role"`
Command string `json:"command"`
CreatedAt time.Time `json:"created_at"`
RequestID string `json:"request_id,omitempty"`
RequestHash string `json:"request_hash,omitempty"`
}
type SnapshotInfo ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenStore ¶
OpenStore is for local development and compatibility. It creates or reads a data key inside the store directory. Production and hosted processes must use OpenStoreWithDataKey so snapshots and storage do not share a key location.
func OpenStoreWithDataKey ¶
OpenStoreWithDataKey opens a store with an explicit base64- or hex-encoded 32-byte key. Host processes should use this instead of the local key fallback.
func (*Store) AppendAt ¶
AppendAt appends only when expectedRoot is still the current root. Passing an empty expectedRoot is how a caller safely creates the first node in a store.
func (*Store) AppendIdempotent ¶
func (s *Store) AppendIdempotent(ctx Context, opts AppendOptions, expectedRoot, requestID, requestHash string, equivalentHashes ...string) (string, bool, error)
AppendIdempotent combines optimistic concurrency with a durable request ID. A retry of the same request returns its original node even if newer nodes have since been appended. Reusing a request ID for different content is rejected. equivalentHashes are older spellings of requestHash that also count as the same content, so requests recorded under a previous hashing rule still replay.
func (*Store) Close ¶
Close releases the store's process-wide writer lock. A Store must not be used after Close. Close is safe to call more than once.
func (*Store) ContainsRoot ¶
ContainsRoot reports whether root is an ancestor of, or equal to, the current root. It lets an operator prove that a previously pinned tip remains in the live linear history and therefore detect a volume-level rollback.
func (*Store) CreateSnapshot ¶
func (s *Store) CreateSnapshot(dir string) (SnapshotInfo, error)
CreateSnapshot creates a timestamped snapshot in dir. The filename and manifest timestamp are derived from the same store clock reading.
func (*Store) CurrentRoot ¶
func (*Store) EventPage ¶
EventPage returns at most limit events in oldest-to-newest order without materializing the complete history. The after hash is exclusive. Root and Nodes are read under the same lock, so clients can capture the first page's Root and stop exactly when that event is reached even if concurrent appends advance the root between page requests.
func (*Store) EventPayloads ¶
func (s *Store) EventPayloads(eventIDs []string, observedRoot string) ([]EventPayload, error)
EventPayloads retrieves and authenticates payloads in request order. Every event must belong to this store and be at or before observedRoot. The caller owns batch and response-size limits. Membership and boundary checks are atomic under the store read lock; immutable node reads and decryption happen after releasing it so readers do not delay appends.
func (*Store) EventPayloadsBounded ¶
func (s *Store) EventPayloadsBounded(eventIDs []string, observedRoot string, maxBytes int64) ([]EventPayload, error)
EventPayloadsBounded applies a cumulative plaintext byte limit while decrypting, before retaining an oversized batch in memory.
func (*Store) MetadataEventPageAt ¶
MetadataEventPageAt returns a metadata-only page bounded by observedRoot. When observedRoot is empty, the current root is captured. Supplying the captured root on later calls prevents concurrent appends from changing the scan's contents or has-more result.
Metadata reads deliberately do not authenticate or decrypt sealed payloads. Payload integrity is checked only by EventPayloads, NodePayload, or VerifyAll, so damage to an unselected payload cannot make metadata replay unavailable.
func (*Store) MigrateDataKey ¶
func (s *Store) MigrateDataKey(destinationDir, newEncodedKey string) (result KeyMigrationInfo, returnErr error)
MigrateDataKey decrypts the complete source history and writes an equivalent history to a new, previously nonexistent directory using newEncodedKey. The source is held read-only for the duration. Callers must keep the service offline so the returned destination is a complete cutover point. If only the final destination close fails, the completed destination is preserved and the populated result is returned alongside the error for operator verification.
func (*Store) Snapshot ¶
func (s *Store) Snapshot(dest string) (SnapshotInfo, error)
Snapshot writes a consistent gzip-compressed tar archive containing all encrypted nodes and refs. Encryption keys are deliberately excluded so a copied backup is not sufficient to decrypt the data.
func (*Store) SnapshotSizeEstimate ¶
SnapshotSizeEstimate returns a conservative estimate of the temporary free space needed to create a gzip snapshot. This intentionally scans only files that are included in snapshots and is used only by the admin endpoint.
func (*Store) VerifyAll ¶
VerifyAll verifies every node and authenticates every encrypted payload without materializing a second in-memory copy of the history.
func (*Store) VerifyHead ¶
VerifyHead verifies that the current root points to a complete, correctly addressed node. It is intentionally constant-time with respect to history length and is suitable for readiness probes.
func (*Store) WriteNamedRefAt ¶
WriteNamedRefAt updates a named ref only when its current value exactly matches expectedRoot. An empty expectedRoot creates a ref only when it does not already exist.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client is a small Go client for the Stellar Jay HTTP API described in docs/api.md.
|
Package client is a small Go client for the Stellar Jay HTTP API described in docs/api.md. |
|
cmd
|
|
|
stellarjay-mcp
command
Command stellarjay-mcp serves the AvianSuite MCP tools over stdio for one Stellar Jay store, for MCP clients that launch a local command.
|
Command stellarjay-mcp serves the AvianSuite MCP tools over stdio for one Stellar Jay store, for MCP clients that launch a local command. |
|
stellarjay-server
command
|
|
|
Package facts folds business-fact events into current state, following the payload conventions in llm.md.
|
Package facts folds business-fact events into current state, following the payload conventions in llm.md. |
|
Package mcp is the AvianSuite MCP server for a Stellar Jay store.
|
Package mcp is the AvianSuite MCP server for a Stellar Jay store. |