xitdb 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
<a href="https://github.com/xit-vcs/xitdb">Zig</a> |
|
|
7
7
|
<a href="https://github.com/xit-vcs/xitdb-java">Java</a> |
|
|
8
8
|
<a href="https://github.com/codeboost/xitdb-clj">Clojure</a> |
|
|
9
|
-
<a href="https://github.com/xit-vcs/xitdb-ts">TypeScript</a>
|
|
9
|
+
<a href="https://github.com/xit-vcs/xitdb-ts">TypeScript</a> |
|
|
10
|
+
<a href="https://github.com/xit-vcs/xitdb-go">Go</a>
|
|
10
11
|
</p>
|
|
11
12
|
|
|
12
13
|
* Each transaction efficiently creates a new "copy" of the database, and past copies can still be read from and reverted to.
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
* No dependencies besides the JavaScript standard library.
|
|
19
20
|
* Available [on npm](https://www.npmjs.com/package/xitdb).
|
|
20
21
|
|
|
21
|
-
This database was originally made for the [xit version control system](https://github.com/xit-vcs/xit), but I bet it has a lot of potential for other projects. The combination of being immutable and having an API similar to in-memory data structures is pretty powerful. Consider using it [instead of SQLite](https://gist.github.com/
|
|
22
|
+
This database was originally made for the [xit version control system](https://github.com/xit-vcs/xit), but I bet it has a lot of potential for other projects. The combination of being immutable and having an API similar to in-memory data structures is pretty powerful. Consider using it [instead of SQLite](https://gist.github.com/xeubie/03a0724484e1111ef4c05d72a935c42c) for your TypeScript projects: it's simpler, it's pure TypeScript, and it creates no impedance mismatch with your program the way SQL databases do.
|
|
22
23
|
|
|
23
24
|
* [Example](#example)
|
|
24
25
|
* [Initializing a Database](#initializing-a-database)
|
|
@@ -424,12 +425,12 @@ switch (hashIdStr) {
|
|
|
424
425
|
Normally, an immutable database grows forever, because old data is never deleted. To reclaim disk space and clear the history, xitdb supports compaction. This involves completely rebuilding the database file to only contain the data accessible from the latest copy (i.e., "moment") of the database.
|
|
425
426
|
|
|
426
427
|
```typescript
|
|
427
|
-
// create the file and core for the new database
|
|
428
428
|
using compactCore = await CoreBufferedFile.create('compact.db');
|
|
429
|
-
|
|
430
429
|
const compactDb = await db.compact(compactCore);
|
|
431
430
|
|
|
432
431
|
// read from the new compacted db
|
|
433
432
|
const history = new ReadArrayList(compactDb.rootCursor());
|
|
434
433
|
expect(await history.count()).toBe(1);
|
|
435
434
|
```
|
|
435
|
+
|
|
436
|
+
This compacted database will be in a separate file. If you want to delete the original database and replace it with this one, you'll need to do that yourself. It is not possible to compact a database in-place (using the same file as the target database); doing so would fail and would render your original database unreadable.
|