API reference › @evolu/common › local‑first/Storage
Encrypted storage layer for local-first data.
Core
| Interface | Description |
|---|---|
| Storage | Evolu Storage. |
| StorageConfig | Configuration for Storage, such as quota checks. |
| StorageDep | Dependency wrapper for Storage. |
| StorageQuotaError | Error when storage or billing quota is exceeded. |
Messages
| Name | Description |
|---|---|
| CrdtMessage | A CRDT message combining a unique Timestamp with a DbChange. |
| DbChange | A DbChange is a change to a table row. Together with a unique Timestamp, it forms a CrdtMessage. |
| EncryptedCrdtMessage | An encrypted CrdtMessage. |
| ValidDbChangeValuesError | Error produced when DbChangeValues contain reserved system columns. |
| DbChangeValues | Column values of a DbChange, keyed by column name. |
| EncryptedDbChange | Encrypted DbChange |
| ValidDbChangeValues | Column values that contain no reserved system columns. |
| DbChange | A DbChange is a change to a table row. Together with a unique Timestamp, it forms a CrdtMessage. |
| DbChangeValues | Column values of a DbChange, keyed by column name. |
| ValidDbChangeValues | Column values that contain no reserved system columns. |
Ranges
| Name | Description |
|---|---|
| BaseRange | Common shape of every Range. |
| FingerprintRange | Range summarized by a Fingerprint for comparison. |
| SkipRange | Range with nothing to reconcile. |
| TimestampsRange | Range listing its TimestampBytes explicitly. |
| Fingerprint | A cryptographic hash used for efficiently comparing collections of TimestampByteses. |
| InfiniteUpperBound | Type of the InfiniteUpperBound sentinel. |
| Range | Range exchanged during sync: SkipRange, FingerprintRange, or TimestampsRange. |
| RangeType | Numeric tag of one Range variant. |
| RangeUpperBound | Union type for Range's upperBound: either a TimestampBytes or InfiniteUpperBound. |
| fingerprintSize | Number of leading SHA-256 bytes that form a Fingerprint. |
| InfiniteUpperBound | Sentinel RangeUpperBound for a range without an upper limit. |
| RangeType | Numeric tags discriminating Range variants. |
| zeroFingerprint | A fingerprint of an empty range. |
| timestampBytesToFingerprint | Computes the Fingerprint of a single timestamp. |
SQLite
| Name | Description |
|---|---|
| BaseSqliteStorage | Common interface for both client and relay SQLite storages. |
| BaseSqliteStorageDep | Dependency wrapper for BaseSqliteStorage. |
| SqliteStorageDeps | Dependencies required by createBaseSqliteStorage. |
| StorageInsertTimestampStrategy | Position at which a timestamp is inserted relative to existing timestamps. |
| createBaseSqliteStorage | Creates a BaseSqliteStorage implementation. |
| createBaseSqliteStorageTables | Creates the SQLite tables used by BaseSqliteStorage. |
| getTimestampByIndex | Reads the timestamp at a position within an owner's ordered timestamps. |
| getTimestampInsertStrategy | Determines the insertion strategy for a timestamp based on its position relative to the current first and last timestamps. |
| readOwnerUsageOrDefault | Reads owner usage from SQLite and returns default bounds when absent. |
| updateOwnerUsage | Updates timestamp bounds in evolu_usage table. |
Testing
| Function | Description |
|---|---|
| testCreateCrdtMessage | Test helper for creating a simple CrdtMessage. |
| testFingerprintTimestamps | Computes a brute-force Fingerprint from TimestampBytes values for tests and benchmarks. |