-
Notifications
You must be signed in to change notification settings - Fork 160
/
db.clj
46 lines (41 loc) · 1.18 KB
/
db.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(ns crux.db
(:import java.io.Closeable))
;; tag::Index[]
(defprotocol Index
(seek-values [this k])
(next-values [this]))
;; end::Index[]
;; tag::LayeredIndex[]
(defprotocol LayeredIndex
(open-level [this])
(close-level [this])
(max-depth [this]))
;; end::LayeredIndex[]
;; tag::Indexer[]
(defprotocol Indexer
(index-docs [this docs])
(index-tx [this tx tx-events])
(docs-exist? [this content-hashes])
(store-index-meta [this k v])
(read-index-meta [this k]))
;; end::Indexer[]
;; tag::TxLog[]
(defprotocol TxLog
(submit-doc [this content-hash doc])
(submit-tx [this tx-ops])
(new-tx-log-context ^java.io.Closeable [this])
(tx-log [this tx-log-context from-tx-id]))
;; end::TxLog[]
;; NOTE: The snapshot parameter here is an optimisation to avoid keep
;; opening snapshots and allow caching of iterators. A non-KV backed
;; object store could choose to ignore it, but it would be nice to
;; hide it.
;; tag::ObjectStore[]
(defprotocol ObjectStore
(init [this partial-node options])
(get-single-object [this snapshot k])
(get-objects [this snapshot ks])
(known-keys? [this snapshot ks])
(put-objects [this kvs])
(delete-objects [this kvs]))
;; end::ObjectStore[]