1
- import $protobuf from "protobufjs/minimal.js"
2
-
3
- // @ts -expect-error Explicitly disable long.js support
4
- $protobuf . util . Long = undefined
5
- $protobuf . configure ( )
6
-
1
+ import $protobuf from 'protobufjs/minimal.js'
7
2
import { Key } from 'interface-datastore/key'
8
3
import { Protocols } from './pb/proto-book.js'
9
4
import { Addresses } from './pb/address-book.js'
@@ -12,9 +7,13 @@ import { Envelope } from './pb/envelope.js'
12
7
import { PeerRecord } from './pb/peer-record.js'
13
8
import { multiaddr } from '@multiformats/multiaddr'
14
9
10
+ // @ts -expect-error Explicitly disable long.js support
11
+ $protobuf . util . Long = undefined
12
+ $protobuf . configure ( )
13
+
15
14
/**
16
- * @param {import('../../src/ types').Backends } backends
17
- * @param {import('../../src/ types').MigrationProgressCallback } onProgress
15
+ * @param {import('../../types').Backends } backends
16
+ * @param {import('../../types').MigrationProgressCallback } onProgress
18
17
*/
19
18
async function storePeerUnderSingleDatastoreKey ( backends , onProgress = ( ) => { } ) {
20
19
onProgress ( 0 , 'Storing each peerstore key under a single datastore key' )
@@ -31,7 +30,7 @@ async function storePeerUnderSingleDatastoreKey (backends, onProgress = () => {}
31
30
} ) ) {
32
31
keys . push ( key )
33
32
const keyStr = key . toString ( )
34
- const [ _ , prefix , type , peerId , metadataKey ] = keyStr . split ( '/' )
33
+ const [ , prefix , type , peerId , metadataKey ] = keyStr . split ( '/' )
35
34
36
35
if ( prefix !== 'peers' ) {
37
36
continue
@@ -95,8 +94,8 @@ async function storePeerUnderSingleDatastoreKey (backends, onProgress = () => {}
95
94
}
96
95
97
96
/**
98
- * @param {import('../../src/ types').Backends } backends
99
- * @param {import('../../src/ types').MigrationProgressCallback } onProgress
97
+ * @param {import('../../types').Backends } backends
98
+ * @param {import('../../types').MigrationProgressCallback } onProgress
100
99
*/
101
100
async function storePeerUnderMultipleDatastoreKeys ( backends , onProgress = ( ) => { } ) {
102
101
onProgress ( 0 , 'Storing each peerstore key under a multiple datastore keys' )
@@ -114,7 +113,7 @@ async function storePeerUnderMultipleDatastoreKeys (backends, onProgress = () =>
114
113
keys . push ( key )
115
114
const keyStr = key . toString ( )
116
115
117
- const [ _ , _prefix , peerId ] = keyStr . split ( '/' )
116
+ const [ , , peerId ] = keyStr . split ( '/' )
118
117
119
118
peers [ peerId ] = Peer . decode ( value )
120
119
}
@@ -170,7 +169,7 @@ async function storePeerUnderMultipleDatastoreKeys (backends, onProgress = () =>
170
169
onProgress ( 100 , 'Stored each peerstore key under multiple datastore keys' )
171
170
}
172
171
173
- /** @type {import('../../src/ types').Migration } */
172
+ /** @type {import('../../types').Migration } */
174
173
export const migration = {
175
174
version : 12 ,
176
175
description : 'Store each peerstore peer under a single datastore key' ,
0 commit comments