Skip to content

Commit 927422a

Browse files
committed
fix!: update blockstore deps
Updates blockstore deps to ones that stream bytes in and out. BREAKING CHANGE: requires latest blockstore implementations
1 parent 7f15baf commit 927422a

File tree

16 files changed

+50
-39
lines changed

16 files changed

+50
-39
lines changed

benchmarks/import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"aegir": "^47.0.16",
16-
"blockstore-core": "^5.0.4",
16+
"blockstore-core": "^6.0.2",
1717
"ipfs-unixfs-importer": "^15.0.0",
1818
"it-buffer-stream": "^3.0.11",
1919
"it-drain": "^3.0.10"

benchmarks/memory/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"devDependencies": {
1515
"aegir": "^47.0.16",
16-
"blockstore-fs": "^2.0.4",
16+
"blockstore-fs": "^3.0.1",
1717
"ipfs-unixfs-importer": "^15.0.0",
1818
"it-drain": "^3.0.10"
1919
},

packages/ipfs-unixfs-exporter/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,31 +143,31 @@
143143
"@ipld/dag-pb": "^4.1.5",
144144
"@multiformats/murmur3": "^2.1.8",
145145
"hamt-sharding": "^3.0.6",
146-
"interface-blockstore": "^5.3.2",
146+
"interface-blockstore": "^6.0.1",
147147
"ipfs-unixfs": "^11.0.0",
148148
"it-filter": "^3.1.4",
149149
"it-last": "^3.0.9",
150150
"it-map": "^3.1.4",
151151
"it-parallel": "^3.0.13",
152152
"it-pipe": "^3.0.1",
153153
"it-pushable": "^3.2.3",
154+
"it-to-buffer": "^4.0.10",
154155
"multiformats": "^13.3.7",
155-
"p-queue": "^8.1.0",
156+
"p-queue": "^9.0.0",
156157
"progress-events": "^1.0.1"
157158
},
158159
"devDependencies": {
159160
"@types/readable-stream": "^4.0.21",
160161
"@types/sinon": "^17.0.4",
161162
"aegir": "^47.0.16",
162-
"blockstore-core": "^5.0.4",
163+
"blockstore-core": "^6.0.2",
163164
"delay": "^6.0.0",
164165
"ipfs-unixfs-importer": "^15.0.0",
165166
"iso-random-stream": "^2.0.2",
166167
"it-all": "^3.0.9",
167168
"it-buffer-stream": "^3.0.11",
168169
"it-drain": "^3.0.10",
169170
"it-first": "^3.0.9",
170-
"it-to-buffer": "^4.0.10",
171171
"merge-options": "^3.0.4",
172172
"readable-stream": "^4.7.0",
173173
"sinon": "^21.0.0",

packages/ipfs-unixfs-exporter/src/resolvers/dag-cbor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import * as dagCbor from '@ipld/dag-cbor'
2+
import toBuffer from 'it-to-buffer'
23
import { resolveObjectPath } from '../utils/resolve-object-path.js'
34
import type { Resolver } from '../index.js'
45

56
const resolve: Resolver = async (cid, name, path, toResolve, resolve, depth, blockstore, options) => {
6-
const block = await blockstore.get(cid, options)
7+
const block = await toBuffer(blockstore.get(cid, options))
78
const object = dagCbor.decode<any>(block)
89

910
return resolveObjectPath(object, block, cid, name, path, toResolve, depth)

packages/ipfs-unixfs-exporter/src/resolvers/dag-json.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import * as dagJson from '@ipld/dag-json'
2+
import toBuffer from 'it-to-buffer'
23
import { resolveObjectPath } from '../utils/resolve-object-path.js'
34
import type { Resolver } from '../index.js'
45

56
const resolve: Resolver = async (cid, name, path, toResolve, resolve, depth, blockstore, options) => {
6-
const block = await blockstore.get(cid, options)
7+
const block = await toBuffer(blockstore.get(cid, options))
78
const object = dagJson.decode<any>(block)
89

910
return resolveObjectPath(object, block, cid, name, path, toResolve, depth)

packages/ipfs-unixfs-exporter/src/resolvers/json.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import toBuffer from 'it-to-buffer'
12
import * as json from 'multiformats/codecs/json'
23
import { resolveObjectPath } from '../utils/resolve-object-path.js'
34
import type { Resolver } from '../index.js'
45

56
const resolve: Resolver = async (cid, name, path, toResolve, resolve, depth, blockstore, options) => {
6-
const block = await blockstore.get(cid, options)
7+
const block = await toBuffer(blockstore.get(cid, options))
78
const object = json.decode<any>(block)
89

910
return resolveObjectPath(object, block, cid, name, path, toResolve, depth)

packages/ipfs-unixfs-exporter/src/resolvers/raw.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import toBuffer from 'it-to-buffer'
12
import { CustomProgressEvent } from 'progress-events'
23
import { NotFoundError } from '../errors.js'
34
import extractDataFromBlock from '../utils/extract-data-from-block.js'
@@ -30,7 +31,7 @@ const resolve: Resolver = async (cid, name, path, toResolve, resolve, depth, blo
3031
throw new NotFoundError(`No link named ${path} found in raw node ${cid}`)
3132
}
3233

33-
const block = await blockstore.get(cid, options)
34+
const block = await toBuffer(blockstore.get(cid, options))
3435

3536
return {
3637
entry: {

packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import map from 'it-map'
44
import parallel from 'it-parallel'
55
import { pipe } from 'it-pipe'
66
import { pushable } from 'it-pushable'
7+
import toBuffer from 'it-to-buffer'
78
import * as raw from 'multiformats/codecs/raw'
89
import PQueue from 'p-queue'
910
import { CustomProgressEvent } from 'progress-events'
@@ -76,7 +77,7 @@ async function walkDAG (blockstore: ReadableStorage, node: dagPb.PBNode | Uint8A
7677
childOps,
7778
(source) => map(source, (op) => {
7879
return async () => {
79-
const block = await blockstore.get(op.link.Hash, options)
80+
const block = await toBuffer(blockstore.get(op.link.Hash, options))
8081

8182
return {
8283
...op,

packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { UnixFS } from 'ipfs-unixfs'
33
import map from 'it-map'
44
import parallel from 'it-parallel'
55
import { pipe } from 'it-pipe'
6+
import toBuffer from 'it-to-buffer'
67
import { CustomProgressEvent } from 'progress-events'
78
import { NotUnixFSError } from '../../../errors.js'
89
import { isBasicExporterOptions } from '../../../utils/is-basic-exporter-options.ts'
@@ -73,7 +74,7 @@ async function * listDirectory (node: PBNode, path: string, resolve: Resolve, de
7374
}
7475
} else {
7576
// descend into subshard
76-
const block = await blockstore.get(link.Hash, options)
77+
const block = await toBuffer(blockstore.get(link.Hash, options))
7778
node = decode(block)
7879

7980
options.onProgress?.(new CustomProgressEvent<ExportWalk>('unixfs:exporter:walk:hamt-sharded-directory', {

packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { decode } from '@ipld/dag-pb'
22
import { UnixFS } from 'ipfs-unixfs'
3+
import toBuffer from 'it-to-buffer'
34
import { NotFoundError, NotUnixFSError } from '../../errors.js'
45
import findShardCid from '../../utils/find-cid-in-shard.js'
56
import { isBasicExporterOptions } from '../../utils/is-basic-exporter-options.ts'
@@ -43,7 +44,7 @@ const unixFsResolver: Resolver = async (cid, name, path, toResolve, resolve, dep
4344
}
4445
}
4546

46-
const block = await blockstore.get(cid, options)
47+
const block = await toBuffer(blockstore.get(cid, options))
4748
const node = decode(block)
4849
let unixfs
4950
let next

0 commit comments

Comments
 (0)