Documentation
¶
Overview ¶
Package meldbase provides an embedded, durable, realtime document database.
Stability: Alpha. The Go database API can change between alpha releases; operators and applications must follow the release notes and migration instructions when upgrading. Versioned HTTP/WebSocket protocol contracts are documented separately at https://meldbase.com/protocol-stability. HTTP/WebSocket serving is provided by github.com/crapthings/meldbase/server; optional deployment adapters live below github.com/crapthings/meldbase/integrations.
Index ¶
- Constants
- Variables
- func MarshalQuerySpecJSON(query QuerySpec) ([]byte, error)
- func MarshalReplicationFrame(frame ReplicationFrame, limits ReplicationFrameLimits) ([]byte, error)
- func MarshalWireDocument(document Document) ([]byte, error)
- func MarshalWireValue(value Value) ([]byte, error)
- func ValidateStrictJSON(data []byte, maxBytes int) error
- type ArchiveBootstrap
- type BackupResult
- type BackupStats
- type Change
- type ChangeBatch
- type Collection
- type CommitCoordinatorOptions
- type CommitCoordinatorStats
- type CommitRetentionPolicy
- type CommitStats
- type CompactionOptions
- type CompactionStats
- type Cursor
- type DB
- type DBStats
- type DatabaseOptions
- type DeleteResult
- type DiagnosticEvent
- type DiagnosticKind
- type DiagnosticOutcome
- type DiagnosticSnapshot
- type DiagnosticStats
- type Diagnostics
- type DiagnosticsOptions
- type Document
- type DocumentCacheStats
- type DocumentID
- type DurabilityStats
- type DurableChangeBatch
- type DurableChangeSubscription
- type DurableDatabaseChangeBatch
- type DurableDatabaseChangeSubscription
- type ExplainAccessSource
- type ExplainAdvice
- type ExplainBound
- type ExplainBudget
- type ExplainResult
- type Filter
- type Follower
- type FollowerPromotionAuthority
- type FollowerPromotionFence
- type FollowerPromotionFenceBinder
- type FollowerPromotionRequest
- type IndexBuildFailure
- type IndexBuildID
- type IndexBuildPhase
- type IndexBuildScheduler
- type IndexBuildSchedulerOptions
- type IndexBuildSchedulerStats
- type IndexBuildStats
- type IndexBuildStatus
- type IndexCatalogEntry
- type IndexDefinition
- type IndexField
- type IndexOptions
- type Kind
- type LogicalArchiveImportOptions
- type LogicalArchiveResult
- type Maintenance
- type MaintenanceOptions
- type MaintenanceStats
- type MutationSpec
- type OpenOptions
- type Operation
- type OperationalState
- type PageCacheStats
- type PhysicalBackupImportOptions
- type PrimaryWriteFence
- type PrimaryWriteFenceRequest
- type PrimaryWriteFenceStats
- type QueryDelta
- type QueryDeltaOperation
- type QueryDeltaOperationKind
- type QueryDeltaSubscription
- type QueryLimits
- type QueryOptions
- type QueryReplaySource
- type QueryReplaySubscription
- type QuerySnapshot
- type QuerySpec
- type QueryStats
- type QuerySubscription
- type RealtimeStats
- type ReclaimOptions
- type ReclaimResult
- type ReclamationStats
- type RecoveryMode
- type RecoveryReport
- type ReplicationFrame
- type ReplicationFrameLimits
- type ReplicationSourceLease
- type ReplicationSourceSession
- type ResourceLimits
- type ResourceStats
- type RollbackAnchor
- type RollbackAnchorStatusProvider
- type RollbackAnchorStore
- type RollbackAnchorStoreStatus
- type RollbackProtection
- type SortField
- type StorageFormat
- type StorageFormatInfo
- type StorageLimits
- type StorageStats
- type Update
- type UpdateResult
- type Value
- func Array(v ...Value) Value
- func Binary(v []byte) Value
- func Bool(v bool) Value
- func Float(v float64) Value
- func ID(v DocumentID) Value
- func Int(v int64) Value
- func Null() Value
- func Object(v Document) Value
- func String(v string) Value
- func Time(v time.Time) Value
- func UnmarshalWireValue(data []byte, limits QueryLimits) (Value, error)
- func ValueOf(x any) (Value, error)
- type VerificationReport
- type WriteTransaction
- type WriteTransactionStats
Constants ¶
const ArrayKind = database.ArrayKind
ArrayKind identifies an array of values.
const BinaryKind = database.BinaryKind
BinaryKind identifies binary data.
const BoolKind = database.BoolKind
BoolKind identifies a boolean value.
const CreateCollectionOperation = database.CreateCollectionOperation
CreateCollectionOperation marks collection creation in the durable database change feed.
Ordinary collection creation remains implicit for CRUD callers.
const CreateIndexOperation = database.CreateIndexOperation
CreateIndexOperation marks publication of a new index.
const DefaultCommitCoordinatorMaxBatch = database.DefaultCommitCoordinatorMaxBatch
DefaultCommitCoordinatorMaxBatch sets the default maximum number of writes in a commit group.
const DefaultCommitCoordinatorMaxDelay = database.DefaultCommitCoordinatorMaxDelay
DefaultCommitCoordinatorMaxDelay sets the default wait for grouping queued writes.
const DefaultCommitCoordinatorMaxPending = database.DefaultCommitCoordinatorMaxPending
DefaultCommitCoordinatorMaxPending sets the default maximum number of queued writes.
const DefaultCommitRetentionMaxBytes = database.DefaultCommitRetentionMaxBytes
DefaultCommitRetentionMaxBytes sets the default retained commit payload limit.
const DefaultCommitRetentionMaxCommits = database.DefaultCommitRetentionMaxCommits
DefaultCommitRetentionMaxCommits sets the default retained commit count limit.
const DefaultMaxDocumentBytes = database.DefaultMaxDocumentBytes
DefaultMaxDocumentBytes sets the default canonical document byte limit.
const DefaultMaxFileBytes = database.DefaultMaxFileBytes
DefaultMaxFileBytes sets the default physical database file size limit.
const DefaultMaxIndexBuildBytes = database.DefaultMaxIndexBuildBytes
DefaultMaxIndexBuildBytes sets the default index-build byte limit.
const DefaultMaxIndexBuildEntries = database.DefaultMaxIndexBuildEntries
DefaultMaxIndexBuildEntries sets the default index-build entry count limit.
const DefaultMaxQueryCandidates = database.DefaultMaxQueryCandidates
DefaultMaxQueryCandidates sets the default retained query candidate limit.
const DefaultMaxQueryDocumentsExamined = database.DefaultMaxQueryDocumentsExamined
DefaultMaxQueryDocumentsExamined sets the default examined document limit per query.
const DefaultMaxQueryKeysExamined = database.DefaultMaxQueryKeysExamined
DefaultMaxQueryKeysExamined sets the default examined index key limit per query.
const DefaultMaxQuerySkip = database.DefaultMaxQuerySkip
DefaultMaxQuerySkip sets the default query offset limit.
const DefaultMaxQuerySortBytes = database.DefaultMaxQuerySortBytes
DefaultMaxQuerySortBytes sets the default retained sort data byte limit.
const DefaultMaxReactiveViewBytes = database.DefaultMaxReactiveViewBytes
DefaultMaxReactiveViewBytes sets the default retained live query byte limit.
const DefaultMaxReactiveViewDocuments = database.DefaultMaxReactiveViewDocuments
DefaultMaxReactiveViewDocuments sets the default number of document versions retained by a live query.
Views retain matching versions for incremental ordering and updates, not merely the page currently emitted to a subscriber.
const DefaultMaxTransactionBytes = database.DefaultMaxTransactionBytes
DefaultMaxTransactionBytes sets the default canonical transaction byte limit.
const DefaultMaxTransactionChanges = database.DefaultMaxTransactionChanges
DefaultMaxTransactionChanges sets the default transaction change count limit.
const DefaultReplayDeliveryTimeout = database.DefaultReplayDeliveryTimeout
DefaultReplayDeliveryTimeout limits how long replay waits to deliver into a full buffer.
A delivery timeout releases the retained-history lease.
const DefaultReplicationMaxFrameBytes = database.DefaultReplicationMaxFrameBytes
DefaultReplicationMaxFrameBytes sets the default replication frame byte limit.
const DefaultRollbackAnchorOperationTimeout = database.DefaultRollbackAnchorOperationTimeout
DefaultRollbackAnchorOperationTimeout limits how long a rollback anchor operation may delay a commit response.
const DeleteOperation = database.DeleteOperation
DeleteOperation marks a document deletion.
const DiagnosticCanceled = database.DiagnosticCanceled
DiagnosticCanceled marks a canceled operation.
const DiagnosticCommit = database.DiagnosticCommit
DiagnosticCommit marks a commit diagnostic.
const DiagnosticFailure = database.DiagnosticFailure
DiagnosticFailure marks a failed operation.
const DiagnosticQuery = database.DiagnosticQuery
DiagnosticQuery marks a query diagnostic.
const DiagnosticSuccess = database.DiagnosticSuccess
DiagnosticSuccess marks a successful operation.
const Float64Kind = database.Float64Kind
Float64Kind identifies a 64-bit float.
const IDKind = database.IDKind
IDKind identifies a document identifier.
const IndexBuildFailureCanceled = database.IndexBuildFailureCanceled
IndexBuildFailureCanceled marks a canceled index build.
const IndexBuildFailureHistoryLost = database.IndexBuildFailureHistoryLost
IndexBuildFailureHistoryLost marks a build whose required change history was lost.
const IndexBuildFailureInvalidIndex = database.IndexBuildFailureInvalidIndex
IndexBuildFailureInvalidIndex marks a build with invalid index data.
const IndexBuildFailureNone = database.IndexBuildFailureNone
IndexBuildFailureNone marks the absence of an index-build failure.
const IndexBuildFailureResourceLimit = database.IndexBuildFailureResourceLimit
IndexBuildFailureResourceLimit marks an index build that exceeded a resource limit.
const IndexBuildFailureUniqueConflict = database.IndexBuildFailureUniqueConflict
IndexBuildFailureUniqueConflict marks a duplicate key found while building a unique index.
const IndexBuildPhaseCatchUp = database.IndexBuildPhaseCatchUp
IndexBuildPhaseCatchUp marks a build applying changes after its initial snapshot.
const IndexBuildPhaseFailed = database.IndexBuildPhaseFailed
IndexBuildPhaseFailed marks a build that stopped with a terminal failure.
const IndexBuildPhaseReady = database.IndexBuildPhaseReady
IndexBuildPhaseReady marks a build ready for publication.
const IndexBuildPhaseScan = database.IndexBuildPhaseScan
IndexBuildPhaseScan marks a build scanning its initial document snapshot.
const InsertOperation = database.InsertOperation
InsertOperation marks a document insertion.
const Int64Kind = database.Int64Kind
Int64Kind identifies a signed 64-bit integer.
const NullKind = database.NullKind
NullKind identifies a null value.
const ObjectKind = database.ObjectKind
ObjectKind identifies a document object.
const PageSize = database.PageSize
PageSize sets the byte size of each storage page.
const QueryDeltaAdd = database.QueryDeltaAdd
QueryDeltaAdd inserts a document before an anchor.
const QueryDeltaChange = database.QueryDeltaChange
QueryDeltaChange replaces a document without changing its position.
const QueryDeltaMove = database.QueryDeltaMove
QueryDeltaMove moves a document before an anchor.
const QueryDeltaRemove = database.QueryDeltaRemove
QueryDeltaRemove removes a document from an ordered result.
const RecoveryAutomatic = database.RecoveryAutomatic
RecoveryAutomatic allows bounded automatic recovery when opening a database.
const RecoveryRequireClean = database.RecoveryRequireClean
RecoveryRequireClean rejects opening a database that needs recovery.
const ReplaceIndexOperation = database.ReplaceIndexOperation
ReplaceIndexOperation marks replacement of an existing index.
const ReplicationAckFrame = database.ReplicationAckFrame
ReplicationAckFrame identifies a durable replication acknowledgment.
const ReplicationBatchFrame = database.ReplicationBatchFrame
ReplicationBatchFrame identifies a replication change-batch frame.
const ReplicationHelloFrame = database.ReplicationHelloFrame
ReplicationHelloFrame identifies a replication handshake frame.
const ReplicationProtocolVersion = database.ReplicationProtocolVersion
ReplicationProtocolVersion identifies the protocol for replicating commits between trusted servers.
This version is separate from the browser realtime subscription protocol.
const ReplicationResyncFrame = database.ReplicationResyncFrame
ReplicationResyncFrame identifies a request to rebuild a replica from a snapshot.
const StorageFormatCurrent = database.StorageFormatCurrent
StorageFormatCurrent identifies the supported database file format.
const StorageFormatUnknown = database.StorageFormatUnknown
StorageFormatUnknown identifies a missing or empty database file.
const StringKind = database.StringKind
StringKind identifies a string.
const TimeKind = database.TimeKind
TimeKind identifies a timestamp.
const UpdateOperation = database.UpdateOperation
UpdateOperation marks a document update.
Variables ¶
var DefaultQueryLimits = database.DefaultQueryLimits
DefaultQueryLimits provides the default query input limits.
var ErrBackupDestinationExists = database.ErrBackupDestinationExists
ErrBackupDestinationExists reports that the backup destination already exists or is the source.
var ErrBackupUnsupported = database.ErrBackupUnsupported
ErrBackupUnsupported reports that physical backup requires an open durable database.
var ErrClosed = database.ErrClosed
ErrClosed reports that the database is closed.
var ErrCommitOutcomeUnknown = database.ErrCommitOutcomeUnknown
ErrCommitOutcomeUnknown means cancellation or a lost caller connection raced an already-admitted durable write.
Callers must reconcile by the returned document ID(s), rather than retrying business logic blindly.
var ErrCompactionDestinationExists = database.ErrCompactionDestinationExists
ErrCompactionDestinationExists reports that the compaction destination already exists.
var ErrCompactionUnsupported = database.ErrCompactionUnsupported
ErrCompactionUnsupported reports that compaction requires an open durable database.
var ErrCompoundIndexUnsupported = database.ErrCompoundIndexUnsupported
ErrCompoundIndexUnsupported reports that compound or descending indexes are unsupported.
var ErrCorrupt = database.ErrCorrupt
ErrCorrupt reports database corruption.
var ErrDatabaseIdentity = database.ErrDatabaseIdentity
ErrDatabaseIdentity reports an unexpected database identity.
var ErrDatabaseLocked = database.ErrDatabaseLocked
ErrDatabaseLocked reports that the database is locked by another process.
var ErrDestinationExists = database.ErrDestinationExists
ErrDestinationExists reports that the destination already exists.
var ErrDiagnosticsActive = database.ErrDiagnosticsActive
ErrDiagnosticsActive reports that a diagnostics session is already active.
var ErrDuplicateID = database.ErrDuplicateID
ErrDuplicateID reports a duplicate document ID.
var ErrDuplicateKey = database.ErrDuplicateKey
ErrDuplicateKey reports a duplicate index key.
var ErrDurability = database.ErrDurability
ErrDurability reports a durability failure that disables writes.
var ErrDurableConsumerExists = database.ErrDurableConsumerExists
ErrDurableConsumerExists reports that the durable change consumer already exists.
var ErrDurableConsumerNotFound = database.ErrDurableConsumerNotFound
ErrDurableConsumerNotFound reports that the durable change consumer was not found.
var ErrDurableConsumerUnsupported = database.ErrDurableConsumerUnsupported
ErrDurableConsumerUnsupported reports that durable change consumers require a durable database.
var ErrHistoryLost = database.ErrHistoryLost
ErrHistoryLost reports that the requested history is no longer retained.
var ErrImmutableID = database.ErrImmutableID
ErrImmutableID reports that _id is immutable.
var ErrIndexBuildExists = database.ErrIndexBuildExists
ErrIndexBuildExists reports that the index build already exists.
var ErrIndexBuildFailed = database.ErrIndexBuildFailed
ErrIndexBuildFailed reports that the index build is in a terminal failed state.
var ErrIndexBuildNotFound = database.ErrIndexBuildNotFound
ErrIndexBuildNotFound reports that the index build was not found.
var ErrIndexBuildSchedulerRunning = database.ErrIndexBuildSchedulerRunning
ErrIndexBuildSchedulerRunning reports that the index build scheduler is already running.
var ErrIndexBuildUnsupported = database.ErrIndexBuildUnsupported
ErrIndexBuildUnsupported reports that resumable index builds require a durable database.
var ErrInsecureFileMode = database.ErrInsecureFileMode
ErrInsecureFileMode reports that the database file permissions are not owner-private.
var ErrInvalidCollection = database.ErrInvalidCollection
ErrInvalidCollection reports an invalid collection name.
var ErrInvalidCommitCoordinatorOptions = database.ErrInvalidCommitCoordinatorOptions
ErrInvalidCommitCoordinatorOptions reports invalid commit coordinator options.
var ErrInvalidDelta = database.ErrInvalidDelta
ErrInvalidDelta reports an invalid query delta.
var ErrInvalidDocument = database.ErrInvalidDocument
ErrInvalidDocument reports an invalid document.
var ErrInvalidFilter = database.ErrInvalidFilter
ErrInvalidFilter reports an invalid filter.
var ErrInvalidIndex = database.ErrInvalidIndex
ErrInvalidIndex reports an invalid index definition.
var ErrInvalidIndexBuildSchedulerOptions = database.ErrInvalidIndexBuildSchedulerOptions
ErrInvalidIndexBuildSchedulerOptions reports invalid index build scheduler options.
var ErrInvalidReclamationOptions = database.ErrInvalidReclamationOptions
ErrInvalidReclamationOptions reports invalid reclamation options.
var ErrInvalidReplayDeliveryTimeout = database.ErrInvalidReplayDeliveryTimeout
ErrInvalidReplayDeliveryTimeout reports invalid replay delivery timeout.
var ErrInvalidResourceLimits = database.ErrInvalidResourceLimits
ErrInvalidResourceLimits reports invalid resource limits.
var ErrInvalidRollbackProtection = database.ErrInvalidRollbackProtection
ErrInvalidRollbackProtection reports invalid rollback protection options.
var ErrInvalidUpdate = database.ErrInvalidUpdate
ErrInvalidUpdate reports an invalid update.
var ErrLogicalArchiveDestinationExists = database.ErrLogicalArchiveDestinationExists
ErrLogicalArchiveDestinationExists reports that the logical archive destination already exists or is the source.
var ErrLogicalArchiveUnsupported = database.ErrLogicalArchiveUnsupported
ErrLogicalArchiveUnsupported reports that logical archive requires an open durable database.
var ErrMutationLimit = database.ErrMutationLimit
ErrMutationLimit reports that a mutation exceeded its affected-row limit.
var ErrNotFound = database.ErrNotFound
ErrNotFound reports that the document was not found.
var ErrPrimaryWriteFence = database.ErrPrimaryWriteFence
ErrPrimaryWriteFence reports that the primary write fence rejected the commit.
var ErrQueryBudget = database.ErrQueryBudget
ErrQueryBudget reports that one query exceeded an execution-work budget.
Callers can use errors.Is to distinguish this from invalid query input.
var ErrReclamationConflict = database.ErrReclamationConflict
ErrReclamationConflict reports that the online reclamation conflicted with concurrent writes.
var ErrReclamationUnsupported = database.ErrReclamationUnsupported
ErrReclamationUnsupported reports that page reclamation requires an open durable database.
var ErrRecoveryRequired = database.ErrRecoveryRequired
ErrRecoveryRequired reports that the selected policy requires startup recovery.
var ErrReplicaPromoted = database.ErrReplicaPromoted
ErrReplicaPromoted reports that the follower has been promoted and no longer accepts replication.
var ErrReplicaPromotionAuthority = database.ErrReplicaPromotionAuthority
ErrReplicaPromotionAuthority reports that the follower promotion requires an external fencing authority.
var ErrReplicaPromotionFence = database.ErrReplicaPromotionFence
ErrReplicaPromotionFence reports that the follower promotion fence does not match local state.
var ErrReplicaPromotionWriteFence = database.ErrReplicaPromotionWriteFence
ErrReplicaPromotionWriteFence reports that the follower promotion requires a configured primary write fence.
var ErrReplicaProtocol = database.ErrReplicaProtocol
ErrReplicaProtocol reports an invalid replication protocol frame.
var ErrReplicaReadOnly = database.ErrReplicaReadOnly
ErrReplicaReadOnly reports that the follower is read-only.
var ErrReplicaSequence = database.ErrReplicaSequence
ErrReplicaSequence reports that the follower change token is not the next sequence.
var ErrReplicaSourceActive = database.ErrReplicaSourceActive
ErrReplicaSourceActive reports that the replication source consumer already has an active session.
var ErrResourceLimit = database.ErrResourceLimit
ErrResourceLimit reports that an operation exceeded a resource limit.
var ErrRollbackAnchor = database.ErrRollbackAnchor
ErrRollbackAnchor reports a failure to persist the rollback anchor.
var ErrRollbackAnchorRequired = database.ErrRollbackAnchorRequired
ErrRollbackAnchorRequired reports that the rollback anchor is missing; explicit initialization is required.
var ErrRollbackDetected = database.ErrRollbackDetected
ErrRollbackDetected reports that the database was rolled back.
var ErrSlowConsumer = database.ErrSlowConsumer
ErrSlowConsumer reports that the change consumer is too slow.
var ErrUnsupportedFormat = database.ErrUnsupportedFormat
ErrUnsupportedFormat reports an unsupported storage format or required feature.
var ErrVerificationUnsupported = database.ErrVerificationUnsupported
ErrVerificationUnsupported reports that verification requires an existing database.
var ErrWriteConflict = database.ErrWriteConflict
ErrWriteConflict reports that the write transaction snapshot conflicted.
var ErrWriteTransactionUnsupported = database.ErrWriteTransactionUnsupported
ErrWriteTransactionUnsupported reports that write transactions require a durable database.
Functions ¶
func MarshalQuerySpecJSON ¶
MarshalQuerySpecJSON validates a query and encodes its canonical JSON representation.
The encoded query is used for transport fingerprints and cross-language conformance.
func MarshalReplicationFrame ¶
func MarshalReplicationFrame(frame ReplicationFrame, limits ReplicationFrameLimits) ([]byte, error)
MarshalReplicationFrame validates and encodes a replication message as bounded JSON.
Document images use base64 of the storage-independent typed document codec. It is suitable for WebSocket binary/text messages, QUIC streams or framed RPC, but it does not provide authentication or encryption itself.
func MarshalWireDocument ¶
MarshalWireDocument encodes a document as typed wire JSON.
func MarshalWireValue ¶
MarshalWireValue encodes a typed value as wire JSON.
func ValidateStrictJSON ¶
ValidateStrictJSON rejects oversized, trailing, deeply nested, and duplicate-key JSON before a transport decodes it into structs or maps.
Types ¶
type ArchiveBootstrap ¶
type ArchiveBootstrap = database.ArchiveBootstrap
ArchiveBootstrap binds an exact verified physical snapshot to the durable database change feed that was pinned before that snapshot began.
A receiver must persist and verify Backup, then drain and Ack every batch up through SnapshotToken without applying it (the snapshot already contains those effects). It can then apply and Ack later batches in order. This avoids the bootstrap/tail gap without inventing a second, weaker history contract.
type BackupResult ¶
type BackupResult = database.BackupResult
BackupResult records the identity, size, and checksum of a physical backup.
func ImportPhysicalBackup ¶
func ImportPhysicalBackup(ctx context.Context, source io.Reader, destination string, expected BackupResult, options PhysicalBackupImportOptions) (BackupResult, error)
ImportPhysicalBackup verifies a physical backup stream and publishes it at a new path.
It writes a private temporary file, checks the claimed byte count and SHA-256 while streaming, verifies the stored page structure and index contents, then publishes without overwriting an existing file and syncs the directory.
source is intentionally transport-neutral. A WebSocket, HTTP response, QUIC stream, or removable-media reader may supply it, but transport cancellation must close or honor ctx itself: a generic io.Reader cannot be interrupted while blocked in Read. The destination is never opened as a writable DB by this function; callers normally open the successfully imported file through OpenFollower before applying a replication tail.
type BackupStats ¶
type BackupStats = database.BackupStats
BackupStats reports backup activity, sizes, and outcomes.
type ChangeBatch ¶
type ChangeBatch = database.ChangeBatch
ChangeBatch groups changes under one ordered commit token.
type Collection ¶
type Collection = database.Collection
Collection provides document operations for one named collection.
type CommitCoordinatorOptions ¶
type CommitCoordinatorOptions = database.CommitCoordinatorOptions
CommitCoordinatorOptions sets the queue and batch limits for optional grouped writes.
Grouping is disabled by default.
A coordinator group publishes one stored database version but retains one logical commit token for every admitted write request, including prepared public write transactions. Index builds and other maintenance operations remain exclusive commits. When rollback protection is configured, the coordinator advances the external anchor after the group's stored version is durable and before acknowledging any member.
type CommitCoordinatorStats ¶
type CommitCoordinatorStats = database.CommitCoordinatorStats
CommitCoordinatorStats reports queued writes, admission decisions, and commit groups.
DBStats and the versioned admin schema expose these bounded counters so applications can alert on queue pressure without inspecting the queue.
type CommitRetentionPolicy ¶
type CommitRetentionPolicy = database.CommitRetentionPolicy
CommitRetentionPolicy limits retained history by commit count and encoded byte size.
Zero fields select production defaults. Active replay leases may temporarily exceed either budget rather than losing history under a reader.
type CommitStats ¶
type CommitStats = database.CommitStats
CommitStats counts committed batches and their changes.
type CompactionOptions ¶
type CompactionOptions = database.CompactionOptions
CompactionOptions sets storage and resource limits for a rewritten database.
ResourceLimits govern transient index construction as well as the reopened destination handle; zero fields select production defaults.
type CompactionStats ¶
type CompactionStats = database.CompactionStats
CompactionStats reports compaction activity, byte counts, and outcomes.
type DB ¶
DB owns an in-memory or durable document database.
func NewWithOptions ¶
func NewWithOptions(options DatabaseOptions) (*DB, error)
NewWithOptions creates an in-memory database with explicit resource limits.
func OpenWithOptions ¶
func OpenWithOptions(path string, options OpenOptions) (*DB, error)
OpenWithOptions creates or opens a durable database with explicit storage and resource options.
type DBStats ¶
DBStats is a point-in-time, allocation-bounded view of database health.
Counters are process-lifetime values and reset when the database is reopened. Persistent state such as CommitSequence is read from the database itself.
Stats deliberately exposes no user values, document IDs, query parameters, or callbacks. It is safe for an admin sampler to call periodically, but it is not intended to be called on every database operation.
type DatabaseOptions ¶
type DatabaseOptions = database.DatabaseOptions
DatabaseOptions configures an in-memory database.
type DeleteResult ¶
type DeleteResult = database.DeleteResult
DeleteResult reports how many documents were deleted.
type DiagnosticEvent ¶
type DiagnosticEvent = database.DiagnosticEvent
DiagnosticEvent records one operation's timing, outcome, and work counters.
type DiagnosticKind ¶
type DiagnosticKind = database.DiagnosticKind
DiagnosticKind identifies the operation recorded by a diagnostic event.
type DiagnosticOutcome ¶
type DiagnosticOutcome = database.DiagnosticOutcome
DiagnosticOutcome identifies how a recorded operation ended.
type DiagnosticSnapshot ¶
type DiagnosticSnapshot = database.DiagnosticSnapshot
DiagnosticSnapshot captures a diagnostics session's counters and retained events.
type DiagnosticStats ¶
type DiagnosticStats = database.DiagnosticStats
DiagnosticStats reports diagnostics activity and retained event counts.
type Diagnostics ¶
type Diagnostics = database.Diagnostics
Diagnostics owns a bounded ring of recorded operation events.
Close disables timing and recording but keeps retained events readable.
type DiagnosticsOptions ¶
type DiagnosticsOptions = database.DiagnosticsOptions
DiagnosticsOptions configures bounded diagnostic recording and event selection.
Defaults retain 256 events and record failures, queries taking at least 50ms, and commits taking at least 100ms. RecordAll is intended only for short development sessions. SampleEvery adds a deterministic one-in-N sample of otherwise fast successful operations.
type Document ¶
Document maps field names to typed database values.
func NewDocument ¶
NewDocument converts Go fields into a document and rejects invalid names or values.
func UnmarshalWireDocument ¶
func UnmarshalWireDocument(data []byte, limits QueryLimits) (Document, error)
UnmarshalWireDocument decodes a typed wire document with a required document ID.
func UnmarshalWireInputDocument ¶
func UnmarshalWireInputDocument(data []byte, limits QueryLimits) (Document, error)
UnmarshalWireInputDocument decodes a typed wire document whose ID may be omitted.
type DocumentCacheStats ¶
type DocumentCacheStats = database.DocumentCacheStats
DocumentCacheStats reports document-cache occupancy, hits, misses, and evictions.
type DocumentID ¶
type DocumentID = database.DocumentID
DocumentID is a 16-byte document identifier.
func NewDocumentID ¶
func NewDocumentID() (DocumentID, error)
NewDocumentID creates an identifier from cryptographically random bytes.
func ParseDocumentID ¶
func ParseDocumentID(s string) (DocumentID, error)
ParseDocumentID reads a 16-byte identifier from a hexadecimal string.
type DurabilityStats ¶
type DurabilityStats = database.DurabilityStats
DurabilityStats preserves legacy durability counters in the admin response format.
Current-format databases do not use a WAL or checkpoints, so every field is zero.
type DurableChangeBatch ¶
type DurableChangeBatch = database.DurableChangeBatch
DurableChangeBatch contains one collection's document changes at a commit token.
Changes is empty when another collection or private catalog change advanced the durable position; callers must still Ack that Token after processing it so the checkpoint can advance without pinning history forever.
This is deliberately a document-change feed, not a full replication protocol: it does not expose private System records, index definitions, collection lifecycle or raw storage bytes.
type DurableChangeSubscription ¶
type DurableChangeSubscription = database.DurableChangeSubscription
DurableChangeSubscription delivers ordered collection changes with a saved acknowledgement.
Ack must be called only after the consumer's external side effect for that token is durable.
type DurableDatabaseChangeBatch ¶
type DurableDatabaseChangeBatch = database.DurableDatabaseChangeBatch
DurableDatabaseChangeBatch contains public document and catalog changes from one commit.
Archives and single-writer followers must acknowledge Token only after the externally applied effect is durable.
Private System records, raw pages, index-build progress and retention control records are deliberately excluded. A batch can therefore be empty when a private record advanced a retained position; it must still be Acked.
type DurableDatabaseChangeSubscription ¶
type DurableDatabaseChangeSubscription = database.DurableDatabaseChangeSubscription
DurableDatabaseChangeSubscription delivers public database changes with a saved acknowledgement.
It exposes collection creation, index publication and document changes in exact Commit Log order. It does not itself copy a bootstrap snapshot or apply changes to a follower; those transport and ownership contracts are intentionally separate.
type ExplainAccessSource ¶
type ExplainAccessSource = database.ExplainAccessSource
ExplainAccessSource records the query work performed through one index or primary key path.
CandidateIDs counts document IDs processed by the deduplicator. Read-ahead needed for an ordered union remains visible in KeysExamined even when execution stops before those IDs are consumed.
type ExplainAdvice ¶
type ExplainAdvice = database.ExplainAdvice
ExplainAdvice records a possible query improvement to check against the workload.
It is not an instruction to create an index. Paths and Sort contain schema facts but never query values. Callers should validate selectivity against workload measurements.
type ExplainBound ¶
type ExplainBound = database.ExplainBound
ExplainBound describes the values that restrict one indexed field.
Values is used for equality and membership unions; range bounds use Lower and Upper. A nil range endpoint is unbounded.
type ExplainBudget ¶
type ExplainBudget = database.ExplainBudget
ExplainBudget is the final resource-budget snapshot for one execution.
Pressure and Exceeded are fixed reason codes naming one of "documents", "keys", "candidates", "sort_bytes", "skip", or "predicate_steps".
type ExplainResult ¶
type ExplainResult = database.ExplainResult
ExplainResult describes the query plan and the work measured during execution.
Estimated fields are conservative candidate estimates when the selected backend can provide them; DocumentsExamined and KeysExamined are the actual completed scan counts. ResidualPredicate means the complete compiled predicate is rechecked after index admission, including when the index appears to cover every condition.
type Follower ¶
Follower owns a read-only local database advanced by validated source change batches.
Transport authentication and snapshot transfer are managed outside this type; promotion requires the external authority and write guard described below.
func OpenFollower ¶
func OpenFollower(path string, options OpenOptions) (*Follower, error)
OpenFollower opens a database copy as a read-only replica.
Normal public mutations on DB return ErrReplicaReadOnly; use Apply to advance the next source token. The returned DB remains fully queryable and reactive.
type FollowerPromotionAuthority ¶
type FollowerPromotionAuthority = database.FollowerPromotionAuthority
FollowerPromotionAuthority grants promotion after durably revoking the former primary's write authority.
Implementations normally revoke a primary lease through a quorum controller or external consensus store.
type FollowerPromotionFence ¶
type FollowerPromotionFence = database.FollowerPromotionFence
FollowerPromotionFence proves that the former primary lost write authority for this database version.
Epoch is non-empty and deliberately opaque to Meldbase: a controller may use it as an epoch ID or a compact signed lease certificate (as integrations/primarylease does). Meldbase does not invent a local substitute for that distributed safety decision.
type FollowerPromotionFenceBinder ¶
type FollowerPromotionFenceBinder = database.FollowerPromotionFenceBinder
FollowerPromotionFenceBinder connects a promotion certificate to the local write protection guard.
The binder may update caller-owned local lease/epoch state, but must not enable writes until it has accepted the exact fence. It runs on the promotion control path, outside the DB writer lock; unlike ValidatePrimaryWrite it may coordinate with the controller if the implementation needs to.
A promoted follower requires this interface in addition to PrimaryWriteFence. Otherwise an unrelated always-allow guard could make a one-time promotion certificate appear to grant permanent write authority.
type FollowerPromotionRequest ¶
type FollowerPromotionRequest = database.FollowerPromotionRequest
FollowerPromotionRequest identifies the database version requesting permission to become writable.
type IndexBuildFailure ¶
type IndexBuildFailure = database.IndexBuildFailure
IndexBuildFailure identifies why an index build stopped permanently.
type IndexBuildID ¶
type IndexBuildID = database.IndexBuildID
IndexBuildID identifies one durable, resumable Storage index build.
func ParseIndexBuildID ¶
func ParseIndexBuildID(value string) (IndexBuildID, error)
ParseIndexBuildID parses a hexadecimal index-build identifier.
type IndexBuildPhase ¶
type IndexBuildPhase = database.IndexBuildPhase
IndexBuildPhase identifies the current stage of a resumable index build.
type IndexBuildScheduler ¶
type IndexBuildScheduler = database.IndexBuildScheduler
IndexBuildScheduler runs resumable index builds in bounded background tasks.
type IndexBuildSchedulerOptions ¶
type IndexBuildSchedulerOptions = database.IndexBuildSchedulerOptions
IndexBuildSchedulerOptions configures polling, time slices, and build concurrency.
The scheduler must be started explicitly; each task yields durable progress between bounded time slices so document writes and other builds can proceed.
type IndexBuildSchedulerStats ¶
type IndexBuildSchedulerStats = database.IndexBuildSchedulerStats
IndexBuildSchedulerStats reports background index-build activity and outcomes.
type IndexBuildStats ¶
type IndexBuildStats = database.IndexBuildStats
IndexBuildStats reports index-build progress, resource use, and outcomes.
type IndexBuildStatus ¶
type IndexBuildStatus = database.IndexBuildStatus
IndexBuildStatus reports the stored progress and outcome of a resumable index build.
EntryCount and CanonicalBytes describe the pending index tree, not transient Go heap usage.
type IndexCatalogEntry ¶
type IndexCatalogEntry = database.IndexCatalogEntry
IndexCatalogEntry describes a published index without exposing document data.
Index management remains a deployment concern; this catalog supports CLIs and protected operator views.
type IndexDefinition ¶
type IndexDefinition = database.IndexDefinition
IndexDefinition describes the ordered fields and uniqueness of an index.
type IndexField ¶
type IndexField = database.IndexField
IndexField selects a field and its sort direction within an index.
Order must be 1 (ascending) or -1 (descending); fields are evaluated left to right.
type IndexOptions ¶
type IndexOptions = database.IndexOptions
IndexOptions controls complete-tuple uniqueness.
type LogicalArchiveImportOptions ¶
type LogicalArchiveImportOptions = database.LogicalArchiveImportOptions
LogicalArchiveImportOptions limits the size of an archive accepted for import.
Zero MaxBytes selects the normal storage-file limit; the receiver owns this cap.
type LogicalArchiveResult ¶
type LogicalArchiveResult = database.LogicalArchiveResult
LogicalArchiveResult records archive counts, byte size, and checksum.
SHA256 covers every JSONL record before the final end record; the end record stores the same digest so an importer can reject truncation or alteration.
func ImportLogicalArchive ¶
func ImportLogicalArchive(ctx context.Context, source io.Reader, destination string, options LogicalArchiveImportOptions) (result LogicalArchiveResult, resultErr error)
ImportLogicalArchive creates a new database from a validated logical archive.
Import and offline verification run in a private temporary database before atomic publication, so a malformed archive leaves no destination database.
type Maintenance ¶
type Maintenance = database.Maintenance
Maintenance runs background tasks that make unused database pages reusable.
Stop waits for an active scan to observe cancellation; closing the database also cancels the loop.
type MaintenanceOptions ¶
type MaintenanceOptions = database.MaintenanceOptions
MaintenanceOptions sets the schedule and limits for background page reclamation.
Each loop uses online optimistic reclamation and never overlaps its own runs.
type MaintenanceStats ¶
type MaintenanceStats = database.MaintenanceStats
MaintenanceStats counts background page reclamation runs and records their outcomes.
type MutationSpec ¶
type MutationSpec = database.MutationSpec
MutationSpec holds a compiled document update.
func CompileUpdate ¶
func CompileUpdate(update Update) (MutationSpec, error)
CompileUpdate validates update operators and produces a reusable mutation.
func DecodeMutationSpecJSON ¶
func DecodeMutationSpecJSON(data []byte, limits QueryLimits) (MutationSpec, error)
DecodeMutationSpecJSON validates and decodes a data-only mutation within the supplied limits.
type OpenOptions ¶
type OpenOptions = database.OpenOptions
OpenOptions configures the current durable storage format.
type OperationalState ¶
type OperationalState = database.OperationalState
OperationalState is a minimal, allocation-free serving-state snapshot.
A fail-stop durability error preserves reads from the last committed state but disables writes; a closed database is neither readable nor writable.
type PageCacheStats ¶
type PageCacheStats = database.PageCacheStats
PageCacheStats reports page-cache occupancy, hits, misses, and evictions.
type PhysicalBackupImportOptions ¶
type PhysicalBackupImportOptions = database.PhysicalBackupImportOptions
PhysicalBackupImportOptions limits the bytes accepted from a physical backup stream.
Zero selects the normal file limit. Deployments with a deliberately larger database must set MaxBytes explicitly on the receiving side; a sender never chooses that authority.
type PrimaryWriteFence ¶
type PrimaryWriteFence = database.PrimaryWriteFence
PrimaryWriteFence checks whether an external authority still permits a local write.
Its implementation normally checks an atomically refreshed lease epoch and expiry, not the network. Returning an error rejects the whole logical commit before storage mutation; it never poisons the database or advances a token.
Implementations must not call back into DB and must return promptly: the check runs while the writer has admitted a commit. Election, renewal, certificate rotation and old-primary revocation remain external concerns.
type PrimaryWriteFenceRequest ¶
type PrimaryWriteFenceRequest = database.PrimaryWriteFenceRequest
PrimaryWriteFenceRequest identifies the database and next commit requiring write authority.
A lease implementation must reject when its external authority/epoch/expiry no longer permits that write.
type PrimaryWriteFenceStats ¶
type PrimaryWriteFenceStats = database.PrimaryWriteFenceStats
PrimaryWriteFenceStats reports whether write protection is active and counts its checks and rejections.
Configured means a guard was supplied at open; Enforced is false while a read-only follower applies validated source history. Checks and Rejected count only actual primary write admissions. No lease, epoch, endpoint, database ID, or controller detail is exposed.
type QueryDelta ¶
type QueryDelta = database.QueryDelta
QueryDelta transforms exactly FromToken into Token.
Operations are ordered: removals first, followed by reverse-order add/move anchors and document changes. Applying them in slice order is deterministic.
type QueryDeltaOperation ¶
type QueryDeltaOperation = database.QueryDeltaOperation
QueryDeltaOperation mutates an ordered query result.
A zero BeforeID means the end of the result; database document IDs are never zero.
type QueryDeltaOperationKind ¶
type QueryDeltaOperationKind = database.QueryDeltaOperationKind
QueryDeltaOperationKind identifies a change to an ordered query result.
type QueryDeltaSubscription ¶
type QueryDeltaSubscription = database.QueryDeltaSubscription
QueryDeltaSubscription returns one safe initial snapshot and then ordered deltas.
It is the preferred core stream for transports and reactive clients; QuerySubscription remains the full-snapshot compatibility adapter.
type QueryLimits ¶
type QueryLimits = database.QueryLimits
QueryLimits bounds the size and complexity of accepted queries.
type QueryOptions ¶
type QueryOptions = database.QueryOptions
QueryOptions configures query sorting and pagination.
type QueryReplaySource ¶
type QueryReplaySource = database.QueryReplaySource
QueryReplaySource atomically reconstructs a query at afterToken and tails later ordered revisions.
Initial.Token must equal afterToken. Implementations return ErrHistoryLost when retention can no longer satisfy that contract.
type QueryReplaySubscription ¶
type QueryReplaySubscription = database.QueryReplaySubscription
QueryReplaySubscription provides a historical query snapshot and its later changes.
type QuerySnapshot ¶
type QuerySnapshot = database.QuerySnapshot
QuerySnapshot pairs an ordered query result with its commit token.
func ApplyQueryDelta ¶
func ApplyQueryDelta(snapshot QuerySnapshot, delta QueryDelta) (QuerySnapshot, error)
ApplyQueryDelta strictly validates and applies an ordered delta without mutating the input snapshot.
type QuerySpec ¶
QuerySpec holds a compiled filter with sorting and pagination.
func CompileQuery ¶
func CompileQuery(filter Filter, options QueryOptions) (QuerySpec, error)
CompileQuery validates a filter and options to produce a reusable query.
func DecodeQuerySpecJSON ¶
func DecodeQuerySpecJSON(data []byte, limits QueryLimits) (QuerySpec, error)
DecodeQuerySpecJSON validates and decodes a data-only query within the supplied limits.
type QueryStats ¶
type QueryStats = database.QueryStats
QueryStats counts query activity and execution work during the current process session.
Physical key and candidate counters include work completed before a failed query; the older document/return counters retain their successful-query contract.
type QuerySubscription ¶
type QuerySubscription = database.QuerySubscription
QuerySubscription provides full query snapshots as the result changes.
type RealtimeStats ¶
type RealtimeStats = database.RealtimeStats
RealtimeStats reports live query activity, queued work, and overloads.
type ReclaimOptions ¶
type ReclaimOptions = database.ReclaimOptions
ReclaimOptions configures page-reclamation mode, retries, and persistence.
Online scans a duplicate read handle without the storage writer lock and installs its result only if the Meta generation is unchanged. MaxAttempts bounds complete graph rescans after concurrent commits; zero selects three attempts.
type ReclaimResult ¶
type ReclaimResult = database.ReclaimResult
ReclaimResult reports reachable and reusable pages after reclamation.
type ReclamationStats ¶
type ReclamationStats = database.ReclamationStats
ReclamationStats reports page-reclamation activity and outcomes.
type RecoveryMode ¶
type RecoveryMode = database.RecoveryMode
RecoveryMode selects whether startup may perform bounded recovery actions.
Zero selects automatic recovery; RecoveryReport describes completed actions.
type RecoveryReport ¶
type RecoveryReport = database.RecoveryReport
RecoveryReport records completed startup recovery actions without exposing sensitive data.
It reports only actions that were completed before Open returned successfully; corruption and unsupported formats still fail Open instead of being described as recovered.
type ReplicationFrame ¶
type ReplicationFrame = database.ReplicationFrame
ReplicationFrame carries a handshake, change batch, acknowledgement, or resync request.
A transport must authenticate both peers (for example with mTLS) before it accepts frames; DatabaseID binds every frame to one durable source identity.
func UnmarshalReplicationFrame ¶
func UnmarshalReplicationFrame(data []byte, limits ReplicationFrameLimits) (ReplicationFrame, error)
UnmarshalReplicationFrame validates and decodes a bounded JSON replication message.
It rejects unknown fields, duplicate keys, malformed base64, invalid typed documents, and non-canonical identities before the follower receives a batch.
type ReplicationFrameLimits ¶
type ReplicationFrameLimits = database.ReplicationFrameLimits
ReplicationFrameLimits caps the size of a decompressed replication message.
The default accommodates the configured 64 MiB canonical transaction limit plus JSON/base64 overhead, while still rejecting unbounded peer allocation.
type ReplicationSourceLease ¶
type ReplicationSourceLease = database.ReplicationSourceLease
ReplicationSourceLease reserves a replica consumer for one session in this process.
It prevents sessions from racing the same checkpoint and does not replace external primary election or follower-promotion fencing.
type ReplicationSourceSession ¶
type ReplicationSourceSession = database.ReplicationSourceSession
ReplicationSourceSession sends committed database changes to one authenticated receiver.
Only one batch may await acknowledgement at a time, limiting queued work and preventing acknowledgement of an unseen source token.
func NewReplicationSourceSession ¶
func NewReplicationSourceSession(db *DB, subscription *DurableDatabaseChangeSubscription, limits ReplicationFrameLimits) (*ReplicationSourceSession, error)
NewReplicationSourceSession creates a replication session from a named database change feed.
The caller authenticates the receiver and must close the session when that authenticated connection ends.
type ResourceLimits ¶
type ResourceLimits = database.ResourceLimits
ResourceLimits bounds work admitted by writes, index maintenance, and query execution.
Zero values select production defaults; limits cannot be disabled accidentally. Byte limits use the canonical typed binary representation, independent of Go heap layout, JSON spelling, storage generation, or transport compression.
type ResourceStats ¶
type ResourceStats = database.ResourceStats
ResourceStats reports configured resource limits and rejection counts.
type RollbackAnchor ¶
type RollbackAnchor = database.RollbackAnchor
RollbackAnchor records trusted minimum commit and generation values outside the database.
A server must never accept the same identity below either an acknowledged logical commit sequence or physical maintenance generation after restart. The coordinates are independently monotonic: one group may advance several logical sequences while publishing a single physical generation.
type RollbackAnchorStatusProvider ¶
type RollbackAnchorStatusProvider = database.RollbackAnchorStatusProvider
RollbackAnchorStatusProvider exposes anchor store counters without acquiring locks.
type RollbackAnchorStore ¶
type RollbackAnchorStore = database.RollbackAnchorStore
RollbackAnchorStore loads and durably advances a database's trusted rollback boundary.
Advance must not return until the anchor is persistent and must reject identity changes or regression of either monotonic coordinate. Implementations must be safe for concurrent callers and honor cancellation. An Advance error does not prove that state was unchanged: persistence may have completed before a response, deadline or cancellation was observed.
func NewFileRollbackAnchorStore ¶
func NewFileRollbackAnchorStore(path string) (RollbackAnchorStore, error)
NewFileRollbackAnchorStore creates a file-backed store for trusted database version limits.
Updates replace the anchor atomically and reject invalid saved state. The parent directory must exist on storage trusted independently from the database.
type RollbackAnchorStoreStatus ¶
type RollbackAnchorStoreStatus = database.RollbackAnchorStoreStatus
RollbackAnchorStoreStatus reports anchor backend counters without exposing database identities.
These diagnostic counters never participate in recovery.
type RollbackProtection ¶
type RollbackProtection = database.RollbackProtection
RollbackProtection configures identity and progress checks that reject database rollback.
AnchorStore should live on an independently trusted device or remote quorum; placing it beside the database cannot detect whole-device rollback. InitializeAnchor explicitly trusts the database currently at Path when the store is empty and should only be used during provisioning or audited restore.
type SortField ¶
SortField specifies a document path and its ascending or descending sort direction.
type StorageFormat ¶
type StorageFormat = database.StorageFormat
StorageFormat identifies the supported file format or an absent database.
Unknown denotes a missing or zero-length path, not an unrecognized non-empty file.
func DetectStorageFormat ¶
func DetectStorageFormat(path string) (StorageFormat, error)
DetectStorageFormat distinguishes an absent database from a recognized database format.
Old database files deliberately fail closed: this build contains no legacy reader or automatic migration path.
type StorageFormatInfo ¶
type StorageFormatInfo = database.StorageFormatInfo
StorageFormatInfo reports file format metadata and compatibility with this reader.
ReaderCompatible says this binary understands the reported revision and all required feature bits; callers must still Open the database before use.
func InspectStorageFormat ¶
func InspectStorageFormat(path string) (StorageFormatInfo, error)
InspectStorageFormat validates current Meta checksums and reports its newest readable envelope without opening the database for mutation.
type StorageLimits ¶
type StorageLimits = database.StorageLimits
StorageLimits caps the physical database file size.
Zero selects DefaultMaxFileBytes; the limit must be a multiple of the 16 KiB page size.
type StorageStats ¶
type StorageStats = database.StorageStats
StorageStats describes the selected physical backend.
Session counters reset on reopen; physical state and cache counters come from the backend itself.
type UpdateResult ¶
type UpdateResult = database.UpdateResult
UpdateResult reports how many documents matched and changed.
type Value ¶
Value stores typed database data behind a private representation.
Private fields prevent callers from pairing a type with an incompatible payload.
func Time ¶
Time stores millisecond precision, matching JavaScript Date and the wire contract.
Precision is normalized at construction rather than silently lost during transport.
func UnmarshalWireValue ¶
func UnmarshalWireValue(data []byte, limits QueryLimits) (Value, error)
UnmarshalWireValue decodes a typed JSON value within the supplied query limits.
It applies the same nesting, item count, and size limits as query operands. Protocol arguments such as RPC inputs contain data only; decoding never runs code.
type VerificationReport ¶
type VerificationReport = database.VerificationReport
VerificationReport records the results of a read-only page and index audit.
ReclaimablePages is informational; verification never installs a free pool or publishes maintenance metadata.
func VerifyFile ¶
func VerifyFile(ctx context.Context, path string) (VerificationReport, error)
VerifyFile checks an existing database's protected pages and index contents without changing it.
It takes a non-blocking shared advisory lock, so an active writer fails with ErrDatabaseLocked. It never creates, truncates, repairs, reclaims, or advances the database. Meta inspection alone is cheaper; this method walks every page protected by both valid Meta roots, recomputes published and provable shadow Secondary keys from canonical Primary documents in both directions, and hashes the file. Legacy caught-up builds lacking an applied CatalogRoot remain readable but report IndexBuildContentsVerified=false.
type WriteTransaction ¶
type WriteTransaction = database.WriteTransaction
WriteTransaction stages reads and writes against a snapshot for an atomic commit.
Commit validation detects conflicting changes, and returned values are independent copies.
A transaction is active only during its handler callback. Handlers must not retain it or call normal DB/Collection methods from inside the callback.
type WriteTransactionStats ¶
type WriteTransactionStats = database.WriteTransactionStats
WriteTransactionStats counts active transactions and their outcomes.
Every started callback reaches exactly one terminal counter. These aggregates do not contain collection, document, actor, or callback identifiers.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package admin provides database monitoring and operator HTTP endpoints.
|
Package admin provides database monitoring and operator HTTP endpoints. |
|
cmd
|
|
|
meld
command
|
|
|
meld-power-redfish-adapter
command
|
|
|
meld-query-observer
command
|
|
|
integrations
|
|
|
anchorhttp
Package anchorhttp reads and advances rollback anchors through authenticated HTTPS members.
|
Package anchorhttp reads and advances rollback anchors through authenticated HTTPS members. |
|
authorityhttp
Package authorityhttp serves write lease grants and revocations over authenticated HTTPS.
|
Package authorityhttp serves write lease grants and revocations over authenticated HTTPS. |
|
leasehttp
Package leasehttp provides authenticated HTTPS access to one controller member's lease records.
|
Package leasehttp provides authenticated HTTPS access to one controller member's lease records. |
|
otel
Package meldotel exports sampled Meldbase statistics through OpenTelemetry metrics.
|
Package meldotel exports sampled Meldbase statistics through OpenTelemetry metrics. |
|
primarylease
Package primarylease supplies a locally verifiable, short-lived primary write lease for Meldbase deployments.
|
Package primarylease supplies a locally verifiable, short-lived primary write lease for Meldbase deployments. |
|
replicationauth
Package replicationauth verifies peer identities for server-to-server replication.
|
Package replicationauth verifies peer identities for server-to-server replication. |
|
replicationhttp
Package replicationhttp transfers verified database snapshots over HTTPS.
|
Package replicationhttp transfers verified database snapshots over HTTPS. |
|
replicationws
Package replicationws transfers database changes between trusted servers over WebSocket.
|
Package replicationws transfers database changes between trusted servers over WebSocket. |
|
internal
|
|
|
database
Package database implements the Meldbase database API behind the module-root public package.
|
Package database implements the Meldbase database API behind the module-root public package. |
|
policyrecord
Package policyrecord encodes the stored versions of server query policies.
|
Package policyrecord encodes the stored versions of server query policies. |
|
qualification
Package qualification runs operational checks and records evidence for releases.
|
Package qualification runs operational checks and records evidence for releases. |
|
storage
Package storage implements the current Meldbase copy-on-write page format.
|
Package storage implements the current Meldbase copy-on-write page format. |
|
systemrecord
Package systemrecord lets built-in services read and change private database records.
|
Package systemrecord lets built-in services read and change private database records. |
|
Package server gives applications authenticated HTTP, live-query, and RPC access to Meldbase.
|
Package server gives applications authenticated HTTP, live-query, and RPC access to Meldbase. |