@live-change/db 0.9.98 → 0.9.100

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.
Files changed (2) hide show
  1. package/lib/Log.js +13 -2
  2. package/package.json +5 -5
package/lib/Log.js CHANGED
@@ -31,8 +31,19 @@ class Log {
31
31
  await this.data.put(log)
32
32
  }
33
33
 
34
- async clear(before) {
35
- await this.data.rangeDelete({ lt: before })
34
+ async clear(before, maxCount = Infinity) {
35
+ let count = 0
36
+ let allCount = 0
37
+ let last = 0
38
+ do {
39
+ const limit = Math.min(4096, maxCount - allCount)
40
+ const result = await this.data.rangeDelete({ lt: before, limit })
41
+ count = result.count
42
+ last = result.last
43
+ allCount += count
44
+ await new Promise(resolve => setTimeout(resolve, 100))
45
+ } while(count > 0 && allCount < maxCount)
46
+ return { count: allCount, last }
36
47
  }
37
48
 
38
49
  objectGet(key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db",
3
- "version": "0.9.98",
3
+ "version": "0.9.100",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  "type": "module",
23
23
  "homepage": "https://github.com/live-change/live-change-stack",
24
24
  "devDependencies": {
25
- "@live-change/db-store-level": "^0.9.98",
26
- "@live-change/db-store-lmdb": "^0.9.98",
25
+ "@live-change/db-store-level": "^0.9.100",
26
+ "@live-change/db-store-lmdb": "^0.9.100",
27
27
  "minimist": ">=1.2.3",
28
28
  "next-tick": "^1.1.0",
29
29
  "rimraf": "^5.0.5",
@@ -32,9 +32,9 @@
32
32
  "websocket-extensions": ">=0.1.4"
33
33
  },
34
34
  "dependencies": {
35
- "@live-change/dao": "^0.9.98",
35
+ "@live-change/dao": "^0.9.100",
36
36
  "get-random-values": "^1.2.2",
37
37
  "node-interval-tree": "^1.3.3"
38
38
  },
39
- "gitHead": "a0e25c0ac835707d27763e56a2c20bd75d978583"
39
+ "gitHead": "4e7ef4d160d217e1d82b8dc5fdf542a65f8a1834"
40
40
  }