@@ -40,17 +40,20 @@ This is the implementation of the [IPFS repo spec](https://github.com/ipfs/specs
40
40
- [ ` Promise<Buffer> repo.get(key) ` ] ( #promisebuffer-repogetkey )
41
41
- [ Blocks] ( #blocks )
42
42
- [ ` Promise<Block> repo.blocks.put(block:Block) ` ] ( #promiseblock-repoblocksputblockblock )
43
- - [ ` AsyncIterator<Block> repo.blocks.putMany(source) ` ] ( #asynciteratorblock-repoblocksputmanysource )
44
- - [ ` Promise<Buffer> repo.blocks.get(cid) ` ] ( #promisebuffer-repoblocksgetcid )
45
- - [ ` AsyncIterable<Buffer> repo.blocks.getMany(source) ` ] ( #asynciterablebuffer-repoblocksgetmanysource )
43
+ - [ ` AsyncIterator<Block> repo.blocks.putMany(source:AsyncIterable<Block>) ` ] ( #asynciteratorblock-repoblocksputmanysourceasynciterableblock )
44
+ - [ ` Promise<Block> repo.blocks.get(cid:CID) ` ] ( #promiseblock-repoblocksgetcidcid )
45
+ - [ ` AsyncIterable<Block> repo.blocks.getMany(source:AsyncIterable<CID>) ` ] ( #asynciterableblock-repoblocksgetmanysourceasynciterablecid )
46
+ - [ ` Promise<boolean> repo.blocks.has (cid:CID) ` ] ( #promiseboolean-repoblockshas-cidcid )
47
+ - [ ` Promise<boolean> repo.blocks.delete (cid:CID) ` ] ( #promiseboolean-repoblocksdelete-cidcid )
48
+ - [ ` Promise<Array<Object>> repo.blocks.query (query) ` ] ( #promisearrayobject-repoblocksquery-query )
46
49
- [ ` Promise<CID> repo.blocks.delete(cid:CID) ` ] ( #promisecid-repoblocksdeletecidcid )
47
- - [ ` AsyncIterator<CID> repo.blocks.deleteMany(source) ` ] ( #asynciteratorcid-repoblocksdeletemanysource )
50
+ - [ ` AsyncIterator<CID> repo.blocks.deleteMany(source:AsyncIterable<CID> ) ` ] ( #asynciteratorcid-repoblocksdeletemanysourceasynciterablecid )
48
51
- [ Datastore] ( #datastore )
49
52
- [ ` repo.datastore ` ] ( #repodatastore )
50
53
- [ Config] ( #config )
51
- - [ ` Promise repo.config.set(key:string , value) ` ] ( #promise-repoconfigsetkeystring-value )
52
- - [ ` Promise repo.config.replace(value) ` ] ( #promise-repoconfigreplacevalue )
53
- - [ ` Promise<?> repo.config.get(key:string ) ` ] ( #promise-repoconfiggetkeystring )
54
+ - [ ` Promise repo.config.set(key:String , value:Object ) ` ] ( #promise-repoconfigsetkeystring-valueobject )
55
+ - [ ` Promise repo.config.replace(value:Object ) ` ] ( #promise-repoconfigreplacevalueobject )
56
+ - [ ` Promise<?> repo.config.get(key:String ) ` ] ( #promise-repoconfiggetkeystring )
54
57
- [ ` Promise<Object> repo.config.getAll() ` ] ( #promiseobject-repoconfiggetall )
55
58
- [ ` Promise<boolean> repo.config.exists() ` ] ( #promiseboolean-repoconfigexists )
56
59
- [ Version] ( #version )
@@ -229,31 +232,51 @@ Get a value at the root of the repo
229
232
230
233
* ` block ` should be of type [ Block] [ ]
231
234
232
- #### ` AsyncIterator<Block> repo.blocks.putMany(source) `
235
+ #### ` AsyncIterator<Block> repo.blocks.putMany(source:AsyncIterable<Block> ) `
233
236
234
237
Put many blocks.
235
238
236
239
* ` source ` should be an AsyncIterable that yields entries of type [ Block] [ ]
237
240
238
- #### ` Promise<Buffer > repo.blocks.get(cid) `
241
+ #### ` Promise<Block > repo.blocks.get(cid:CID ) `
239
242
240
243
Get block.
241
244
242
245
* ` cid ` is the content id of type [ CID] [ ]
243
246
244
- #### ` AsyncIterable<Buffer > repo.blocks.getMany(source) `
247
+ #### ` AsyncIterable<Block > repo.blocks.getMany(source:AsyncIterable<CID> ) `
245
248
246
- Get block.
249
+ Get many blocks
247
250
248
251
* ` source ` should be an AsyncIterable that yields entries of type [ CID] [ ]
249
252
253
+ #### ` Promise<boolean> repo.blocks.has (cid:CID) `
254
+
255
+ Indicate if a block is present for the passed CID
256
+
257
+ * ` cid ` should be of the type [ CID] [ ]
258
+
259
+ #### ` Promise<boolean> repo.blocks.delete (cid:CID) `
260
+
261
+ Deletes a block
262
+
263
+ * ` cid ` should be of the type [ CID] [ ]
264
+
265
+ #### ` Promise<Array<Object>> repo.blocks.query (query) `
266
+
267
+ Query what blocks are available in blockstore.
268
+
269
+ * ` query ` is a object as specified in [ interface-datastore] ( https://github.com/ipfs/interface-datastore#query ) .
270
+
271
+ Datastore:
272
+
250
273
#### ` Promise<CID> repo.blocks.delete(cid:CID) `
251
274
252
275
* ` cid ` should be of the type [ CID] [ ]
253
276
254
277
Delete a block
255
278
256
- #### ` AsyncIterator<CID> repo.blocks.deleteMany(source) `
279
+ #### ` AsyncIterator<CID> repo.blocks.deleteMany(source:AsyncIterable<CID> ) `
257
280
258
281
* ` source ` should be an Iterable or AsyncIterable that yields entries of the type [ CID] [ ]
259
282
@@ -269,7 +292,7 @@ This contains a full implementation of [the `interface-datastore` API](https://g
269
292
270
293
Instead of using ` repo.set('config') ` this exposes an API that allows you to set and get a decoded config object, as well as, in a safe manner, change any of the config values individually.
271
294
272
- #### ` Promise repo.config.set(key:string , value) `
295
+ #### ` Promise repo.config.set(key:String , value:Object ) `
273
296
274
297
Set a config value. ` value ` can be any object that is serializable to JSON.
275
298
@@ -281,11 +304,11 @@ const config = await repo.config.get()
281
304
assert .equal (config .a .b .c , ' c value' )
282
305
```
283
306
284
- #### ` Promise repo.config.replace(value) `
307
+ #### ` Promise repo.config.replace(value:Object ) `
285
308
286
309
Set the whole config value. ` value ` can be any object that is serializable to JSON.
287
310
288
- #### ` Promise<?> repo.config.get(key:string ) `
311
+ #### ` Promise<?> repo.config.get(key:String ) `
289
312
290
313
Get a config value. Returned promise resolves to the same type that was set before.
291
314
@@ -379,7 +402,7 @@ Returned promise resolves to a `boolean` indicating the existence of the lock.
379
402
380
403
### Migrations
381
404
382
- When there is a new repo migration and the version of repo is increased, don't
405
+ When there is a new repo migration and the version of the repo is increased, don't
383
406
forget to propagate the changes into the test repo (` test/test-repo ` ).
384
407
385
408
** For tools that run mainly in the browser environment, be aware that disabling automatic
0 commit comments