Documentation
¶
Overview ¶
Package rhiza provides the primary in-process Go API. HTTP is an optional adapter.
Index ¶
- Constants
- Variables
- func ValidateExecuteRequest(req ExecuteRequest) error
- func ValidateGraphReachableRequest(req GraphReachableRequest) error
- type Config
- type DB
- func (db *DB) Close() error
- func (db *DB) Execute(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
- func (db *DB) ExecuteReturning(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
- func (db *DB) ExecuteReturningOne(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
- func (db *DB) GraphChanges(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
- func (db *DB) GraphExecute(ctx context.Context, req GraphCommand) (GraphExecuteResponse, error)
- func (db *DB) GraphQuery(ctx context.Context, req GraphQueryRequest) (GraphResult, error)
- func (db *DB) GraphReachable(ctx context.Context, req GraphReachableRequest) (GraphReachableResult, error)
- func (db *DB) GraphStreamOffset(ctx context.Context, req GraphStreamOffsetRequest) (GraphStreamOffsetResponse, error)
- func (db *DB) GraphStreamRead(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
- func (db *DB) Handler() http.Handler
- func (db *DB) KVCAS(ctx context.Context, req KVMutationRequest) (KVMutationResponse, error)
- func (db *DB) KVDelete(ctx context.Context, req KVMutationRequest) (KVMutationResponse, error)
- func (db *DB) KVGet(ctx context.Context, req KVGetRequest) (KVGetResponse, error)
- func (db *DB) KVPut(ctx context.Context, req KVMutationRequest) (KVMutationResponse, error)
- func (db *DB) Migrate(ctx context.Context, migrations []Migration) error
- func (db *DB) NotificationDrops() uint64
- func (db *DB) NotifyPublish(ctx context.Context, req NotifyCommand) (MutationReceipt, error)
- func (db *DB) NotifySubscribe(topic string) (<-chan []byte, func(), error)
- func (db *DB) ObjectStoreStats() (ObjectStoreStats, bool)
- func (db *DB) Query(ctx context.Context, req QueryRequest) (QueryResponse, error)
- func (db *DB) Ready() bool
- func (db *DB) RequestStatus(ctx context.Context, req RequestStatusRequest) (RequestStatusResponse, error)
- func (db *DB) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (db *DB) SetGraphStreamOffset(ctx context.Context, req GraphStreamOffsetRequest) error
- func (db *DB) TrimGraphStream(ctx context.Context, req GraphStreamTrimRequest) error
- type ExecuteRequest
- type ExecuteResponse
- type GraphCommand
- type GraphExecuteResponse
- type GraphNodePropertyIndex
- type GraphQueryRequest
- type GraphReachableNode
- type GraphReachableRequest
- type GraphReachableResult
- type GraphResult
- type GraphStreamEvent
- type GraphStreamOffsetRequest
- type GraphStreamOffsetResponse
- type GraphStreamReadRequest
- type GraphStreamReadResponse
- type GraphStreamRecord
- type GraphStreamTrimRequest
- type HTTPErrorResponse
- type KVGetRequest
- type KVGetResponse
- type KVMutationRequest
- type KVMutationResponse
- type Member
- type Migration
- type MutationReceipt
- type MutationStatus
- type NodeID
- type NotifyCommand
- type ObjectStoreDurability
- type ObjectStoreStats
- type QueryRequest
- type QueryResponse
- type ReadReplica
- func (r *ReadReplica) Close() error
- func (r *ReadReplica) GraphChanges(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
- func (r *ReadReplica) GraphQuery(ctx context.Context, req GraphQueryRequest) (GraphResult, error)
- func (r *ReadReplica) GraphReachable(ctx context.Context, req GraphReachableRequest) (GraphReachableResult, error)
- func (r *ReadReplica) GraphStreamOffset(ctx context.Context, req GraphStreamOffsetRequest) (GraphStreamOffsetResponse, error)
- func (r *ReadReplica) GraphStreamRead(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
- func (r *ReadReplica) Handler() http.Handler
- func (r *ReadReplica) KVGet(ctx context.Context, req KVGetRequest) (KVGetResponse, error)
- func (r *ReadReplica) ObjectStoreStats() ObjectStoreStats
- func (r *ReadReplica) Query(ctx context.Context, req QueryRequest) (QueryResponse, error)
- func (r *ReadReplica) Ready() bool
- func (r *ReadReplica) RequestStatus(ctx context.Context, req RequestStatusRequest) (RequestStatusResponse, error)
- func (r *ReadReplica) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *ReadReplica) Status() ReplicaStatus
- func (r *ReadReplica) Sync(ctx context.Context) error
- type ReplicaConfig
- type ReplicaMember
- type ReplicaMode
- type ReplicaStatus
- type RequestStatusRequest
- type RequestStatusResponse
- type SQLRow
- type SQLStatement
- type SQLStatementOutputRef
- type SQLStatementResult
Constants ¶
const ( ConsistencyLocal = "local" ConsistencyLinearizable = "linearizable" ObjectStoreDurabilityAsync = types.ObjectStoreDurabilityAsync ObjectStoreDurabilityBeforeAck = types.ObjectStoreDurabilityBeforeAck MutationCommitted = types.MutationCommitted MutationRejected = types.MutationRejected MutationErrorCodeExecutionFailed = types.MutationErrorCodeExecutionFailed MutationErrorCodePreconditionFailed = types.MutationErrorCodePreconditionFailed RequestKindSQL = "sql" RequestKindKV = "kv" RequestKindNotify = "notify" RequestKindGraph = "graph" RequestStateCommitted = "committed" RequestStateRejected = "rejected" RequestStateUnknownOrExpired = "unknown_or_expired" ObjectStoreProviderFilesystem = "filesystem" ObjectStoreProviderS3 = "s3" ObjectStoreProviderGCS = "gcs" ObjectStoreProviderAzure = "azure" HTTPErrorCodeInvalidRequest = "invalid_request" HTTPErrorCodeRequestConflict = "request_conflict" HTTPErrorCodeNotReady = "not_ready" HTTPErrorCodeOverloaded = "overloaded" HTTPErrorCodeCommitUnknown = "commit_unknown" HTTPErrorCodeMethodNotAllowed = "method_not_allowed" HTTPErrorCodeNotFound = "not_found" // MaxReplicatedMutationBytes is the encoded consensus-value limit. MaxReplicatedMutationBytes = quepaxa.MaxReplicatedValueBytes // MaxHTTPBodyBytes is the optional HTTP adapter's larger JSON envelope limit. MaxHTTPBodyBytes = network.MaxRequestBodyBytes MaxGraphReachableDepth = materializer.MaxGraphReachableDepth MaxGraphReachableResults = materializer.MaxReturningRows MaxGraphReachableScannedEdges = materializer.MaxGraphReachableEdges MaxGraphReachableBytes = materializer.MaxResultBytes MaxLocalGraphPropertyIndexes = materializer.MaxGraphPropertyIndexes )
Variables ¶
var ( ErrNotReady = network.ErrNotReady ErrRequestConflict = network.ErrRequestConflict ErrInvalidRequest = network.ErrInvalidRequest ErrCommitUnknown = network.ErrCommitUnknown ErrGraphResourceLimit = network.ErrGraphResourceLimit ErrReadVersionMismatch = network.ErrReadVersionMismatch )
Functions ¶
func ValidateExecuteRequest ¶ added in v0.8.1
func ValidateExecuteRequest(req ExecuteRequest) error
ValidateExecuteRequest applies the replicated SQL contract and encoded-size limit without submitting the mutation.
func ValidateGraphReachableRequest ¶ added in v0.10.0
func ValidateGraphReachableRequest(req GraphReachableRequest) error
ValidateGraphReachableRequest checks limits and value types without reading data.
Types ¶
type Config ¶
type Config struct {
ClusterID string
NodeID string
DataDir string
BindAddr string
PeerAddr string
AdminToken string
Members []Member
ObjStoreEndpoint string
ObjStoreBucket string
ObjStoreProvider string
ObjStoreDir string
ObjStorePrefix string
ObjStoreRegion string
ObjStoreInsecure bool
ObjStoreRetries int
ObjStoreAccessKey string
ObjStoreSecretKey string
ObjStoreSessionToken string
ObjStoreServiceAccount string
ObjStoreAzureTenantID string
ObjStoreAzureClientID string
ObjStoreAzureClientSecret string
ObjStoreAzureStorageAccount string
ObjStoreAzureStorageAccountKey string
ObjStoreAzureConnectionString string
ObjStoreAzureUserAssignedID string
ObjStoreDurability ObjectStoreDurability
ObjStoreSyncInterval time.Duration
ObjStoreBatchDelay time.Duration
ObjStoreGCInterval time.Duration
ObjStoreGCGracePeriod time.Duration
CheckpointInterval time.Duration
CheckpointTailBytes int64
MaxWALBytes int64
// Both zero use 64 concurrent reads / 8 long-poll reads. With an explicit
// total, zero MaxLongPollReads disables waiting stream reads.
MaxConcurrentReads int
MaxLongPollReads int
// LocalGraphNodePropertyIndexes are node-local derived indexes. Rhiza
// reconciles them at open and after checkpoint restore; they are not replicated.
LocalGraphNodePropertyIndexes []GraphNodePropertyIndex
}
Config contains the durable local path, fixed membership, and peer endpoint.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB owns one embedded Rhiza node and its private QUIC peer endpoint.
func (*DB) Execute ¶
func (db *DB) Execute(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
func (*DB) ExecuteReturning ¶ added in v0.9.1
func (db *DB) ExecuteReturning(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
ExecuteReturning executes one replicated mutation and returns its bounded rows.
func (*DB) ExecuteReturningOne ¶ added in v0.9.1
func (db *DB) ExecuteReturningOne(ctx context.Context, req ExecuteRequest) (ExecuteResponse, error)
ExecuteReturningOne commits only when exactly one row is returned.
func (*DB) GraphChanges ¶
func (db *DB) GraphChanges(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
GraphChanges reads the node-local LatticeDB semantic graph changefeed.
func (*DB) GraphExecute ¶
func (db *DB) GraphExecute(ctx context.Context, req GraphCommand) (GraphExecuteResponse, error)
func (*DB) GraphQuery ¶
func (db *DB) GraphQuery(ctx context.Context, req GraphQueryRequest) (GraphResult, error)
func (*DB) GraphReachable ¶ added in v0.9.0
func (db *DB) GraphReachable(ctx context.Context, req GraphReachableRequest) (GraphReachableResult, error)
GraphReachable performs a bounded, deterministic outgoing traversal on one immutable local graph snapshot. Results are ordered by distance, then node ID.
func (*DB) GraphStreamOffset ¶
func (db *DB) GraphStreamOffset(ctx context.Context, req GraphStreamOffsetRequest) (GraphStreamOffsetResponse, error)
GraphStreamOffset returns a replicated durable consumer offset.
func (*DB) GraphStreamRead ¶
func (db *DB) GraphStreamRead(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
GraphStreamRead reads a replicated named stream after its per-stream cursor.
func (*DB) KVCAS ¶
func (db *DB) KVCAS(ctx context.Context, req KVMutationRequest) (KVMutationResponse, error)
func (*DB) KVDelete ¶
func (db *DB) KVDelete(ctx context.Context, req KVMutationRequest) (KVMutationResponse, error)
func (*DB) KVGet ¶
func (db *DB) KVGet(ctx context.Context, req KVGetRequest) (KVGetResponse, error)
func (*DB) KVPut ¶
func (db *DB) KVPut(ctx context.Context, req KVMutationRequest) (KVMutationResponse, error)
func (*DB) Migrate ¶ added in v0.9.1
Migrate applies strictly ordered migrations exactly once. A repeated version must have the same name and statements.
func (*DB) NotificationDrops ¶
func (*DB) NotifyPublish ¶
func (db *DB) NotifyPublish(ctx context.Context, req NotifyCommand) (MutationReceipt, error)
func (*DB) NotifySubscribe ¶
func (*DB) ObjectStoreStats ¶
func (db *DB) ObjectStoreStats() (ObjectStoreStats, bool)
func (*DB) Query ¶
func (db *DB) Query(ctx context.Context, req QueryRequest) (QueryResponse, error)
func (*DB) Ready ¶ added in v0.8.1
Ready reports whether local recovery and catch-up completed. It is not a live quorum probe: an isolated peer may remain locally ready. Mutations and linearizable queries still fail closed when quorum is unavailable.
func (*DB) RequestStatus ¶
func (db *DB) RequestStatus(ctx context.Context, req RequestStatusRequest) (RequestStatusResponse, error)
func (*DB) SetGraphStreamOffset ¶
func (db *DB) SetGraphStreamOffset(ctx context.Context, req GraphStreamOffsetRequest) error
SetGraphStreamOffset stores a replicated durable consumer offset.
func (*DB) TrimGraphStream ¶
func (db *DB) TrimGraphStream(ctx context.Context, req GraphStreamTrimRequest) error
TrimGraphStream replicates deletion of records through the supplied sequence.
type ExecuteRequest ¶
type ExecuteRequest = network.ExecuteRequest
type ExecuteResponse ¶
type ExecuteResponse = network.ExecuteResponse
func ExecuteReturningMap ¶ added in v0.9.1
func ExecuteReturningMap[T any](ctx context.Context, db *DB, req ExecuteRequest, mapper func(SQLRow) (T, error)) (ExecuteResponse, []T, error)
ExecuteReturningMap maps replicated RETURNING rows to an application type.
func ExecuteReturningMapOne ¶ added in v0.9.1
func ExecuteReturningMapOne[T any](ctx context.Context, db *DB, req ExecuteRequest, mapper func(SQLRow) (T, error)) (ExecuteResponse, T, error)
ExecuteReturningMapOne maps one row and rolls back unless exactly one exists.
type GraphCommand ¶
type GraphCommand = types.GraphCommand
type GraphExecuteResponse ¶
type GraphExecuteResponse = network.GraphExecuteResponse
type GraphNodePropertyIndex ¶ added in v0.10.0
type GraphNodePropertyIndex = types.GraphNodePropertyIndex
type GraphQueryRequest ¶
type GraphQueryRequest = network.GraphQueryRequest
type GraphReachableNode ¶ added in v0.10.0
type GraphReachableNode = types.GraphReachableNode
type GraphReachableRequest ¶ added in v0.10.0
type GraphReachableRequest = types.GraphReachableRequest
type GraphReachableResult ¶ added in v0.10.0
type GraphReachableResult = types.GraphReachableResult
type GraphResult ¶
type GraphResult = types.GraphCommandResult
type GraphStreamEvent ¶
type GraphStreamEvent = types.GraphStreamEvent
type GraphStreamOffsetRequest ¶
type GraphStreamOffsetRequest = network.GraphStreamOffsetRequest
type GraphStreamOffsetResponse ¶
type GraphStreamOffsetResponse = network.GraphStreamOffsetResponse
type GraphStreamReadRequest ¶
type GraphStreamReadRequest = network.GraphStreamReadRequest
type GraphStreamReadResponse ¶
type GraphStreamReadResponse = network.GraphStreamReadResponse
type GraphStreamRecord ¶
type GraphStreamRecord = types.GraphStreamRecord
type GraphStreamTrimRequest ¶
type GraphStreamTrimRequest = network.GraphStreamTrimRequest
type HTTPErrorResponse ¶ added in v0.9.1
type HTTPErrorResponse = network.ErrorResponse
type KVGetRequest ¶
type KVGetRequest = network.KVGetRequest
type KVGetResponse ¶
type KVGetResponse = network.KVGetResponse
type KVMutationRequest ¶
type KVMutationRequest = network.KVMutationRequest
type KVMutationResponse ¶
type KVMutationResponse = network.KVMutationResponse
type Migration ¶ added in v0.9.1
type Migration struct {
Version int64 `json:"version"`
Name string `json:"name"`
Statements []SQLStatement `json:"statements"`
}
Migration is one ordered, repeatable schema change.
type MutationReceipt ¶
type MutationReceipt = types.MutationReceipt
type MutationStatus ¶ added in v0.9.1
type MutationStatus = types.MutationStatus
type NotifyCommand ¶
type NotifyCommand = types.NotifyCommand
type ObjectStoreDurability ¶
type ObjectStoreDurability = types.ObjectStoreDurability
type ObjectStoreStats ¶
type QueryRequest ¶
type QueryRequest = network.QueryRequest
type QueryResponse ¶
type QueryResponse = network.QueryResponse
type ReadReplica ¶ added in v0.9.1
type ReadReplica struct {
// contains filtered or unexported fields
}
ReadReplica is an eventual, read-only copy. It never proposes, votes, acknowledges decisions, or participates in quorum/read-index operations.
func OpenLearner ¶ added in v0.9.1
func OpenLearner(ctx context.Context, config ReplicaConfig) (*ReadReplica, error)
OpenLearner follows voter peer logs first and falls back to certified object storage after compaction or peer unavailability. It is not cluster membership.
func OpenReadReplica ¶ added in v0.9.1
func OpenReadReplica(ctx context.Context, config ReplicaConfig) (*ReadReplica, error)
OpenReadReplica follows certified checkpoint/archive state only.
func (*ReadReplica) Close ¶ added in v0.9.1
func (r *ReadReplica) Close() error
func (*ReadReplica) GraphChanges ¶ added in v0.9.1
func (r *ReadReplica) GraphChanges(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
func (*ReadReplica) GraphQuery ¶ added in v0.9.1
func (r *ReadReplica) GraphQuery(ctx context.Context, req GraphQueryRequest) (GraphResult, error)
func (*ReadReplica) GraphReachable ¶ added in v0.11.0
func (r *ReadReplica) GraphReachable(ctx context.Context, req GraphReachableRequest) (GraphReachableResult, error)
func (*ReadReplica) GraphStreamOffset ¶ added in v0.9.1
func (r *ReadReplica) GraphStreamOffset(ctx context.Context, req GraphStreamOffsetRequest) (GraphStreamOffsetResponse, error)
func (*ReadReplica) GraphStreamRead ¶ added in v0.9.1
func (r *ReadReplica) GraphStreamRead(ctx context.Context, req GraphStreamReadRequest) (GraphStreamReadResponse, error)
func (*ReadReplica) Handler ¶ added in v0.9.1
func (r *ReadReplica) Handler() http.Handler
func (*ReadReplica) KVGet ¶ added in v0.9.1
func (r *ReadReplica) KVGet(ctx context.Context, req KVGetRequest) (KVGetResponse, error)
func (*ReadReplica) ObjectStoreStats ¶ added in v0.9.1
func (r *ReadReplica) ObjectStoreStats() ObjectStoreStats
func (*ReadReplica) Query ¶ added in v0.9.1
func (r *ReadReplica) Query(ctx context.Context, req QueryRequest) (QueryResponse, error)
func (*ReadReplica) Ready ¶ added in v0.9.1
func (r *ReadReplica) Ready() bool
func (*ReadReplica) RequestStatus ¶ added in v0.9.1
func (r *ReadReplica) RequestStatus(ctx context.Context, req RequestStatusRequest) (RequestStatusResponse, error)
func (*ReadReplica) ServeHTTP ¶ added in v0.9.1
func (r *ReadReplica) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*ReadReplica) Status ¶ added in v0.9.1
func (r *ReadReplica) Status() ReplicaStatus
type ReplicaConfig ¶ added in v0.9.1
type ReplicaConfig struct {
ClusterID string
ReplicaID string
DataDir string
AdminToken string
Members []ReplicaMember
SyncInterval time.Duration
// Both zero use 64 concurrent reads / 8 long-poll reads. With an explicit
// total, zero MaxLongPollReads disables waiting stream reads.
MaxConcurrentReads int
MaxLongPollReads int
ObjStoreEndpoint string
ObjStoreBucket string
ObjStoreProvider string
ObjStoreDir string
ObjStorePrefix string
ObjStoreRegion string
ObjStoreInsecure bool
ObjStoreRetries int
ObjStoreAccessKey string
ObjStoreSecretKey string
ObjStoreSessionToken string
ObjStoreServiceAccount string
ObjStoreAzureTenantID string
ObjStoreAzureClientID string
ObjStoreAzureClientSecret string
ObjStoreAzureStorageAccount string
ObjStoreAzureStorageAccountKey string
ObjStoreAzureConnectionString string
ObjStoreAzureUserAssignedID string
}
ReplicaConfig configures a non-voting, read-only follower. Members contains only the fixed voters whose certificates the follower verifies.
type ReplicaMember ¶ added in v0.9.1
type ReplicaMember = network.PeerIdentity
func NewReplicaMember ¶ added in v0.9.1
func NewReplicaMember(clusterID string, member Member) (ReplicaMember, error)
NewReplicaMember removes a voter's secret while retaining its pinned peer identity.
type ReplicaMode ¶ added in v0.9.1
type ReplicaMode string
const ( ReplicaModeObjectStore ReplicaMode = "object-store" ReplicaModeLearner ReplicaMode = "learner" )
type ReplicaStatus ¶ added in v0.9.1
type RequestStatusRequest ¶
type RequestStatusRequest = network.RequestStatusRequest
type RequestStatusResponse ¶
type RequestStatusResponse = network.RequestStatusResponse
type SQLRow ¶ added in v0.9.1
type SQLRow struct {
// contains filtered or unexported fields
}
SQLRow is one immutable row passed to a typed mapping callback.
type SQLStatement ¶
type SQLStatement = types.SQLStatement
type SQLStatementOutputRef ¶ added in v0.9.1
type SQLStatementOutputRef = types.SQLStatementOutputRef
type SQLStatementResult ¶ added in v0.9.1
type SQLStatementResult = types.SQLStatementResult
Directories
¶
| Path | Synopsis |
|---|---|
|
benchmarks
|
|
|
cmd
|
|
|
rhiza
command
|
|
|
rhiza-bench
command
|
|
|
rhiza-ffi
command
|
|
|
internal
|
|
|
pkg
|
|
|
quepaxa
Package quepaxa implements the crash-fault-tolerant QuePaxa Algorithm 3 recorder and Algorithm 4 proposer over a durable QLog.
|
Package quepaxa implements the crash-fault-tolerant QuePaxa Algorithm 3 recorder and Algorithm 4 proposer over a durable QLog. |