Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 63ddbf5

Browse files
committed
refactor: ipns routing logic moved to instantiation
1 parent a39770e commit 63ddbf5

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
"dependencies": {
8181
"@nodeutils/defaults-deep": "^1.1.0",
8282
"async": "^2.6.1",
83+
"base32.js": "~0.1.0",
8384
"big.js": "^5.2.2",
8485
"binary-querystring": "~0.1.2",
8586
"bl": "^2.1.2",

src/core/components/pre-start.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const waterfall = require('async/waterfall')
77
const Keychain = require('libp2p-keychain')
88
const defaultsDeep = require('@nodeutils/defaults-deep')
99
const NoKeychain = require('./no-keychain')
10+
11+
const IPNS = require('../ipns')
12+
const OfflineDatastore = require('../ipns/routing/offline-datastore')
13+
1014
/*
1115
* Load stuff from Repo into memory
1216
*/
@@ -95,6 +99,13 @@ module.exports = function preStart (self) {
9599

96100
cb()
97101
},
102+
// Setup offline routing for IPNS.
103+
(cb) => {
104+
const offlineDatastore = new OfflineDatastore(self._repo)
105+
106+
self._ipns = new IPNS(offlineDatastore, self)
107+
cb()
108+
},
98109
(cb) => self.pin._load(cb)
99110
], callback)
100111
}

src/core/ipns/routing/offline-datastore.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
const { Key } = require('interface-datastore')
44
const { encodeBase32 } = require('./utils')
55

6+
<<<<<<< HEAD
67
const errcode = require('err-code')
78
const debug = require('debug')
89
const log = debug('jsipfs:ipns:offline-datastore')
910
log.error = debug('jsipfs:ipns:offline-datastore:error')
1011

12+
=======
13+
>>>>>>> refactor: ipns routing logic moved to instantiation
1114
// Offline datastore aims to mimic the same encoding as routing when storing records
1215
// to the local datastore
1316
class OfflineDatastore {

0 commit comments

Comments
 (0)