Skip to content

Commit c842f5c

Browse files
committed
More updates to README.md
1 parent 1dde3d9 commit c842f5c

File tree

1 file changed

+19
-72
lines changed

1 file changed

+19
-72
lines changed

README.md

Lines changed: 19 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
> This project is in early development and rapidly evolving.
44
> Expect breaking changes, rough edges, and incomplete documentation.
55
>
6-
> **🤝 Help Wanted!** If you find this useful, please consider contributing:
6+
> **Help Wanted!** If you find this useful, please consider contributing:
77
> - Report bugs and issues you encounter
88
> - Suggest improvements or new features
99
> - Submit pull requests for fixes or enhancements
@@ -14,12 +14,11 @@
1414
1515
## Overview
1616

17-
`xitdb-clj` is a embedded database for efficiently storing and retrieving immutable, persistent data structures.
17+
`xitdb-clj` is a embedded database for efficiently storing and retrieving immutable, persistent data structures.
18+
The library provides atom-like semantics for working with the database from Clojure.
1819

19-
It is a Clojure interface for [xitdb-java](https://github.com/radarroark/xitdb-java),
20-
itself a port of [xitdb](https://github.com/radarroark/xitdb), written in Zig.
20+
It is a Clojure interface for [xitdb-java](https://github.com/radarroark/xitdb-java), itself a port of [xitdb](https://github.com/radarroark/xitdb), written in Zig.
2121

22-
`xitdb-clj` provides atom-like semantics when working with the database from Clojure.
2322

2423
[![Clojars Project](https://img.shields.io/clojars/v/io.github.codeboost/xitdb-clj.svg)](https://clojars.org/io.github.codeboost/xitdb-clj)
2524

@@ -34,21 +33,6 @@ itself a port of [xitdb](https://github.com/radarroark/xitdb), written in Zig.
3433
- All heavy lifting done by the bare-to-the-jvm java library.
3534
- Database files can be used from other languages, via [xitdb Java library](https://github.com/radarroark/xitdb-java) or the [xitdb Zig library](https://github.com/radarroark/xitdb)
3635

37-
## Architecture
38-
39-
`xitdb-clj` builds on [xitdb-java](https://github.com/radarroark/xitdb-java) which implements:
40-
41-
- **Hash Array Mapped Trie (HAMT)** - For efficient map and set operations
42-
- **RRB Trees** - For vector operations with good concatenation performance
43-
- **Structural Sharing** - Minimizes memory usage across versions
44-
- **Copy-on-Write** - Ensures immutability while maintaining performance
45-
46-
The Clojure wrapper adds:
47-
- Idiomatic Clojure interfaces (`IAtom`, `IDeref`)
48-
- Automatic type conversion between Clojure and Java types
49-
- Thread-local read connections for scalability
50-
- Integration with Clojure's sequence abstractions
51-
5236
## Quickstart
5337

5438
Add the dependency to your project, start a REPL.
@@ -162,65 +146,28 @@ values of the database, by setting the `*return-history?*` binding to `true`.
162146
(println "new value:" new-value)))
163147
```
164148

149+
### Architecture
150+
`xitdb-clj` builds on [xitdb-java](https://github.com/radarroark/xitdb-java) which implements:
151+
152+
- **Hash Array Mapped Trie (HAMT)** - For efficient map and set operations
153+
- **RRB Trees** - For vector operations with good concatenation performance
154+
- **Structural Sharing** - Minimizes memory usage across versions
155+
- **Copy-on-Write** - Ensures immutability while maintaining performance
156+
157+
The Clojure wrapper adds:
158+
- Idiomatic Clojure interfaces (`IAtom`, `IDeref`)
159+
- Automatic type conversion between Clojure and Java types
160+
- Thread-local read connections for scalability
161+
- Integration with Clojure's sequence abstractions
162+
165163
### Supported Data Types
164+
166165
- **Maps** - Hash maps with efficient key-value access
167166
- **Vectors** - Array lists with indexed access
168167
- **Sets** - Hash sets with unique element storage
169168
- **Lists** - Linked lists and RRB tree-based linked array lists
170169
- **Primitives** - Numbers, strings, keywords, booleans, dates.
171170

172-
### Persistence Models
173-
- **File-based** - Data persisted to disk with crash recovery
174-
- **In-memory** - Fast temporary storage for testing or caching
175-
176-
## Examples
177-
178-
### User Management System
179-
180-
```clojure
181-
(def user-db (xdb/xit-db "users.db"))
182-
183-
(reset! user-db {:users {}
184-
:sessions {}
185-
:settings {:max-sessions 100}})
186-
187-
;; Add a new user
188-
(swap! user-db assoc-in [:users "user123"]
189-
{:id "user123"
190-
:email "alice@example.com"
191-
:created-at (java.time.Instant/now)
192-
:preferences {:theme "dark" :notifications true}})
193-
194-
;; Create a session
195-
(swap! user-db assoc-in [:sessions "session456"]
196-
{:user-id "user123"
197-
:created-at (java.time.Instant/now)
198-
:expires-at (java.time.Instant/ofEpochSecond (+ (System/currentTimeMillis) 3600))})
199-
200-
;; Update user preferences
201-
(swap! user-db update-in [:users "user123" :preferences]
202-
merge {:language "en" :timezone "UTC"})
203-
```
204-
205-
### Configuration Store
206-
207-
```clojure
208-
(def config-db (xdb/xit-db "app-config.db"))
209-
210-
(reset! config-db
211-
{:database {:host "localhost" :port 5432 :name "myapp"}
212-
:cache {:ttl 3600 :max-size 1000}
213-
:features #{:user-registration :email-notifications :analytics}
214-
:rate-limits [{:path "/api/*" :requests-per-minute 100}
215-
{:path "/upload" :requests-per-minute 10}]})
216-
217-
;; Enable a new feature
218-
(swap! config-db update :features conj :real-time-updates)
219-
220-
;; Update database configuration
221-
(swap! config-db assoc-in [:database :host] "db.production.com")
222-
```
223-
224171
## Performance Characteristics
225172

226173
- **Read Operations**: O(log16 n) for maps and vectors due to trie structure

0 commit comments

Comments
 (0)