@fireproof/vendor 2.0.1 → 3.0.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/package.json +6 -59
- package/src/p-limit/index.d.ts +81 -0
- package/src/p-limit/index.js +104 -0
- package/src/p-limit/license +9 -0
- package/src/p-limit/readme.md +129 -0
- package/src/@web3-storage/pail/LICENSE.md +0 -232
- package/src/@web3-storage/pail/README.md +0 -84
- package/src/@web3-storage/pail/cli.js +0 -218
- package/src/@web3-storage/pail/dist/src/api.d.ts +0 -59
- package/src/@web3-storage/pail/dist/src/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/batch/api.d.ts +0 -31
- package/src/@web3-storage/pail/dist/src/batch/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/batch/index.d.ts +0 -23
- package/src/@web3-storage/pail/dist/src/batch/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/batch/shard.d.ts +0 -3
- package/src/@web3-storage/pail/dist/src/batch/shard.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/block.d.ts +0 -35
- package/src/@web3-storage/pail/dist/src/block.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/clock/api.d.ts +0 -10
- package/src/@web3-storage/pail/dist/src/clock/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/clock/index.d.ts +0 -48
- package/src/@web3-storage/pail/dist/src/clock/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/crdt/api.d.ts +0 -26
- package/src/@web3-storage/pail/dist/src/crdt/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/crdt/batch/api.d.ts +0 -11
- package/src/@web3-storage/pail/dist/src/crdt/batch/api.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/crdt/batch/index.d.ts +0 -5
- package/src/@web3-storage/pail/dist/src/crdt/batch/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/crdt/index.d.ts +0 -9
- package/src/@web3-storage/pail/dist/src/crdt/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/diff.d.ts +0 -13
- package/src/@web3-storage/pail/dist/src/diff.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/index.d.ts +0 -10
- package/src/@web3-storage/pail/dist/src/index.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/merge.d.ts +0 -5
- package/src/@web3-storage/pail/dist/src/merge.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/src/shard.d.ts +0 -43
- package/src/@web3-storage/pail/dist/src/shard.d.ts.map +0 -1
- package/src/@web3-storage/pail/dist/tsconfig.tsbuildinfo +0 -1
- package/src/@web3-storage/pail/src/api.js +0 -1
- package/src/@web3-storage/pail/src/api.ts +0 -90
- package/src/@web3-storage/pail/src/batch/api.js +0 -1
- package/src/@web3-storage/pail/src/batch/api.ts +0 -59
- package/src/@web3-storage/pail/src/batch/index.js +0 -258
- package/src/@web3-storage/pail/src/batch/shard.js +0 -13
- package/src/@web3-storage/pail/src/block.js +0 -75
- package/src/@web3-storage/pail/src/clock/api.js +0 -1
- package/src/@web3-storage/pail/src/clock/api.ts +0 -12
- package/src/@web3-storage/pail/src/clock/index.js +0 -182
- package/src/@web3-storage/pail/src/crdt/api.js +0 -1
- package/src/@web3-storage/pail/src/crdt/api.ts +0 -33
- package/src/@web3-storage/pail/src/crdt/batch/api.js +0 -1
- package/src/@web3-storage/pail/src/crdt/batch/api.ts +0 -30
- package/src/@web3-storage/pail/src/crdt/batch/index.js +0 -155
- package/src/@web3-storage/pail/src/crdt/index.js +0 -354
- package/src/@web3-storage/pail/src/diff.js +0 -151
- package/src/@web3-storage/pail/src/index.js +0 -406
- package/src/@web3-storage/pail/src/merge.js +0 -43
- package/src/@web3-storage/pail/src/shard.js +0 -180
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# pail
|
|
2
|
-
|
|
3
|
-
[](https://github.com/web3-storage/pail/actions/workflows/ci.yml)
|
|
4
|
-
[](https://standardjs.com)
|
|
5
|
-
|
|
6
|
-
DAG based key value store. Sharded DAG that minimises traversals and work to build shards.
|
|
7
|
-
|
|
8
|
-
* 📖 [Read the SPEC](https://github.com/web3-storage/specs/blob/4163e28d7e6a7c44cff68db9d9bffb9b37707dc6/pail.md).
|
|
9
|
-
* 🎬 [Watch the Presentation](https://youtu.be/f-BrtpYKZfg).
|
|
10
|
-
|
|
11
|
-
## Install
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
npm install @web3-storage/pail
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
import { put, get, del } from '@web3-storage/pail'
|
|
21
|
-
import { ShardBlock } from '@web3-storage/pail/shard'
|
|
22
|
-
import { MemoryBlockstore } from '@web3-storage/pail/block'
|
|
23
|
-
|
|
24
|
-
// Initialize a new bucket
|
|
25
|
-
const blocks = new MemoryBlockstore()
|
|
26
|
-
const init = await ShardBlock.create() // empty root shard
|
|
27
|
-
await blocks.put(init.cid, init.bytes)
|
|
28
|
-
|
|
29
|
-
// Add a key and value to the bucket
|
|
30
|
-
const { root, additions, removals } = await put(blocks, init.cid, 'path/to/data0', dataCID0)
|
|
31
|
-
|
|
32
|
-
console.log(`new root: ${root}`)
|
|
33
|
-
|
|
34
|
-
// Process the diff
|
|
35
|
-
for (const block of additions) {
|
|
36
|
-
await blocks.put(block.cid, block.bytes)
|
|
37
|
-
}
|
|
38
|
-
for (const block of removals) {
|
|
39
|
-
await blocks.delete(block.cid)
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Batch operations
|
|
44
|
-
|
|
45
|
-
If adding many multiple items to the pail together, it is faster to batch them together.
|
|
46
|
-
|
|
47
|
-
```js
|
|
48
|
-
import { put, get, del } from '@web3-storage/pail'
|
|
49
|
-
import { ShardBlock } from '@web3-storage/pail/shard'
|
|
50
|
-
import { MemoryBlockstore } from '@web3-storage/pail/block'
|
|
51
|
-
import * as Batch from '@web3-storage/pail/batch'
|
|
52
|
-
|
|
53
|
-
// Initialize a new bucket
|
|
54
|
-
const blocks = new MemoryBlockstore()
|
|
55
|
-
const init = await ShardBlock.create() // empty root shard
|
|
56
|
-
await blocks.put(init.cid, init.bytes)
|
|
57
|
-
|
|
58
|
-
const batch = await Batch.create(blocks, init.cid)
|
|
59
|
-
|
|
60
|
-
// items is an array of `{ key: string, value: CID }` - the items to add to the pail
|
|
61
|
-
for (const item of items) {
|
|
62
|
-
await batch.put(item.key, item.value)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const { root, additions, removals } = await batch.commit()
|
|
66
|
-
|
|
67
|
-
console.log(`new root: ${root}`)
|
|
68
|
-
|
|
69
|
-
// Process the diff
|
|
70
|
-
for (const block of additions) {
|
|
71
|
-
await blocks.put(block.cid, block.bytes)
|
|
72
|
-
}
|
|
73
|
-
for (const block of removals) {
|
|
74
|
-
await blocks.delete(block.cid)
|
|
75
|
-
}
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Contributing
|
|
79
|
-
|
|
80
|
-
Feel free to join in. All welcome. [Open an issue](https://github.com/web3-storage/pail/issues)!
|
|
81
|
-
|
|
82
|
-
## License
|
|
83
|
-
|
|
84
|
-
Dual-licensed under [MIT or Apache 2.0](https://github.com/web3-storage/pail/blob/main/LICENSE.md)
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import os from 'os'
|
|
4
|
-
import { join } from 'path'
|
|
5
|
-
import { Readable, Writable } from 'stream'
|
|
6
|
-
import sade from 'sade'
|
|
7
|
-
import { CID } from 'multiformats/cid'
|
|
8
|
-
import { CARReaderStream, CARWriterStream } from 'carstream'
|
|
9
|
-
import clc from 'cli-color'
|
|
10
|
-
import archy from 'archy'
|
|
11
|
-
// eslint-disable-next-line no-unused-vars
|
|
12
|
-
import * as API from './src/api.js'
|
|
13
|
-
import { put, get, del, entries } from './src/index.js'
|
|
14
|
-
import { ShardFetcher, ShardBlock, isShardLink } from './src/shard.js'
|
|
15
|
-
import { difference } from './src/diff.js'
|
|
16
|
-
import { merge } from './src/merge.js'
|
|
17
|
-
import { MemoryBlockstore, MultiBlockFetcher } from './src/block.js'
|
|
18
|
-
|
|
19
|
-
const cli = sade('pail')
|
|
20
|
-
.option('--path', 'Path to data store.', './pail.car')
|
|
21
|
-
|
|
22
|
-
cli.command('put <key> <value>')
|
|
23
|
-
.describe('Put a value (a CID) for the given key. If the key exists it\'s value is overwritten.')
|
|
24
|
-
.alias('set')
|
|
25
|
-
.action(async (key, value, opts) => {
|
|
26
|
-
const { root: prevRoot, blocks } = await openPail(opts.path)
|
|
27
|
-
const { root, additions, removals } = await put(blocks, prevRoot, key, CID.parse(value))
|
|
28
|
-
await updatePail(opts.path, blocks, root, { additions, removals })
|
|
29
|
-
|
|
30
|
-
console.log(clc.red(`--- ${prevRoot}`))
|
|
31
|
-
console.log(clc.green(`+++ ${root}`))
|
|
32
|
-
console.log(clc.magenta('@@ -1 +1 @@'))
|
|
33
|
-
additions.forEach(b => console.log(clc.green(`+${b.cid}`)))
|
|
34
|
-
removals.forEach(b => console.log(clc.red(`-${b.cid}`)))
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
cli.command('get <key>')
|
|
38
|
-
.describe('Get the stored value for the given key from the pail. If the key is not found, `undefined` is returned.')
|
|
39
|
-
.action(async (key, opts) => {
|
|
40
|
-
const { root, blocks } = await openPail(opts.path)
|
|
41
|
-
const value = await get(blocks, root, key)
|
|
42
|
-
if (value) console.log(value.toString())
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
cli.command('del <key>')
|
|
46
|
-
.describe('Delete the value for the given key from the pail. If the key is not found no operation occurs.')
|
|
47
|
-
.alias('delete', 'rm', 'remove')
|
|
48
|
-
.action(async (key, opts) => {
|
|
49
|
-
const { root: prevRoot, blocks } = await openPail(opts.path)
|
|
50
|
-
const { root, additions, removals } = await del(blocks, prevRoot, key)
|
|
51
|
-
await updatePail(opts.path, blocks, root, { additions, removals })
|
|
52
|
-
|
|
53
|
-
console.log(clc.red(`--- ${prevRoot}`))
|
|
54
|
-
console.log(clc.green(`+++ ${root}`))
|
|
55
|
-
console.log(clc.magenta('@@ -1 +1 @@'))
|
|
56
|
-
additions.forEach(b => console.log(clc.green(`+ ${b.cid}`)))
|
|
57
|
-
removals.forEach(b => console.log(clc.red(`- ${b.cid}`)))
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
cli.command('ls')
|
|
61
|
-
.describe('List entries in the pail.')
|
|
62
|
-
.alias('list')
|
|
63
|
-
.option('-p, --prefix', 'Key prefix to filter by.')
|
|
64
|
-
.option('--gt', 'Filter results by keys greater than this string.')
|
|
65
|
-
.option('--lt', 'Filter results by keys less than this string.')
|
|
66
|
-
.option('--json', 'Format output as newline delimted JSON.')
|
|
67
|
-
.action(async (opts) => {
|
|
68
|
-
const { root, blocks } = await openPail(opts.path)
|
|
69
|
-
let n = 0
|
|
70
|
-
for await (const [k, v] of entries(blocks, root, { prefix: opts.prefix, gt: opts.gt, lt: opts.lt })) {
|
|
71
|
-
console.log(opts.json ? JSON.stringify({ key: k, value: v.toString() }) : `${k}\t${v}`)
|
|
72
|
-
n++
|
|
73
|
-
}
|
|
74
|
-
if (!opts.json) console.log(`total ${n}`)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
cli.command('tree')
|
|
78
|
-
.describe('Visualise the pail.')
|
|
79
|
-
.alias('vis')
|
|
80
|
-
.action(async (opts) => {
|
|
81
|
-
const { root, blocks } = await openPail(opts.path)
|
|
82
|
-
const shards = new ShardFetcher(blocks)
|
|
83
|
-
const rshard = await shards.get(root)
|
|
84
|
-
|
|
85
|
-
/** @type {archy.Data} */
|
|
86
|
-
const archyRoot = { label: `Shard(${clc.yellow(rshard.cid.toString())}) ${rshard.bytes.length + 'b'}`, nodes: [] }
|
|
87
|
-
|
|
88
|
-
/** @param {API.ShardEntry} entry */
|
|
89
|
-
const getData = async ([k, v]) => {
|
|
90
|
-
if (!Array.isArray(v)) {
|
|
91
|
-
return { label: `Key(${clc.magenta(k)})`, nodes: [{ label: `Value(${clc.cyan(v)})` }] }
|
|
92
|
-
}
|
|
93
|
-
/** @type {archy.Data} */
|
|
94
|
-
const data = { label: `Key(${clc.magenta(k)})`, nodes: [] }
|
|
95
|
-
if (v[1]) data.nodes?.push({ label: `Value(${clc.cyan(v[1])})` })
|
|
96
|
-
const blk = await shards.get(v[0])
|
|
97
|
-
data.nodes?.push({
|
|
98
|
-
label: `Shard(${clc.yellow(v[0])}) ${blk.bytes.length + 'b'}`,
|
|
99
|
-
nodes: await Promise.all(blk.value.entries.map(e => getData(e)))
|
|
100
|
-
})
|
|
101
|
-
return data
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const entry of rshard.value.entries) {
|
|
105
|
-
archyRoot.nodes?.push(await getData(entry))
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
console.log(archy(archyRoot))
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
cli.command('diff <path>')
|
|
112
|
-
.describe('Find the differences between this pail and the passed pail.')
|
|
113
|
-
.option('-k, --keys', 'Output key/value diff.')
|
|
114
|
-
.action(async (path, opts) => {
|
|
115
|
-
const [
|
|
116
|
-
{ root: aroot, blocks: ablocks },
|
|
117
|
-
{ root: broot, blocks: bblocks }
|
|
118
|
-
] = await Promise.all([openPail(opts.path), openPail(path)])
|
|
119
|
-
if (aroot.toString() === broot.toString()) return
|
|
120
|
-
|
|
121
|
-
const fetcher = new MultiBlockFetcher(ablocks, bblocks)
|
|
122
|
-
const { shards: { additions, removals }, keys } = await difference(fetcher, aroot, broot)
|
|
123
|
-
|
|
124
|
-
console.log(clc.red(`--- ${aroot}`))
|
|
125
|
-
console.log(clc.green(`+++ ${broot}`))
|
|
126
|
-
console.log(clc.magenta('@@ -1 +1 @@'))
|
|
127
|
-
|
|
128
|
-
if (opts.keys) {
|
|
129
|
-
keys.forEach(([k, v]) => {
|
|
130
|
-
if (v[0] != null) console.log(clc.red(`- ${k}\t${v[0]}`))
|
|
131
|
-
if (v[1] != null) console.log(clc.green(`+ ${k}\t${v[1]}`))
|
|
132
|
-
})
|
|
133
|
-
} else {
|
|
134
|
-
additions.forEach(b => console.log(clc.green(`+ ${b.cid}`)))
|
|
135
|
-
removals.forEach(b => console.log(clc.red(`- ${b.cid}`)))
|
|
136
|
-
}
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
cli.command('merge <path>')
|
|
140
|
-
.describe('Merge the passed pail into this pail.')
|
|
141
|
-
.action(async (path, opts) => {
|
|
142
|
-
const [
|
|
143
|
-
{ root: aroot, blocks: ablocks },
|
|
144
|
-
{ root: broot, blocks: bblocks }
|
|
145
|
-
] = await Promise.all([openPail(opts.path), openPail(path)])
|
|
146
|
-
if (aroot.toString() === broot.toString()) return
|
|
147
|
-
|
|
148
|
-
const fetcher = new MultiBlockFetcher(ablocks, bblocks)
|
|
149
|
-
const { root, additions, removals } = await merge(fetcher, aroot, [broot])
|
|
150
|
-
|
|
151
|
-
await updatePail(opts.path, ablocks, root, { additions, removals })
|
|
152
|
-
|
|
153
|
-
console.log(clc.red(`--- ${aroot}`))
|
|
154
|
-
console.log(clc.green(`+++ ${root}`))
|
|
155
|
-
console.log(clc.magenta('@@ -1 +1 @@'))
|
|
156
|
-
additions.forEach(b => console.log(clc.green(`+ ${b.cid}`)))
|
|
157
|
-
removals.forEach(b => console.log(clc.red(`- ${b.cid}`)))
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
cli.parse(process.argv)
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* @param {string} path
|
|
164
|
-
* @returns {Promise<{ root: API.ShardLink, blocks: MemoryBlockstore }>}
|
|
165
|
-
*/
|
|
166
|
-
async function openPail (path) {
|
|
167
|
-
const blocks = new MemoryBlockstore()
|
|
168
|
-
try {
|
|
169
|
-
const carReader = new CARReaderStream()
|
|
170
|
-
const readable = /** @type {ReadableStream<Uint8Array>} */ (Readable.toWeb(fs.createReadStream(path)))
|
|
171
|
-
await readable.pipeThrough(carReader).pipeTo(new WritableStream({ write: b => blocks.put(b.cid, b.bytes) }))
|
|
172
|
-
const header = await carReader.getHeader()
|
|
173
|
-
if (!isShardLink(header.roots[0])) throw new Error(`not a shard: ${header.roots[0]}`)
|
|
174
|
-
return { root: header.roots[0], blocks }
|
|
175
|
-
} catch (err) {
|
|
176
|
-
if (err.code !== 'ENOENT') throw new Error('failed to open bucket', { cause: err })
|
|
177
|
-
const rootblk = await ShardBlock.create()
|
|
178
|
-
blocks.put(rootblk.cid, rootblk.bytes)
|
|
179
|
-
return { root: rootblk.cid, blocks }
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @param {string} path
|
|
185
|
-
* @param {MemoryBlockstore} blocks
|
|
186
|
-
* @param {API.ShardLink} root
|
|
187
|
-
* @param {API.ShardDiff} diff
|
|
188
|
-
*/
|
|
189
|
-
async function updatePail (path, blocks, root, { additions, removals }) {
|
|
190
|
-
const tmp = join(os.tmpdir(), `pail${Date.now()}.car`)
|
|
191
|
-
const iterator = blocks.entries()
|
|
192
|
-
const readable = new ReadableStream({
|
|
193
|
-
start (controller) {
|
|
194
|
-
for (const b of additions) controller.enqueue(b)
|
|
195
|
-
},
|
|
196
|
-
pull (controller) {
|
|
197
|
-
for (const b of iterator) {
|
|
198
|
-
if (removals.some(r => b.cid.toString() === r.cid.toString())) continue
|
|
199
|
-
return controller.enqueue(b)
|
|
200
|
-
}
|
|
201
|
-
controller.close()
|
|
202
|
-
}
|
|
203
|
-
})
|
|
204
|
-
await readable.pipeThrough(new CARWriterStream([root])).pipeTo(Writable.toWeb(fs.createWriteStream(tmp)))
|
|
205
|
-
|
|
206
|
-
const old = `${path}-${new Date().toISOString()}`
|
|
207
|
-
try {
|
|
208
|
-
await fs.promises.rename(path, old)
|
|
209
|
-
} catch (err) {
|
|
210
|
-
if (err.code !== 'ENOENT') throw err
|
|
211
|
-
}
|
|
212
|
-
await fs.promises.rename(tmp, path)
|
|
213
|
-
try {
|
|
214
|
-
await fs.promises.rm(old)
|
|
215
|
-
} catch (err) {
|
|
216
|
-
if (err.code !== 'ENOENT') throw err
|
|
217
|
-
}
|
|
218
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Link, UnknownLink, BlockView, Block, Version } from 'multiformats';
|
|
2
|
-
import { sha256 } from 'multiformats/hashes/sha2';
|
|
3
|
-
import * as dagCBOR from '@ipld/dag-cbor';
|
|
4
|
-
export { Link, UnknownLink, BlockView, Block, Version };
|
|
5
|
-
export type ShardEntryValueValue = UnknownLink;
|
|
6
|
-
export type ShardEntryLinkValue = [ShardLink];
|
|
7
|
-
export type ShardEntryLinkAndValueValue = [ShardLink, UnknownLink];
|
|
8
|
-
export type ShardValueEntry = [key: string, value: ShardEntryValueValue];
|
|
9
|
-
export type ShardLinkEntry = [key: string, value: ShardEntryLinkValue | ShardEntryLinkAndValueValue];
|
|
10
|
-
/** Single key/value entry within a shard. */
|
|
11
|
-
export type ShardEntry = [key: string, value: ShardEntryValueValue | ShardEntryLinkValue | ShardEntryLinkAndValueValue];
|
|
12
|
-
export interface Shard extends ShardConfig {
|
|
13
|
-
entries: ShardEntry[];
|
|
14
|
-
}
|
|
15
|
-
export type ShardLink = Link<Shard, typeof dagCBOR.code, typeof sha256.code, 1>;
|
|
16
|
-
export interface ShardBlockView extends BlockView<Shard, typeof dagCBOR.code, typeof sha256.code, 1> {
|
|
17
|
-
}
|
|
18
|
-
export interface ShardDiff {
|
|
19
|
-
additions: ShardBlockView[];
|
|
20
|
-
removals: ShardBlockView[];
|
|
21
|
-
}
|
|
22
|
-
export interface BlockFetcher {
|
|
23
|
-
get<T = unknown, C extends number = number, A extends number = number, V extends Version = 1>(link: Link<T, C, A, V>): Promise<Block<T, C, A, V> | undefined>;
|
|
24
|
-
}
|
|
25
|
-
export interface ShardConfig {
|
|
26
|
-
/** Shard compatibility version. */
|
|
27
|
-
version: number;
|
|
28
|
-
/**
|
|
29
|
-
* Characters allowed in keys, referring to a known character set.
|
|
30
|
-
* e.g. "ascii" refers to the printable ASCII characters in the code range 32-126.
|
|
31
|
-
*/
|
|
32
|
-
keyChars: string;
|
|
33
|
-
/** Max key size in bytes - default 4096 bytes. */
|
|
34
|
-
maxKeySize: number;
|
|
35
|
-
/** The key prefix from the root to this shard. */
|
|
36
|
-
prefix: string;
|
|
37
|
-
}
|
|
38
|
-
export type ShardOptions = Partial<ShardConfig>;
|
|
39
|
-
export interface KeyPrefixOption {
|
|
40
|
-
/** Filter results to entries with keys prefixed with this string. */
|
|
41
|
-
prefix: string;
|
|
42
|
-
}
|
|
43
|
-
export type KeyRangeOption = KeyLowerBoundRangeOption | KeyUpperBoundRangeOption | (KeyLowerBoundRangeOption & KeyUpperBoundRangeOption);
|
|
44
|
-
export type KeyLowerBoundRangeOption = KeyLowerBoundRangeExclusiveOption | KeyLowerBoundRangeInclusiveOption;
|
|
45
|
-
export interface KeyLowerBoundRangeExclusiveOption {
|
|
46
|
-
gt: string;
|
|
47
|
-
}
|
|
48
|
-
export interface KeyLowerBoundRangeInclusiveOption {
|
|
49
|
-
gte: string;
|
|
50
|
-
}
|
|
51
|
-
export type KeyUpperBoundRangeOption = KeyUpperBoundRangeExclusiveOption | KeyUpperBoundRangeInclusiveOption;
|
|
52
|
-
export interface KeyUpperBoundRangeExclusiveOption {
|
|
53
|
-
lt: string;
|
|
54
|
-
}
|
|
55
|
-
export interface KeyUpperBoundRangeInclusiveOption {
|
|
56
|
-
lte: string;
|
|
57
|
-
}
|
|
58
|
-
export type EntriesOptions = KeyPrefixOption | KeyRangeOption;
|
|
59
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAEvD,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAA;AAE9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,SAAS,CAAC,CAAA;AAE7C,MAAM,MAAM,2BAA2B,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAElE,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAA;AAExE,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,2BAA2B,CAAC,CAAA;AAEpG,6CAA6C;AAC7C,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,mBAAmB,GAAG,2BAA2B,CAAC,CAAA;AAEvH,MAAM,WAAW,KAAM,SAAQ,WAAW;IACxC,OAAO,EAAE,UAAU,EAAE,CAAA;CACtB;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,OAAO,CAAC,IAAI,EAAE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;AAE/E,MAAM,WAAW,cAAe,SAAQ,SAAS,CAAC,KAAK,EAAE,OAAO,OAAO,CAAC,IAAI,EAAE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;CAAG;AAEvG,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,cAAc,EAAE,CAAA;IAC3B,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,OAAO,GAAG,CAAC,EAAG,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACnH,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAA;CACzC;AAED,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAE/C,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,MAAM,cAAc,GACtB,wBAAwB,GACxB,wBAAwB,GACxB,CAAC,wBAAwB,GAAG,wBAAwB,CAAC,CAAA;AAEzD,MAAM,MAAM,wBAAwB,GAChC,iCAAiC,GACjC,iCAAiC,CAAA;AAErC,MAAM,WAAW,iCAAiC;IAChD,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,iCAAiC;IAChD,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,wBAAwB,GAChC,iCAAiC,GACjC,iCAAiC,CAAA;AAErC,MAAM,WAAW,iCAAiC;IAChD,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,iCAAiC;IAChD,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,cAAc,GACtB,eAAe,GACf,cAAc,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UnknownLink, ShardLink, ShardDiff, ShardEntry, ShardEntryValueValue, ShardEntryLinkValue, ShardEntryLinkAndValueValue, ShardConfig, ShardOptions, ShardBlockView, BlockFetcher } from '../api.js';
|
|
2
|
-
export { UnknownLink, ShardLink, ShardDiff, ShardEntry, ShardEntryValueValue, ShardEntryLinkValue, ShardEntryLinkAndValueValue, ShardConfig, ShardOptions, ShardBlockView, BlockFetcher };
|
|
3
|
-
export interface BatcherShard extends ShardConfig {
|
|
4
|
-
base?: ShardBlockView;
|
|
5
|
-
entries: BatcherShardEntry[];
|
|
6
|
-
}
|
|
7
|
-
export interface BatcherShardInit extends ShardOptions {
|
|
8
|
-
base?: ShardBlockView;
|
|
9
|
-
entries?: BatcherShardEntry[];
|
|
10
|
-
}
|
|
11
|
-
export type BatcherShardEntry = [
|
|
12
|
-
key: string,
|
|
13
|
-
value: ShardEntryValueValue | ShardEntryLinkValue | ShardEntryLinkAndValueValue | ShardEntryShardValue | ShardEntryShardAndValueValue
|
|
14
|
-
];
|
|
15
|
-
export type ShardEntryShardValue = [BatcherShard];
|
|
16
|
-
export type ShardEntryShardAndValueValue = [BatcherShard, UnknownLink];
|
|
17
|
-
export interface Batcher {
|
|
18
|
-
/**
|
|
19
|
-
* Put a value (a CID) for the given key. If the key exists it's value is
|
|
20
|
-
* overwritten.
|
|
21
|
-
*/
|
|
22
|
-
put(key: string, value: UnknownLink): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Encode all altered shards in the batch and return the new root CID and
|
|
25
|
-
* difference blocks.
|
|
26
|
-
*/
|
|
27
|
-
commit(): Promise<{
|
|
28
|
-
root: ShardLink;
|
|
29
|
-
} & ShardDiff>;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/batch/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,oBAAoB,GAAG,mBAAmB,GAAG,2BAA2B,GAAG,oBAAoB,GAAG,4BAA4B;CACtI,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,YAAY,CAAC,CAAA;AAEjD,MAAM,MAAM,4BAA4B,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAA;AAEtE,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,GAAG,CAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD;;;OAGG;IACH,MAAM,IAAK,OAAO,CAAC;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG,SAAS,CAAC,CAAA;CACpD"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function put(blocks: API.BlockFetcher, shard: API.BatcherShard, key: string, value: API.UnknownLink): Promise<void>;
|
|
2
|
-
export function traverse(shards: ShardFetcher, shard: API.BatcherShard, key: string): Promise<{
|
|
3
|
-
shard: API.BatcherShard;
|
|
4
|
-
key: string;
|
|
5
|
-
}>;
|
|
6
|
-
export function commit(shard: API.BatcherShard): Promise<{
|
|
7
|
-
root: import("multiformats").CID<import("../api.js").Shard, 113, 18, 1>;
|
|
8
|
-
additions: API.ShardBlockView[];
|
|
9
|
-
removals: API.ShardBlockView[];
|
|
10
|
-
}>;
|
|
11
|
-
export function create(blocks: API.BlockFetcher, root: API.ShardLink): Promise<API.Batcher>;
|
|
12
|
-
export class BatchCommittedError extends Error {
|
|
13
|
-
static code: string;
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} [message]
|
|
16
|
-
* @param {ErrorOptions} [options]
|
|
17
|
-
*/
|
|
18
|
-
constructor(message?: string, options?: ErrorOptions);
|
|
19
|
-
code: string;
|
|
20
|
-
}
|
|
21
|
-
import * as API from './api.js';
|
|
22
|
-
import { ShardFetcher } from '../shard.js';
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/batch/index.js"],"names":[],"mappings":"AAiEO,4BANI,GAAG,CAAC,YAAY,SAChB,GAAG,CAAC,YAAY,OAChB,MAAM,SACN,GAAG,CAAC,WAAW,GACb,OAAO,CAAC,IAAI,CAAC,CAsGzB;AAWM,iCALI,YAAY,SACZ,GAAG,CAAC,YAAY,OAChB,MAAM,GACJ,OAAO,CAAC;IAAE,KAAK,EAAE,GAAG,CAAC,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAiB7D;AAQM,8BAFI,GAAG,CAAC,YAAY;;;;GAkC1B;AAaM,+BAJI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,GACX,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAE6C;AAE9E;IAUE,oBAAmC;IATnC;;;OAGG;IACH,sBAHW,MAAM,YACN,YAAY,EAKtB;IADC,aAAoC;CAIvC;qBAhQoB,UAAU;6BACgB,aAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shard.d.ts","sourceRoot":"","sources":["../../../src/batch/shard.js"],"names":[],"mappings":"AAQO,8BAHI,GAAG,CAAC,gBAAgB,GAClB,GAAG,CAAC,YAAY,CAM3B;qBAXmB,UAAU"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** @implements {API.BlockFetcher} */
|
|
2
|
-
export class MemoryBlockstore implements API.BlockFetcher {
|
|
3
|
-
/**
|
|
4
|
-
* @param {Array<import('multiformats').Block>} [blocks]
|
|
5
|
-
*/
|
|
6
|
-
constructor(blocks?: Array<import("multiformats").Block>);
|
|
7
|
-
get<T = unknown, C extends number = number, A extends number = number, V extends API.Version = 1>(link: API.Link<T, C, A, V>): Promise<API.Block<T, C, A, V> | undefined>;
|
|
8
|
-
/**
|
|
9
|
-
* @param {API.UnknownLink} cid
|
|
10
|
-
* @param {Uint8Array} bytes
|
|
11
|
-
*/
|
|
12
|
-
put(cid: API.UnknownLink, bytes: Uint8Array): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* @param {API.UnknownLink} cid
|
|
15
|
-
* @param {Uint8Array} bytes
|
|
16
|
-
*/
|
|
17
|
-
putSync(cid: API.UnknownLink, bytes: Uint8Array): void;
|
|
18
|
-
/** @param {API.UnknownLink} cid */
|
|
19
|
-
delete(cid: API.UnknownLink): Promise<void>;
|
|
20
|
-
/** @param {API.UnknownLink} cid */
|
|
21
|
-
deleteSync(cid: API.UnknownLink): void;
|
|
22
|
-
entries(): Generator<{
|
|
23
|
-
cid: API.Link<any, number, number, API.Version>;
|
|
24
|
-
bytes: Uint8Array<ArrayBufferLike>;
|
|
25
|
-
}, void, unknown>;
|
|
26
|
-
#private;
|
|
27
|
-
}
|
|
28
|
-
export class MultiBlockFetcher {
|
|
29
|
-
/** @param {API.BlockFetcher[]} fetchers */
|
|
30
|
-
constructor(...fetchers: API.BlockFetcher[]);
|
|
31
|
-
get<T = unknown, C extends number = number, A extends number = number, V extends API.Version = 1>(link: API.Link<T, C, A, V>): Promise<API.Block<T, C, A, V> | undefined>;
|
|
32
|
-
#private;
|
|
33
|
-
}
|
|
34
|
-
import * as API from './api.js';
|
|
35
|
-
//# sourceMappingURL=block.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/block.js"],"names":[],"mappings":"AAIA,qCAAqC;AACrC,yCADiB,GAAG,CAAC,YAAY;IAK/B;;OAEG;IACH,qBAFW,KAAK,CAAC,OAAO,cAAc,EAAE,KAAK,CAAC,EAM7C;;IASD;;;OAGG;IACH,SAHW,GAAG,CAAC,WAAW,SACf,UAAU,iBAIpB;IAED;;;OAGG;IACH,aAHW,GAAG,CAAC,WAAW,SACf,UAAU,QAIpB;IAED,mCAAmC;IACnC,YADY,GAAG,CAAC,WAAW,iBAG1B;IAED,mCAAmC;IACnC,gBADY,GAAG,CAAC,WAAW,QAG1B;IAED;;;sBAIC;;CACF;AAED;IAIE,2CAA2C;IAC3C,yBADY,GAAG,CAAC,YAAY,EAAE,EAG7B;;;CASF;qBAzEoB,UAAU"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Link, BlockView } from 'multiformats';
|
|
2
|
-
export { BlockFetcher } from '../api.js';
|
|
3
|
-
export type EventLink<T> = Link<EventView<T>>;
|
|
4
|
-
export interface EventView<T> {
|
|
5
|
-
parents: EventLink<T>[];
|
|
6
|
-
data: T;
|
|
7
|
-
}
|
|
8
|
-
export interface EventBlockView<T> extends BlockView<EventView<T>> {
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/clock/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7C,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAA;IACvB,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAAG"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export function advance<T>(blocks: API.BlockFetcher, head: API.EventLink<T>[], event: API.EventLink<T>): Promise<API.EventLink<T>[]>;
|
|
2
|
-
/**
|
|
3
|
-
* @template T
|
|
4
|
-
* @extends {Block<API.EventView<T>, typeof cbor.code, typeof sha256.code, 1>}
|
|
5
|
-
* @implements {API.EventBlockView<T>}
|
|
6
|
-
*/
|
|
7
|
-
export class EventBlock<T> extends Block<API.EventView<T>, 113, 18, 1> implements API.EventBlockView<T> {
|
|
8
|
-
/**
|
|
9
|
-
* @template T
|
|
10
|
-
* @param {T} data
|
|
11
|
-
* @param {API.EventLink<T>[]} [parents]
|
|
12
|
-
*/
|
|
13
|
-
static create<T_1>(data: T_1, parents?: API.EventLink<T_1>[]): Promise<API.EventBlockView<T_1>>;
|
|
14
|
-
/**
|
|
15
|
-
* @param {object} config
|
|
16
|
-
* @param {API.EventLink<T>} config.cid
|
|
17
|
-
* @param {Event} config.value
|
|
18
|
-
* @param {Uint8Array} config.bytes
|
|
19
|
-
* @param {string} config.prefix
|
|
20
|
-
*/
|
|
21
|
-
constructor({ cid, value, bytes, prefix }: {
|
|
22
|
-
cid: API.EventLink<T>;
|
|
23
|
-
value: Event;
|
|
24
|
-
bytes: Uint8Array;
|
|
25
|
-
prefix: string;
|
|
26
|
-
});
|
|
27
|
-
prefix: string;
|
|
28
|
-
}
|
|
29
|
-
/** @template T */
|
|
30
|
-
export class EventFetcher<T> {
|
|
31
|
-
/** @param {API.BlockFetcher} blocks */
|
|
32
|
-
constructor(blocks: API.BlockFetcher);
|
|
33
|
-
/** @private */
|
|
34
|
-
private _blocks;
|
|
35
|
-
/**
|
|
36
|
-
* @param {API.EventLink<T>} link
|
|
37
|
-
* @returns {Promise<API.EventBlockView<T>>}
|
|
38
|
-
*/
|
|
39
|
-
get(link: API.EventLink<T>): Promise<API.EventBlockView<T>>;
|
|
40
|
-
}
|
|
41
|
-
export function encodeEventBlock<T>(value: API.EventView<T>): Promise<API.EventBlockView<T>>;
|
|
42
|
-
export function decodeEventBlock<T>(bytes: Uint8Array): Promise<API.EventBlockView<T>>;
|
|
43
|
-
export function vis<T>(blocks: API.BlockFetcher, head: API.EventLink<T>[], options?: {
|
|
44
|
-
renderNodeLabel?: ((b: API.EventBlockView<T>) => string) | undefined;
|
|
45
|
-
}): AsyncGenerator<string, void, unknown>;
|
|
46
|
-
import * as API from './api.js';
|
|
47
|
-
import { Block } from 'multiformats/block';
|
|
48
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/clock/index.js"],"names":[],"mappings":"AAcO,wBALM,CAAC,UACH,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAClB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,+BA4B1B;AAED;;;;GAIG;AACH,wBAJa,CAAC,yDAEE,GAAG,CAAC,cAAc,CAAC,CAAC;IAgBlC;;;;OAIG;IACH,yBAHW,GAAC,YACD,GAAG,CAAC,SAAS,CAAC,GAAC,CAAC,EAAE,oCAI5B;IApBD;;;;;;OAMG;IACH,2CALG;QAAiC,GAAG,EAA5B,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACF,KAAK,EAAnB,KAAK;QACc,KAAK,EAAxB,UAAU;QACK,MAAM,EAArB,MAAM;KAChB,EAKA;IADC,eAAoB;CAWvB;AAED,kBAAkB;AAClB,0BADc,CAAC;IAEb,uCAAuC;IACvC,oBADY,GAAG,CAAC,YAAY,EAI3B;IAFC,eAAe;IACf,gBAAqB;IAGvB;;;OAGG;IACH,UAHW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GACd,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAM1C;CACF;AAOM,iCAJM,CAAC,SACH,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GACd,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAO1C;AAOM,iCAJM,CAAC,SACH,UAAU,GACR,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAM1C;AAoCM,oBANM,CAAC,UACH,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,YAE1B;IAAuD,eAAe,QAA1D,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,MAAM;CAA2B,yCAiCzE;qBA9KoB,UAAU;sBAJO,oBAAoB"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ShardDiff, ShardLink, UnknownLink } from '../api.js';
|
|
2
|
-
import { EventLink, EventBlockView } from '../clock/api.js';
|
|
3
|
-
export { BlockFetcher, UnknownLink, ShardBlockView, ShardDiff, ShardLink, EntriesOptions } from '../api.js';
|
|
4
|
-
export { EventBlockView, EventLink } from '../clock/api.js';
|
|
5
|
-
export interface Result extends ShardDiff {
|
|
6
|
-
root: ShardLink;
|
|
7
|
-
head: EventLink<Operation>[];
|
|
8
|
-
event?: EventBlockView<Operation>;
|
|
9
|
-
}
|
|
10
|
-
export type Operation = (PutOperation | DeleteOperation | BatchOperation) & {
|
|
11
|
-
root: ShardLink;
|
|
12
|
-
};
|
|
13
|
-
export interface PutOperation {
|
|
14
|
-
type: 'put';
|
|
15
|
-
key: string;
|
|
16
|
-
value: UnknownLink;
|
|
17
|
-
}
|
|
18
|
-
export interface DeleteOperation {
|
|
19
|
-
type: 'del';
|
|
20
|
-
key: string;
|
|
21
|
-
}
|
|
22
|
-
export interface BatchOperation {
|
|
23
|
-
type: 'batch';
|
|
24
|
-
ops: Array<PutOperation | DeleteOperation>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/crdt/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAE3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC3G,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,WAAW,MAAO,SAAQ,SAAS;IACvC,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,SAAS,GAAG,CACpB,YAAY,GACZ,eAAe,GACf,cAAc,CACjB,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEvB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,CAAC;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,YAAY,GAAC,eAAe,CAAC,CAAA;CACzC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Batcher, BatcherShardEntry, ShardBlockView, BlockFetcher, ShardLink, UnknownLink } from '../../batch/api.js';
|
|
2
|
-
import { Operation, BatchOperation, EventLink, Result } from '../api.js';
|
|
3
|
-
export { Batcher, BatcherShardEntry, ShardBlockView, BlockFetcher, ShardLink, UnknownLink, Operation, BatchOperation, EventLink, Result };
|
|
4
|
-
export interface CRDTBatcher extends Batcher {
|
|
5
|
-
/**
|
|
6
|
-
* Encode all altered shards in the batch and return the new root CID, new
|
|
7
|
-
* clock head, the new clock event and the difference blocks.
|
|
8
|
-
*/
|
|
9
|
-
commit(): Promise<Result>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/crdt/batch/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAExE,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,SAAS,EACT,MAAM,EACP,CAAA;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C;;;OAGG;IACH,MAAM,IAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC3B"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { BatchCommittedError };
|
|
2
|
-
export function create(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[]): Promise<API.CRDTBatcher>;
|
|
3
|
-
import { BatchCommittedError } from '../../batch/index.js';
|
|
4
|
-
import * as API from './api.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/crdt/batch/index.js"],"names":[],"mappings":";AA0JO,+BAJI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,GAC5B,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAEmC;oCArJpC,sBAAsB;qBAJrC,UAAU"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export function put(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], key: string, value: API.UnknownLink): Promise<API.Result>;
|
|
2
|
-
export function del(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], key: string, options?: object): Promise<API.Result>;
|
|
3
|
-
export function root(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[]): Promise<{
|
|
4
|
-
root: API.ShardLink;
|
|
5
|
-
} & API.ShardDiff>;
|
|
6
|
-
export function get(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], key: string): Promise<import("multiformats").Link<unknown, number, number, import("multiformats").Version> | undefined>;
|
|
7
|
-
export function entries(blocks: API.BlockFetcher, head: API.EventLink<API.Operation>[], options?: API.EntriesOptions): AsyncGenerator<import("../api.js").ShardValueEntry, void, any>;
|
|
8
|
-
import * as API from './api.js';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crdt/index.js"],"names":[],"mappings":"AAmBO,4BANI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,OAC9B,MAAM,SACN,GAAG,CAAC,WAAW,GACb,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAoG/B;AAYM,4BANI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,OAC9B,MAAM,YACN,MAAM,GACJ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAI/B;AAYM,6BAJI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,GAC5B,OAAO,CAAC;IAAE,IAAI,EAAE,GAAG,CAAC,SAAS,CAAA;CAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAsE5D;AAOM,4BAJI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,OAC9B,MAAM,6GAShB;AAOM,gCAJI,GAAG,CAAC,YAAY,QAChB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,YAC9B,GAAG,CAAC,cAAc,kEAS5B;qBA9OoB,UAAU"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function difference(blocks: API.BlockFetcher, a: API.ShardLink, b: API.ShardLink): Promise<CombinedDiff>;
|
|
2
|
-
export type K = string;
|
|
3
|
-
export type AddV = [before: null, after: API.UnknownLink];
|
|
4
|
-
export type UpdateV = [before: API.UnknownLink, after: API.UnknownLink];
|
|
5
|
-
export type DeleteV = [before: API.UnknownLink, after: null];
|
|
6
|
-
export type KV = [key: K, value: AddV | UpdateV | DeleteV];
|
|
7
|
-
export type KeysDiff = KV[];
|
|
8
|
-
export type CombinedDiff = {
|
|
9
|
-
keys: KeysDiff;
|
|
10
|
-
shards: API.ShardDiff;
|
|
11
|
-
};
|
|
12
|
-
import * as API from './api.js';
|
|
13
|
-
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/diff.js"],"names":[],"mappings":"AAoBO,mCALI,GAAG,CAAC,YAAY,KAChB,GAAG,CAAC,SAAS,KACb,GAAG,CAAC,SAAS,GACX,OAAO,CAAC,YAAY,CAAC,CAgHjC;gBA7HY,MAAM;mBACN,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC;sBACtC,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC;sBACjD,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC;iBACtC,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,GAAC,OAAO,GAAC,OAAO,CAAC;uBACrC,EAAE,EAAE;2BACJ;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAA;CAAE;qBAVjC,UAAU"}
|