You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/reference/typescript.md
+101-2Lines changed: 101 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -698,6 +698,29 @@ if (cf.isCompacting()) {
698
698
- Maintenance windows · Check if operations are running before triggering manual compaction
699
699
- Monitoring · Track background operation status for observability
700
700
701
+
### Purge (Force Flush + Compaction)
702
+
703
+
Purge forces a full flush of the active memtable followed by aggressive compaction, blocking until all flush and compaction I/O has drained. Use it to reclaim space and collapse the LSM tree on demand -- for example before a backup, or after a large batch of deletes -- rather than waiting for background thresholds.
704
+
705
+
Purge a single column family:
706
+
707
+
```typescript
708
+
const cf =db.getColumnFamily('my_cf');
709
+
710
+
cf.purgeColumnFamily(); // flush + aggressive compaction for this CF, waits for I/O to finish
711
+
```
712
+
713
+
Purge every column family in the database:
714
+
715
+
```typescript
716
+
db.purge(); // flush + aggressive compaction across all CFs, waits for queues to drain
717
+
```
718
+
719
+
**Behavior**
720
+
- Synchronous; blocks until all flush and compaction work has completed
721
+
-`cf.purgeColumnFamily()` operates on one column family; `db.purge()` applies to all of them
722
+
- Throws `TidesDBError` on failure (`db.purge()` reports the first non-zero error code encountered)
723
+
701
724
### Updating Runtime Configuration
702
725
703
726
Update runtime-safe configuration settings. Changes apply to new operations only.
@@ -1220,10 +1243,78 @@ if (stats.objectStoreEnabled) {
1220
1243
}
1221
1244
```
1222
1245
1223
-
:::note[S3/MinIO Connector]
1224
-
The filesystem connector is always available. For S3/MinIO support, TidesDB must be built with `-DTIDESDB_WITH_S3=ON`. The S3 connector is not exposed through the TypeScript binding -- use the C API directly for S3 configuration.
1246
+
#### S3 / MinIO Connector
1247
+
1248
+
The S3-compatible connector (AWS S3, MinIO, and any S3 API-compatible store) is exposed through the TypeScript binding via the `objectStoreS3Config` option on `TidesDB.open()`. Provide an `S3Config` instead of `objectStoreFsPath`; the `objectStoreConfig` behavior options (cache sizing, WAL replication, replica mode, etc.) apply identically to both connectors.
1249
+
1250
+
```typescript
1251
+
import { TidesDB } from'tidesdb';
1252
+
1253
+
const db =TidesDB.open({
1254
+
dbPath: './mydb',
1255
+
objectStoreS3Config: {
1256
+
endpoint: 's3.amazonaws.com',
1257
+
bucket: 'my-tidesdb-bucket',
1258
+
prefix: 'production/db1/',
1259
+
accessKey: process.env.AWS_ACCESS_KEY_ID!,
1260
+
secretKey: process.env.AWS_SECRET_ACCESS_KEY!,
1261
+
region: 'us-east-1',
1262
+
useSsl: true,
1263
+
},
1264
+
objectStoreConfig: {
1265
+
localCacheMaxBytes: 512*1024*1024, // 512MB local cache
1266
+
maxConcurrentUploads: 8,
1267
+
},
1268
+
});
1269
+
1270
+
db.close();
1271
+
```
1272
+
1273
+
For MinIO (or any self-hosted S3 gateway), use path-style URLs and the gateway endpoint:
1274
+
1275
+
```typescript
1276
+
const db =TidesDB.open({
1277
+
dbPath: './mydb',
1278
+
objectStoreS3Config: {
1279
+
endpoint: 'minio.local:9000',
1280
+
bucket: 'tidesdb',
1281
+
accessKey: 'minioadmin',
1282
+
secretKey: 'minioadmin',
1283
+
useSsl: false,
1284
+
usePathStyle: true, // required for MinIO
1285
+
},
1286
+
});
1287
+
```
1288
+
1289
+
##### `S3Config` Options
1290
+
1291
+
| Field | Type | Default | Description |
1292
+
|-------|------|---------|-------------|
1293
+
|`endpoint`|`string`|*(required)*| S3 endpoint (e.g. `"s3.amazonaws.com"` or `"minio.local:9000"`) |
1294
+
|`bucket`|`string`|*(required)*| Bucket name |
1295
+
|`accessKey`|`string`|*(required)*| AWS access key ID |
|`multipartThreshold`|`number`|`0` (library default) | Object size at/above which multipart upload is used |
1304
+
|`multipartPartSize`|`number`|`0` (library default) | Multipart chunk size in bytes |
1305
+
1306
+
:::note[S3 build requirement]
1307
+
The filesystem connector is always available. The S3 connector requires a `libtidesdb` built with `-DTIDESDB_WITH_S3=ON`. On a library built without S3 support, passing `objectStoreS3Config` throws a `TidesDBError` explaining that the S3 connector is unavailable; rebuild with `TIDESDB_WITH_S3` to enable it.
1225
1308
:::
1226
1309
1310
+
The `ObjStoreBackend` enum identifies which connector a database reports:
`registerComparator(name, ctxStr?)` accepts an optional second argument, a context string passed through to the comparator's context (default `""`). Use it to parameterize a comparator (for example, a collation locale) without a separate registration call:
1691
+
1692
+
```typescript
1693
+
db.registerComparator('locale_aware', 'en_US');
1694
+
```
1695
+
1599
1696
### Retrieving a Registered Comparator
1600
1697
1601
1698
Use `getComparator` to check whether a comparator is registered:
0 commit comments