Documentation
¶
Index ¶
- Constants
- Variables
- func NormalizeSQLArgs(args []any) ([]any, error)
- func ValidateGraphCommand(command types.GraphCommand) error
- func ValidateGraphCommandAdmission(command types.GraphCommand) error
- func ValidateGraphReachableRequest(request types.GraphReachableRequest) error
- func ValidateSQLCommand(command types.SQLCommand) error
- type CheckpointFile
- type CheckpointRole
- type Materializer
- func (m *Materializer) Apply(ctx context.Context, slot uint64, value []byte) error
- func (m *Materializer) ApplyBatch(ctx context.Context, decisions []quepaxa.DecidedValue) error
- func (m *Materializer) CheckpointFilesAt(ctx context.Context) ([]CheckpointFile, uint64, func(), error)
- func (m *Materializer) Close() error
- func (m *Materializer) ConfigureLocalGraphNodePropertyIndexes(indexes []types.GraphNodePropertyIndex) error
- func (m *Materializer) GraphMutationReceipt(_ context.Context, requestID string) (types.MutationReceipt, bool, error)
- func (m *Materializer) GraphQuery(ctx context.Context, cypher string, args map[string]any) (types.GraphCommandResult, error)
- func (m *Materializer) GraphReachable(ctx context.Context, request types.GraphReachableRequest) (types.GraphReachableResult, error)
- func (m *Materializer) GraphReadStream(ctx context.Context, stream string, afterSequence uint64, limit uint, ...) ([]types.GraphStreamRecord, uint64, error)
- func (m *Materializer) GraphRequestMatches(_ context.Context, command types.GraphCommand) (bool, error)
- func (m *Materializer) GraphStreamOffset(ctx context.Context, stream, consumer string) (uint64, bool, uint64, error)
- func (m *Materializer) Health(ctx context.Context) error
- func (m *Materializer) KVGet(ctx context.Context, key string, now time.Time) ([]byte, bool, error)
- func (m *Materializer) KVGetAt(ctx context.Context, key string, now time.Time) ([]byte, bool, uint64, error)
- func (m *Materializer) KVRequestMatches(ctx context.Context, command types.KVCommand) (bool, error)
- func (m *Materializer) MutationReceipt(ctx context.Context, kind types.MutationKind, requestID string) (types.MutationReceipt, bool, error)
- func (m *Materializer) NotificationDrops() uint64
- func (m *Materializer) NotifyRequestMatches(ctx context.Context, command types.NotifyCommand) (bool, error)
- func (m *Materializer) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (m *Materializer) QueryResult(ctx context.Context, query string, args []any) (types.SQLStatementResult, error)
- func (m *Materializer) QueryResultAt(ctx context.Context, query string, args []any) (types.SQLStatementResult, uint64, error)
- func (m *Materializer) Restore(ctx context.Context, data []byte) error
- func (m *Materializer) RestoreCheckpoint(ctx context.Context, files []CheckpointFile) error
- func (m *Materializer) RestoreFile(ctx context.Context, snapshotPath string) error
- func (m *Materializer) SQLRequestMatches(ctx context.Context, command types.SQLCommand) (bool, error)
- func (m *Materializer) SQLRequestResultFingerprint(ctx context.Context, requestID string, fingerprint [32]byte, wantRows bool) (types.MutationReceipt, types.SQLCommandResult, bool, bool, error)
- func (m *Materializer) SQLRequestStatus(ctx context.Context, command types.SQLCommand) (types.MutationReceipt, bool, bool, error)
- func (m *Materializer) SQLRequestStatusFingerprint(ctx context.Context, requestID string, fingerprint [32]byte) (types.MutationReceipt, bool, bool, error)
- func (m *Materializer) Snapshot(ctx context.Context) ([]byte, error)
- func (m *Materializer) SnapshotAt(ctx context.Context) ([]byte, uint64, error)
- func (m *Materializer) SnapshotTo(ctx context.Context, writer io.Writer) (uint64, error)
- func (m *Materializer) StateTip() uint64
- func (m *Materializer) Subscribe(topic string) (<-chan []byte, func(), error)
- func (m *Materializer) Tip() uint64
- func (m *Materializer) ValidateTip(slot uint64, value []byte) error
Constants ¶
const ( MaxSQLBytes = 256 << 10 MaxSQLStatements = 64 MaxSQLArgs = 999 MaxReturningRows = 10_000 MaxResultBytes = 16 << 20 MaxMutationResultBytes = 1 << 20 MaxCellBytes = 1 << 20 MaxGraphReachableDepth = 64 MaxGraphReachableEdges = 1_000_000 MaxGraphPropertyIndexes = 64 )
const MaxGraphStreamRecords = 1_000
Variables ¶
var ( ErrGraphResourceLimit = errors.New("graph resource limit exceeded") ErrReadVersionMismatch = errors.New("read version mismatch") )
Functions ¶
func NormalizeSQLArgs ¶
NormalizeSQLArgs converts JSON numbers into database/sql argument types.
func ValidateGraphCommand ¶
func ValidateGraphCommand(command types.GraphCommand) error
ValidateGraphCommand keeps replicated Cypher deterministic and bounded.
func ValidateGraphCommandAdmission ¶ added in v0.9.1
func ValidateGraphCommandAdmission(command types.GraphCommand) error
ValidateGraphCommandAdmission rejects commands that LatticeDB can silently partially execute. Apply-time validation stays stable for committed-log replay.
func ValidateGraphReachableRequest ¶ added in v0.10.0
func ValidateGraphReachableRequest(request types.GraphReachableRequest) error
func ValidateSQLCommand ¶
func ValidateSQLCommand(command types.SQLCommand) error
ValidateSQLCommand validates the replicated SQL trust boundary.
Types ¶
type CheckpointFile ¶
type CheckpointFile struct {
Role CheckpointRole
Path string
}
type CheckpointRole ¶
type CheckpointRole string
const ( CheckpointSQLite CheckpointRole = "sqlite" CheckpointGraphData CheckpointRole = "graph-data" )
type Materializer ¶
type Materializer struct {
// contains filtered or unexported fields
}
Materializer applies decided values to SQLite. Uses single writer, multiple readers pattern like Hiqlite.
func Open ¶
func Open(dbPath string, readerCount int, idempotencyWindow ...uint64) (*Materializer, error)
Open opens or creates a materializer.
func (*Materializer) ApplyBatch ¶
func (m *Materializer) ApplyBatch(ctx context.Context, decisions []quepaxa.DecidedValue) error
ApplyBatch materializes a contiguous decision page with one SQLite commit.
func (*Materializer) CheckpointFilesAt ¶
func (m *Materializer) CheckpointFilesAt(ctx context.Context) ([]CheckpointFile, uint64, func(), error)
CheckpointFilesAt captures fixed-role database files without packaging them.
func (*Materializer) ConfigureLocalGraphNodePropertyIndexes ¶ added in v0.10.0
func (m *Materializer) ConfigureLocalGraphNodePropertyIndexes(indexes []types.GraphNodePropertyIndex) error
ConfigureLocalGraphNodePropertyIndexes declares node-local derived indexes. The declaration is retained and reconciled after materializer replacement.
func (*Materializer) GraphMutationReceipt ¶
func (m *Materializer) GraphMutationReceipt(_ context.Context, requestID string) (types.MutationReceipt, bool, error)
func (*Materializer) GraphQuery ¶
func (m *Materializer) GraphQuery(ctx context.Context, cypher string, args map[string]any) (types.GraphCommandResult, error)
func (*Materializer) GraphReachable ¶ added in v0.9.0
func (m *Materializer) GraphReachable(ctx context.Context, request types.GraphReachableRequest) (types.GraphReachableResult, error)
GraphReachable traverses one immutable LatticeDB read transaction. Nodes which fail NodeLabel or NodeFilters are neither returned nor expanded.
func (*Materializer) GraphReadStream ¶
func (*Materializer) GraphRequestMatches ¶
func (m *Materializer) GraphRequestMatches(_ context.Context, command types.GraphCommand) (bool, error)
func (*Materializer) GraphStreamOffset ¶
func (*Materializer) KVGetAt ¶
func (m *Materializer) KVGetAt(ctx context.Context, key string, now time.Time) ([]byte, bool, uint64, error)
KVGetAt reads a value and the applied slot from one SQLite snapshot.
func (*Materializer) KVRequestMatches ¶
func (*Materializer) MutationReceipt ¶
func (m *Materializer) MutationReceipt(ctx context.Context, kind types.MutationKind, requestID string) (types.MutationReceipt, bool, error)
func (*Materializer) NotificationDrops ¶
func (m *Materializer) NotificationDrops() uint64
NotificationDrops reports live at-most-once deliveries discarded before delivery, including confirmation failures and saturated queues.
func (*Materializer) NotifyRequestMatches ¶
func (m *Materializer) NotifyRequestMatches(ctx context.Context, command types.NotifyCommand) (bool, error)
NotifyRequestMatches checks whether a request ID is unused or has identical content.
func (*Materializer) Query ¶
func (m *Materializer) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
Query executes a read query.
func (*Materializer) QueryResult ¶
func (m *Materializer) QueryResult(ctx context.Context, query string, args []any) (types.SQLStatementResult, error)
QueryResult executes a bounded read query and materializes its result.
func (*Materializer) QueryResultAt ¶
func (m *Materializer) QueryResultAt(ctx context.Context, query string, args []any) (types.SQLStatementResult, uint64, error)
QueryResultAt executes a bounded read query and returns its applied slot from the same SQLite snapshot.
func (*Materializer) Restore ¶
func (m *Materializer) Restore(ctx context.Context, data []byte) error
Restore is unavailable for the combined store; use RestoreCheckpoint.
func (*Materializer) RestoreCheckpoint ¶
func (m *Materializer) RestoreCheckpoint(ctx context.Context, files []CheckpointFile) error
RestoreCheckpoint atomically installs the exact fixed-role checkpoint set.
func (*Materializer) RestoreFile ¶
func (m *Materializer) RestoreFile(ctx context.Context, snapshotPath string) error
RestoreFile is unavailable for the combined store; use RestoreCheckpoint.
func (*Materializer) SQLRequestMatches ¶
func (m *Materializer) SQLRequestMatches(ctx context.Context, command types.SQLCommand) (bool, error)
func (*Materializer) SQLRequestResultFingerprint ¶ added in v0.9.1
func (m *Materializer) SQLRequestResultFingerprint(ctx context.Context, requestID string, fingerprint [32]byte, wantRows bool) (types.MutationReceipt, types.SQLCommandResult, bool, bool, error)
SQLRequestResultFingerprint returns the retained receipt and row results for an idempotent SQL mutation.
func (*Materializer) SQLRequestStatus ¶ added in v0.9.1
func (m *Materializer) SQLRequestStatus(ctx context.Context, command types.SQLCommand) (types.MutationReceipt, bool, bool, error)
SQLRequestStatus returns the retained receipt and fingerprint match.
func (*Materializer) SQLRequestStatusFingerprint ¶ added in v0.9.1
func (m *Materializer) SQLRequestStatusFingerprint(ctx context.Context, requestID string, fingerprint [32]byte) (types.MutationReceipt, bool, bool, error)
SQLRequestStatusFingerprint returns the retained receipt for a precomputed fingerprint.
func (*Materializer) Snapshot ¶
func (m *Materializer) Snapshot(ctx context.Context) ([]byte, error)
Snapshot is unavailable for the combined store; use CheckpointFilesAt.
func (*Materializer) SnapshotAt ¶
SnapshotAt is unavailable for the combined store; use CheckpointFilesAt.
func (*Materializer) SnapshotTo ¶
SnapshotTo is unavailable for the combined store; use CheckpointFilesAt.
func (*Materializer) StateTip ¶
func (m *Materializer) StateTip() uint64
StateTip returns the last slot that changed user-visible state.
func (*Materializer) Subscribe ¶
func (m *Materializer) Subscribe(topic string) (<-chan []byte, func(), error)
Subscribe returns live, bounded, at-most-once notifications for a topic.
func (*Materializer) ValidateTip ¶
func (m *Materializer) ValidateTip(slot uint64, value []byte) error
ValidateTip checks that materialized state agrees with the recovered log.