tiny.sql
Overview · API · Code relationships · Verification · Audit
Overview
An embedded relational database written in Zig holds its rows in B-trees over fixed 4096-byte units of storage, called pages. A page a transaction changes is appended to the write-ahead log first, and a later checkpoint copies the committed pages into the base file, while a commit can sync the log before it returns, or leave the bytes buffered and say so. Above the pages sits a versioned history: every commit records the roots of the database's relations, so an earlier state can be read back and two states can be compared.
Two branches are brought together by a three-way merge, which compares each side against their shared ancestor, requires one schema across the ancestor and both sides, and reports SchemaMismatch otherwise. Where the two sides disagree, the merge keeps ours in the working state and records a conflict record holding the ancestor's, ours, and theirs bytes, at the row when the schemas agree and at the whole relation when the definitions diverge. The merge semantics are written out formally under verification/sql.
Definitions
Actions
Public operations.
RowSpeclockHistoryFileRemoteadvertiseHistoryRefsdeleteHistoryRemoteRefdeleteHistoryFileRemoteRefcreateHistoryFetchRequestrelationRootdatabaseRootMaintainedimportHistoryPackBytesdecodeHistoryRemoteConfigcloneHistorydecodeHistoryBranchUpstreamConfigdecodeHistoryPackexportMissingHistoryRefPackprepareRelationdecodeHistoryAdvertisementdecodeHistoryFetchRequestdatabaseRootemptyPlanParameterShapeencodeHistoryBranchUpstreamConfigencodeHistoryPackencodeHistoryRemoteConfigfetchHistoryfilePublicationArtifactpushHistoryFastForwardTocloneHistoryFileencodeHistoryAdvertisementencodeHistoryFetchRequestpullHistoryFastForwardsearchSnippetexportHistoryPackexportHistoryPackBytesfetchHistoryFilefetchHistoryPackfetchHistoryPackBytesfileArtifactpullHistoryFileFastForwardpushHistoryFastForwardexportMissingHistoryPackfilePublicationFootprintpushHistoryFileFastForwardToreadHistoryRemoteConfigwriteHistoryRemoteConfigexportHistoryPackBytesForFetchRequestexportHistoryPackForFetchRequestimportHistoryPackpushHistoryFileFastForwardreadHistoryBranchUpstreamConfigwriteHistoryBranchUpstreamConfigexportHistoryRefPackBytesexportMissingHistoryRefPackBytesfilePublicationArtifactKindexportMissingHistoryPackBytesfileArtifactsPresentfilePublicationArtifactsPresent
Types and contracts
Public types and contracts.
RowViewMetaPageFileTransactionStagingCheckpointPlanOverflowPageLifecycleWorkspace: Owns one database and the storage that database runs on, created by a tool at startup to open its database through it.RelationExecutionFileReadLeaseRowValueCapacityRowValueLimitsHistorySyncFetchRequestRelationDiffChangeRelationMergeRelationMergeConflictRelationMergeEditSearchCacheLockSearchReaderStatementBranchCommitEntryCatalogColumnDefinitionCatalogCommitCatalogIndexDefinitionCatalogIndexDistributionCatalogIndexSampleCatalogIndexStatsCatalogOptionsCatalogReadRelationHandleCatalogRelationDefinitionCatalogRelationHandleCatalogRelationNamesCatalogSchemaCatalogSessionFlushConflictKindConflictValueConnectionDatabaseViewConnectionExecuteOptionsConnectionMergeOptionsConnectionOptionsConnectionWriteOptionsDatabaseMergeConflictDatabaseSessionErrorDatabaseSessionFlushEntryErrorFileArtifactPathBytesMaxFilePublicationArtifactPathBytesMaxFileCheckpointOptionsFileCommitFileCommitDurabilityFileCommitOptionsFilePathsFilePublicationArtifactKindFilePublicationFootprintFilePublicationOptionsFilePublicationTokenFilePublishedReadOpenOptionsFileReadOpenOptionsFileReadOpenResultFileReadRepairReasonFileSparseReadOpenResultFileSparseReadOptionsFileSparseReadProbeFileSparseRefreshOptionsFileSparseRefreshResultHashHistoryBranchUpstreamConfigOptionsHistoryFileRemoteHistoryFileRemoteLockHistoryOptionsHistoryRecoveryHistoryRecoveryPolicyHistoryRemoteConfigOptionsHistorySyncAdvertisementHistorySyncPackHistorySyncStatsHistoryTruncationIndexEntryIndexRootLifecycleReadOpenResultLifecycleReadOpenedLifecycleReadOptionsLifecycleReadRefsRefreshResultLifecycleReadRepairReasonLifecycleRecoveryLifecycleSparseReadAssessmentLifecycleSparseReadBeginResultLifecycleSparseReadFinishResultLifecycleSparseReadOptionsPageEntryPageKindPagerCapacityPagerCheckpointPagerCheckpointOptionsPagerCheckpointReadersPagerInitOptionsPagerStoragePagerViewRefRelationDiffRelationDiffChangeKindRelationIndexSpecRelationMergeEditKindRelationMergeModeRelationOptionsRelationSessionFlushRowCollationRowColumnRowStorageRowValueSearchCapabilitiesSearchDocumentSearchFieldSeparatorSearchHitSearchMaxDocumentBytesSearchPostingStatsSearchPreparedSearchRankedHitSearchRankedResultsSearchRankingOptionsSearchResultsSearchSnippetOptionsSearchSourceSearchTokenSpaceOptionsSpaceRootSpecStatementCursorStatementParameterStatementResultStatsRootTableProjectionTreeProjectionTreeHashTreeNodeTreeNodeKindTreeRootTreeScanEntryTreeScanStatsTreeSummaryTreeWriteOptionsLeafPageBranchPageStoreRowValueStorageTableValueStorageRelationReadDatabaseMergeRelationTableEntryWalWriterWalReaderWriteSnapshotPagerFileSparseReadOnlyDatabaseFileDatabase: An open database over its two files, held for as long as a caller uses the database to read and write through the scopes it hands out.TreeHistoryCommitCatalogConnectionSearchConflictRootConflictArtifactTreeWriteTreeRangeDatabaseRootDatabaseSessionFileReadCacheFileDatabaseWorkspace: The reusable storage an open database runs on, built once by a caller so that the pager, the caches, and the paths for every database opened through it come from storage laid out in advance.TableScanTreeScanRowIdTableRelationRelationSessionFileTransactionIndexPreparedPlanKeyRelationSchemaBranchCheckoutWorkingSetCatalogReaderRelationRootHistoryRemoteConfigHistoryRemoteConfigEntryFileReadOnlyDatabaseFileSnapshotSpaceHistoryBranchUpstreamConfigEntryRelationValueConflictEntryHistoryBranchUpstreamConfigCatalogRelationStatsPagerSnapshotPreparedStatementDatabaseWritePreparedRelationLifecycleSparseReadSessionDatabaseValueIndexScanConnectionRelationViewHistoryConflictArtifactsHistoryConflictEntriesLazyHistoryDatabaseMerge
Namespaces
Public namespaces.
rowtracerecordlatticepagestorekeywalpagerindexversiontreesyncconnectioncatalogmergerelationtableplanlifecyclebranchspacediffhistoryblamechunkstatementsearchsessionrepository
Values and defaults
Public values and defaults.
Code relationships
Direct static dependencies extracted from parsed source by semantic graph analysis.
Uses: alloc_phase, tiny.accy, tiny.bench, tiny.bumpalo, tiny.chant, tiny.choir, tiny.coz, tiny.glom, tiny.hypothesis, tiny.sdfii, tiny.smg, tiny.sys, tiny.tldr, tiny.trace, tiny.tracy, tiny.wayland, tiny.zen
Used by: tiny.bumpalo, tiny.choir, tiny.closure, tiny.glom, tiny.gpalloc, tiny.machine, tiny.pluck, tiny.preserves, tiny.smg, tiny.trace
Verification
No verification records are cataloged for this module in this build.
Audit
| Evidence | Value |
|---|---|
| Source | lib/sql/src/root.zig |
| Definitions | 3 of 286 documented |
| Members | 0 of 0 documented |
| Public names | 289 API, 2572 indexed |
| Version | 26.7.0 |
| Revision | daab053ee433 |
| Unresolved targets | 9 |