Skip to content

Commit e3cd08d

Browse files
author
Alan Shaw
committed
fix: default cid version to 0 temporarily
Currently we cannot default CID version to 1 in MFS write as read will hang. ipfs-inactive/js-ipfs-mfs#12 License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent 09217bc commit e3cd08d

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

API.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ Write data to an MFS (Mutable File System) file.
438438
| options.parents | `Boolean` | Create parent directories if not exists, default: `false` |
439439
| options.truncate | `Boolean` | Truncate the file after writing, default: `false` |
440440
| options.rawLeaves | `Boolean` | Do not wrap leaf nodes in a protobuf, default: `false` |
441-
| options.cidVersion | `Number` | CID version to use when creating the node(s), default: 1 |
441+
| options.cidVersion | `Number` | CID version to use when creating the node(s), default: ~~1~~ FIXME: currently 0 due to https://github.com/ipfs/js-ipfs-mfs/issues/12 |
442442

443443
#### Returns
444444

src/write.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module.exports = backend => {
66
input = toIterable(input)
77
options = options || {}
88
options.create = options.create == null ? true : options.create
9-
options.cidVersion = options.cidVersion == null ? 1 : options.cidVersion
9+
// FIXME: https://github.com/ipfs/js-ipfs-mfs/issues/12
10+
options.cidVersion = options.cidVersion == null ? 0 : options.cidVersion
1011

1112
const inputGenerator = async function * () {
1213
for await (const chunk of input) {

test/helpers/port-service/server.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ const PortManager = require('port-manager')
77
const shortid = require('shortid')
88
const { DEFAULT_PORT_SERVICE_ADDR } = require('./')
99

10-
const AutoReleaseHeartbeat = 5000
11-
1210
module.exports = async addr => {
1311
addr = Multiaddr(addr || process.env.PORT_SERVICE_ADDR || DEFAULT_PORT_SERVICE_ADDR)
1412

1513
if (!addr.protoNames().includes('http')) {
1614
throw new Error('invalid protocol')
1715
}
1816

19-
const portManager = new PortManager(AutoReleaseHeartbeat).include(3000, 9999)
17+
const portManager = new PortManager().include(3000, 9999)
2018

2119
const claim = name => new Promise((resolve, reject) => {
2220
portManager.claim(name, (err, service) => {
@@ -34,6 +32,7 @@ module.exports = async addr => {
3432

3533
const queue = new Queue(1)
3634

35+
// TODO: implement release endpoint so we don't run out of ports!
3736
const handler = req => {
3837
const queryParams = QueryString.parse(req.url.split('?')[1] || '')
3938
const numPorts = getNumPorts(queryParams)

test/write.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test('should write from iterator of buffer', async t => {
4242

4343
test('should write from async iterator of buffer', async t => {
4444
const { node } = t.context
45-
const path = `/test-write-iterator-${Date.now()}.txt`
45+
const path = `/test-write-async-iterator-${Date.now()}.txt`
4646
const data = randomArray(1, 100, () => randomBytes(randomInteger(1, 64)))
4747
const iterator = async function * () {
4848
for (let i = 0; i < data.length; i++) {

0 commit comments

Comments
 (0)