Browse Source

update bin script and add swarm and mount as optional dependencies

Kieran Gibb 2 years ago
parent
commit
4876bd8f45
No known key found for this signature in database
6 changed files with 262 additions and 213 deletions
  1. 19
    11
      README.md
  2. 66
    20
      bin.js
  3. 0
    1
      index.js
  4. 163
    157
      package-lock.json
  5. 8
    8
      package.json
  6. 6
    16
      swarm.js

+ 19
- 11
README.md View File

@@ -1,9 +1,21 @@
1
-# peer-fs
1
+# kappa-drive
2 2
 
3
-A multiwriter peer-to-peer filesystem built on [`kappa-core`](https://github.com/kappa-db/kappa-core). Supports [Hyperdrive V10](https://github.com/mafintosh/hyperdrive/). Also known as 'kappa-drive'
3
+A multiwriter peer-to-peer filesystem built on [`kappa-core`](https://github.com/kappa-db/kappa-core).
4
+
5
+Supports [Hyperdrive V10](https://github.com/mafintosh/hyperdrive/). Originally known as 'peerfs'.
4 6
 
5 7
 Designed to be compatible with [`hyperdrive-fuse`](https://github.com/andrewosh/hyperdrive-fuse/)
6 8
 
9
+## Installation
10
+
11
+```
12
+# with optional dependencies includes FUSE and discovery swarm for the CLI script to work
13
+npm install
14
+
15
+# without the fluff, just a raw kappa-drive
16
+npm install --no-optional
17
+```
18
+
7 19
 ## Usage
8 20
 
9 21
 ```js
@@ -151,16 +163,12 @@ Please add issues here: https://ledger-git.dyne.org/CoBox/kappa-drive/issues
151 163
 
152 164
 ## License
153 165
 
154
-AGPL3
155
-
156
-## Credit
166
+AGPL-3.0.0-or-later
157 167
 
158
-Huge credit to [Karissa](https://github.com/karissa) for ideating and writing [peerfs](https://github.com/karissa/peerfs) and allowing us to run with it and complete the API.
168
+## Credit & Thanks
159 169
 
160
-:black_heart: :purple_heart: :green_heart:
170
+Huge credit to [Karissa](https://github.com/karissa) for ideating and writing [peerfs](https://github.com/karissa/peerfs) and allowing us to continue the project and complete the API.
161 171
 
162
-## TODO
172
+Thanks to [Frando](https://github.com/frando) for helping with the recent upgrade to [kappa-core](https://github.com/frando/kappa-core) and [kappa-sparse-indexer](https://github.com/frando/kappa-sparse-indexer).
163 173
 
164
-- [ ] Allow resolveFork function to get access to the stat object of the file on that write so that it can make a more intelligent display or make better decisions about the fork
165
-- [ ] Allow forks to be unresolved cc @substack
166
-- [ ] When writing, in the link we should record the seq of the hyperdrive, and on `whoHasFile`, checkout to that seq if its not the latest
174
+:purple_heart: :green_heart:

+ 66
- 20
bin.js View File

@@ -1,35 +1,81 @@
1 1
 #!/usr/bin/env node
2 2
 const minimist = require('minimist')
3
-const ram = require('random-access-memory')
3
+const RAM = require('random-access-memory')
4
+const discovery = require('discovery-swarm')
5
+const pump = require('pump')
6
+const config = require('dat-swarm-defaults')
4 7
 const path = require('path')
5 8
 const level = require('level')
6 9
 const memdb = require('memdb')
7 10
 const mkdirp = require('mkdirp')
11
+const mount = require('kappa-drive-mount')
8 12
 
9 13
 const swarm = require('./swarm')
10
-const mount = require('./mount')
11 14
 const KappaDrive = require('./')
12 15
 
13
-const STORAGE = (p) => path.resolve(p)
14
-const VIEWS = (p) => path.join(STORAGE(p), 'views')
16
+Application(minimist(process.argv.slice(2)))
15 17
 
16
-const argv = minimist(process.argv.slice(2))
18
+function Application (opts) {
19
+  var drive = KappaDrive(
20
+    defaultStorage(opts.db),
21
+    opts.key,
22
+    defaultViews(opts.db)
23
+  )
17 24
 
18
-if (argv.db) {
19
-  var storage = argv.db ? STORAGE(argv.db) : ram
20
-  mkdirp.sync(VIEWS(argv.db))
21
-  var views = level(VIEWS(argv.db))
22
-} else {
23
-  var storage = ram
24
-  var views = memdb()
25
-}
25
+  var dir = opts.mount || './mnt'
26
+
27
+  drive.ready(() => {
28
+    console.log(`drive key: ${hex(drive.key)}`)
29
+    mount(drive, dir, (err, unmount) => {
30
+      var swarm = Swarm(drive)
31
+
32
+      process.on('SIGINT', () => {
33
+        console.log("dropping remote connections and leaving the swarm")
34
+        swarm.leave(drive.discoveryKey)
35
+        swarm.destroy(() => {
36
+          console.log("unmounting FUSE and closing the drive")
37
+          unmount(() => {
38
+            drive.close()
39
+          })
40
+        })
41
+      })
42
+    })
43
+  })
44
+
45
+  function defaultStorage (storage) {
46
+    return storage ? path.resolve(storage) : RAM
47
+  }
48
+
49
+  function defaultViews (storage) {
50
+    if (storage) {
51
+      var views = path.join(path.resolve(storage), 'views')
52
+      mkdirp.sync(views)
53
+      return level(views)
54
+    }
55
+    return memdb()
56
+  }
57
+
58
+  function Swarm (drive, opts = {}) {
59
+    var swarm = discovery(config())
60
+    swarm.join(drive.discoveryKey)
61
+    console.log(`swarming on ${hex(drive.discoveryKey)}`)
26 62
 
27
-var mountdir = argv.mount || './mnt'
28
-var key = argv.key ? Buffer.from(argv.key, 'hex') : null
63
+    swarm.on('connection', (connection, peer) => {
64
+      console.log(`connnected to peer: ${hex(peer.id)}`)
29 65
 
30
-var drive = KappaDrive(storage, key, { db: views })
66
+      pump(connection, drive.replicate(true, { live: true }), connection)
31 67
 
32
-drive.ready(() => {
33
-  mount(drive, mountdir)
34
-  swarm(drive)
35
-})
68
+      drive.feeds.on('feed', (feed) => {
69
+        console.log(`new feed created: ${hex(feed.key)}`)
70
+      })
71
+    })
72
+
73
+    return swarm
74
+  }
75
+
76
+}
77
+
78
+function hex (buf) {
79
+  if (Buffer.isBuffer(buf)) return buf.toString('hex')
80
+  return buf
81
+}

+ 0
- 1
index.js View File

@@ -19,7 +19,6 @@ const fs = require('fs')
19 19
 const protobuf = require('protocol-buffers')
20 20
 const path = require('path')
21 21
 const errors = require('hyperdrive/lib/errors')
22
-const thunky = require('thunky')
23 22
 const maybe = require('call-me-maybe')
24 23
 const assert = require('assert')
25 24
 const sub = require('subleveldown')

+ 163
- 157
package-lock.json View File

@@ -110,48 +110,6 @@
110 110
         "to-fast-properties": "^2.0.0"
111 111
       }
112 112
     },
113
-    "@hyperswarm/dht": {
114
-      "version": "3.0.0",
115
-      "resolved": "https://registry.npmjs.org/@hyperswarm/dht/-/dht-3.0.0.tgz",
116
-      "integrity": "sha512-x3fwXtCkyjfevSjNkS2uanEZxGpJ3pcHPHXJN1JuIhQEdRj3L2CYFAGttkWOoT6Mtz19YXvLaf7wI4w6C/68Lg==",
117
-      "requires": {
118
-        "@hyperswarm/hypersign": "^2.0.0",
119
-        "dht-rpc": "^4.1.6",
120
-        "end-of-stream": "^1.4.1",
121
-        "hashlru": "^2.3.0",
122
-        "ipv4-peers": "^2.0.0",
123
-        "protocol-buffers-encodings": "^1.1.0",
124
-        "record-cache": "^1.1.0",
125
-        "sodium-universal": "^2.0.0"
126
-      }
127
-    },
128
-    "@hyperswarm/discovery": {
129
-      "version": "1.7.0",
130
-      "resolved": "https://registry.npmjs.org/@hyperswarm/discovery/-/discovery-1.7.0.tgz",
131
-      "integrity": "sha512-eXMOh+Sb7P+SdfoZxLOeRiy5SlJHOODLrfQIePfrV+mUp6LRfaG07R9osjeXq2tA7LEKATJK9TXFB56erYA1zw==",
132
-      "requires": {
133
-        "@hyperswarm/dht": "^3.0.0",
134
-        "multicast-dns": "^7.2.0"
135
-      }
136
-    },
137
-    "@hyperswarm/hypersign": {
138
-      "version": "2.0.0",
139
-      "resolved": "https://registry.npmjs.org/@hyperswarm/hypersign/-/hypersign-2.0.0.tgz",
140
-      "integrity": "sha512-CWDNRAF/5aL7ocZkr/I8y2HWCB1RX3fvvObQn1ExAZ3ha7grApzaSrEt0Q3bqzQXeSEXNerx6dquXhAVOOZXFA==",
141
-      "requires": {
142
-        "sodium-universal": "^2.0.0"
143
-      }
144
-    },
145
-    "@hyperswarm/network": {
146
-      "version": "1.1.2",
147
-      "resolved": "https://registry.npmjs.org/@hyperswarm/network/-/network-1.1.2.tgz",
148
-      "integrity": "sha512-LMb29j0Hn/1tOr+u+HhgHaKAkbxeb2WRPSrJ3ZhdbxbkKLb+O9b+ewKpFMBDczk79gb0GwgfSkxhFDb5w0Hp0Q==",
149
-      "requires": {
150
-        "@hyperswarm/discovery": "^1.6.0",
151
-        "nanoresource": "^1.0.0",
152
-        "utp-native": "^2.1.3"
153
-      }
154
-    },
155 113
     "abstract-extension": {
156 114
       "version": "3.1.0",
157 115
       "resolved": "https://registry.npmjs.org/abstract-extension/-/abstract-extension-3.1.0.tgz",
@@ -164,6 +122,7 @@
164 122
       "version": "6.0.3",
165 123
       "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz",
166 124
       "integrity": "sha512-jzewKKpZbaYUa6HTThnrl+GrJhzjEAeuc7hTVpZdzg7kupXZFoqQDFwyOwLNbmJKJlmzw8yiipMPkDiuKkT06Q==",
125
+      "optional": true,
167 126
       "requires": {
168 127
         "level-concat-iterator": "~2.0.0",
169 128
         "xtend": "~4.0.0"
@@ -232,13 +191,13 @@
232 191
     "balanced-match": {
233 192
       "version": "1.0.0",
234 193
       "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
235
-      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
236
-      "dev": true
194
+      "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
237 195
     },
238 196
     "bencode": {
239 197
       "version": "1.0.0",
240 198
       "resolved": "https://registry.npmjs.org/bencode/-/bencode-1.0.0.tgz",
241 199
       "integrity": "sha512-N+VOSP5MkoX+xgnp6Y056iCY5TmCZg9rgPNPQe0bIiXchxYFP4vs/Tf0dTdQ+qQhP7HM2gvfFq+sUVjQsGy5Zw==",
200
+      "optional": true,
242 201
       "requires": {
243 202
         "safe-buffer": "^5.1.1"
244 203
       }
@@ -256,6 +215,7 @@
256 215
       "version": "7.10.0",
257 216
       "resolved": "https://registry.npmjs.org/bittorrent-dht/-/bittorrent-dht-7.10.0.tgz",
258 217
       "integrity": "sha512-fvb6M58Ceiv/S94nu6zeaiMoJvUYOeIqRbgaClm+kJTzCAqJPtAR/31pXNYB5iEReOoKqQB5zY33gY0W6ZRWQQ==",
218
+      "optional": true,
259 219
       "requires": {
260 220
         "bencode": "^1.0.0",
261 221
         "buffer-equals": "^1.0.3",
@@ -273,6 +233,7 @@
273 233
           "version": "3.2.6",
274 234
           "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
275 235
           "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
236
+          "optional": true,
276 237
           "requires": {
277 238
             "ms": "^2.1.1"
278 239
           }
@@ -300,7 +261,6 @@
300 261
       "version": "1.1.11",
301 262
       "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
302 263
       "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
303
-      "dev": true,
304 264
       "requires": {
305 265
         "balanced-match": "^1.0.0",
306 266
         "concat-map": "0.0.1"
@@ -323,7 +283,8 @@
323 283
     "buffer-equals": {
324 284
       "version": "1.0.4",
325 285
       "resolved": "https://registry.npmjs.org/buffer-equals/-/buffer-equals-1.0.4.tgz",
326
-      "integrity": "sha1-A1O1T9B/2VZBcGca5vZrnPENJ/U="
286
+      "integrity": "sha1-A1O1T9B/2VZBcGca5vZrnPENJ/U=",
287
+      "optional": true
327 288
     },
328 289
     "buffer-fill": {
329 290
       "version": "1.0.0",
@@ -434,6 +395,7 @@
434 395
       "version": "3.0.4",
435 396
       "resolved": "https://registry.npmjs.org/chrome-dgram/-/chrome-dgram-3.0.4.tgz",
436 397
       "integrity": "sha512-G8rOANSvSRC4hGny/K/ec1gXtNuZGzryFeoev49u0J4g/qws7H25vMKQlbD9izuedFVHwXFTdKQG62Tf/7Cmwg==",
398
+      "optional": true,
437 399
       "requires": {
438 400
         "inherits": "^2.0.1",
439 401
         "run-series": "^1.1.2"
@@ -443,6 +405,7 @@
443 405
       "version": "1.0.1",
444 406
       "resolved": "https://registry.npmjs.org/chrome-dns/-/chrome-dns-1.0.1.tgz",
445 407
       "integrity": "sha512-HqsYJgIc8ljJJOqOzLphjAs79EUuWSX3nzZi2LNkzlw3GIzAeZbaSektC8iT/tKvLqZq8yl1GJu5o6doA4TRbg==",
408
+      "optional": true,
446 409
       "requires": {
447 410
         "chrome-net": "^3.3.2"
448 411
       }
@@ -451,6 +414,7 @@
451 414
       "version": "3.3.3",
452 415
       "resolved": "https://registry.npmjs.org/chrome-net/-/chrome-net-3.3.3.tgz",
453 416
       "integrity": "sha512-11jL8+Ogna8M5TEdyalE8IG6cpaFEU3YcaxAj3YjZKjRM/PeT70pZbrUY+xoGwqiEJZwJE4Td2CvGxUvS9ytKQ==",
417
+      "optional": true,
454 418
       "requires": {
455 419
         "inherits": "^2.0.1"
456 420
       }
@@ -459,6 +423,7 @@
459 423
       "version": "1.0.1",
460 424
       "resolved": "https://registry.npmjs.org/circular-append-file/-/circular-append-file-1.0.1.tgz",
461 425
       "integrity": "sha512-BUDFvrBTCdeVhg9E05PX4XgMegk6xWB69uGwyuATEg7PMfa9lGU1mzFSK0xWNW2O0i9CAQHN0oIdXI/kI2hPkg==",
426
+      "optional": true,
462 427
       "requires": {
463 428
         "multistream": "^2.1.0"
464 429
       }
@@ -524,8 +489,7 @@
524 489
     "concat-map": {
525 490
       "version": "0.0.1",
526 491
       "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
527
-      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
528
-      "dev": true
492
+      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
529 493
     },
530 494
     "concat-stream": {
531 495
       "version": "1.6.2",
@@ -541,7 +505,8 @@
541 505
     "connections": {
542 506
       "version": "1.4.2",
543 507
       "resolved": "https://registry.npmjs.org/connections/-/connections-1.4.2.tgz",
544
-      "integrity": "sha1-eJBIK/XHGvbFyhkr4xNq7XRCiq0="
508
+      "integrity": "sha1-eJBIK/XHGvbFyhkr4xNq7XRCiq0=",
509
+      "optional": true
545 510
     },
546 511
     "contains-path": {
547 512
       "version": "1.0.0",
@@ -683,7 +648,8 @@
683 648
     "dat-swarm-defaults": {
684 649
       "version": "1.0.2",
685 650
       "resolved": "https://registry.npmjs.org/dat-swarm-defaults/-/dat-swarm-defaults-1.0.2.tgz",
686
-      "integrity": "sha512-gz9RuhUxq3coYBrelzuFXCNyC579aO3Bm1Wlwa12/9tJr1NP0AAGxpHJYA1HZvt8X7ZdrtMzpFyNvs2Y9PFG6w=="
651
+      "integrity": "sha512-gz9RuhUxq3coYBrelzuFXCNyC579aO3Bm1Wlwa12/9tJr1NP0AAGxpHJYA1HZvt8X7ZdrtMzpFyNvs2Y9PFG6w==",
652
+      "optional": true
687 653
     },
688 654
     "debug": {
689 655
       "version": "4.1.1",
@@ -774,35 +740,11 @@
774 740
         }
775 741
       }
776 742
     },
777
-    "dht-rpc": {
778
-      "version": "4.1.7",
779
-      "resolved": "https://registry.npmjs.org/dht-rpc/-/dht-rpc-4.1.7.tgz",
780
-      "integrity": "sha512-XXSqvWXp80EpT24f0nJvwsvgXW2T1F/Upa2X7Wd9KZPO2BY5N2EmckynnwKYkQwuOwhilzDbjR1RUvSQ2tu0Hw==",
781
-      "requires": {
782
-        "codecs": "^2.0.0",
783
-        "ipv4-peers": "^2.0.0",
784
-        "k-bucket": "^5.0.0",
785
-        "protocol-buffers-encodings": "^1.1.0",
786
-        "sodium-universal": "^2.0.0",
787
-        "stream-collector": "^1.0.1",
788
-        "time-ordered-set": "^1.0.1",
789
-        "xor-distance": "^2.0.0"
790
-      },
791
-      "dependencies": {
792
-        "k-bucket": {
793
-          "version": "5.0.0",
794
-          "resolved": "https://registry.npmjs.org/k-bucket/-/k-bucket-5.0.0.tgz",
795
-          "integrity": "sha512-r/q+wV/Kde62/tk+rqyttEJn6h0jR7x+incdMVSYTqK73zVxVrzJa70kJL49cIKen8XjIgUZKSvk8ktnrQbK4w==",
796
-          "requires": {
797
-            "randombytes": "^2.0.3"
798
-          }
799
-        }
800
-      }
801
-    },
802 743
     "discovery-channel": {
803 744
       "version": "5.5.1",
804 745
       "resolved": "https://registry.npmjs.org/discovery-channel/-/discovery-channel-5.5.1.tgz",
805 746
       "integrity": "sha512-EEmZQFE0PiOsJj7G3KVCwFGbYs4QchUvzA91iHtZ6HfkIqfBEDSTGLygJrUlY1Tr77WDV+qZVrZuNghHxSL/vw==",
747
+      "optional": true,
806 748
       "requires": {
807 749
         "bittorrent-dht": "^7.10.0",
808 750
         "buffer-from": "^1.0.0",
@@ -816,6 +758,7 @@
816 758
           "version": "2.6.9",
817 759
           "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
818 760
           "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
761
+          "optional": true,
819 762
           "requires": {
820 763
             "ms": "2.0.0"
821 764
           }
@@ -823,12 +766,14 @@
823 766
         "ms": {
824 767
           "version": "2.0.0",
825 768
           "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
826
-          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
769
+          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
770
+          "optional": true
827 771
         },
828 772
         "thunky": {
829 773
           "version": "0.1.0",
830 774
           "resolved": "https://registry.npmjs.org/thunky/-/thunky-0.1.0.tgz",
831
-          "integrity": "sha1-vzAUaCTituZ7Dy16Ssi+smkIaE4="
775
+          "integrity": "sha1-vzAUaCTituZ7Dy16Ssi+smkIaE4=",
776
+          "optional": true
832 777
         }
833 778
       }
834 779
     },
@@ -836,6 +781,7 @@
836 781
       "version": "6.0.0",
837 782
       "resolved": "https://registry.npmjs.org/discovery-swarm/-/discovery-swarm-6.0.0.tgz",
838 783
       "integrity": "sha512-ByfwygfLCB4umpSBVz9tGxgmng1D3YWg6A80cip8dgdpC5dRyGsL5w6KoC9srQ15xydKtYPgcxUC2YtSzPCtHA==",
784
+      "optional": true,
839 785
       "requires": {
840 786
         "connections": "^1.4.2",
841 787
         "debug": "^4.1.1",
@@ -850,6 +796,7 @@
850 796
       "version": "6.2.3",
851 797
       "resolved": "https://registry.npmjs.org/dns-discovery/-/dns-discovery-6.2.3.tgz",
852 798
       "integrity": "sha512-ZULG1R5J9QHZfaXo5XFGVG22LIcnZorbEa7f83FYgCGDaQrVfyVmty3Z89OvBLpCPetwW+LzjCcT60ekhbQ+9g==",
799
+      "optional": true,
853 800
       "requires": {
854 801
         "circular-append-file": "^1.0.1",
855 802
         "debug": "^2.6.9",
@@ -867,6 +814,7 @@
867 814
           "version": "2.6.9",
868 815
           "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
869 816
           "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
817
+          "optional": true,
870 818
           "requires": {
871 819
             "ms": "2.0.0"
872 820
           }
@@ -875,6 +823,7 @@
875 823
           "version": "2.0.1",
876 824
           "resolved": "https://registry.npmjs.org/lru/-/lru-2.0.1.tgz",
877 825
           "integrity": "sha1-+XmHHhYuP1yiVL5GhExT1MU2RUQ=",
826
+          "optional": true,
878 827
           "requires": {
879 828
             "inherits": "^2.0.1"
880 829
           }
@@ -882,12 +831,14 @@
882 831
         "ms": {
883 832
           "version": "2.0.0",
884 833
           "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
885
-          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
834
+          "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
835
+          "optional": true
886 836
         },
887 837
         "unordered-set": {
888 838
           "version": "1.1.0",
889 839
           "resolved": "https://registry.npmjs.org/unordered-set/-/unordered-set-1.1.0.tgz",
890
-          "integrity": "sha1-K6fvMW7dC5WQzFR8dPdqLxZP7Mo="
840
+          "integrity": "sha1-K6fvMW7dC5WQzFR8dPdqLxZP7Mo=",
841
+          "optional": true
891 842
         }
892 843
       }
893 844
     },
@@ -895,6 +846,7 @@
895 846
       "version": "4.2.0",
896 847
       "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-4.2.0.tgz",
897 848
       "integrity": "sha512-bn1AKpfkFbm0MIioOMHZ5qJzl2uypdBwI4nYNsqvhjsegBhcKJUlCrMPWLx6JEezRjxZmxhtIz/FkBEur2l8Cw==",
849
+      "optional": true,
898 850
       "requires": {
899 851
         "ip": "^1.1.5",
900 852
         "safe-buffer": "^5.1.1"
@@ -904,6 +856,7 @@
904 856
       "version": "3.0.0",
905 857
       "resolved": "https://registry.npmjs.org/dns-socket/-/dns-socket-3.0.0.tgz",
906 858
       "integrity": "sha512-M0WkByoJ/mTm+HtwBQLsRJPe5uGIC/lYVOp+s6ZzhbZ5iq4GxjFyxYPQhB85dgCLvVb43aJQXHDC9aUgyKGc/Q==",
859
+      "optional": true,
907 860
       "requires": {
908 861
         "dns-packet": "^4.1.0"
909 862
       }
@@ -1036,11 +989,6 @@
1036 989
       "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
1037 990
       "dev": true
1038 991
     },
1039
-    "events": {
1040
-      "version": "3.0.0",
1041
-      "resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz",
1042
-      "integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA=="
1043
-    },
1044 992
     "fast-bitfield": {
1045 993
       "version": "1.2.2",
1046 994
       "resolved": "https://registry.npmjs.org/fast-bitfield/-/fast-bitfield-1.2.2.tgz",
@@ -1134,8 +1082,7 @@
1134 1082
     "fs.realpath": {
1135 1083
       "version": "1.0.0",
1136 1084
       "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
1137
-      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
1138
-      "dev": true
1085
+      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
1139 1086
     },
1140 1087
     "function-bind": {
1141 1088
       "version": "1.1.1",
@@ -1147,6 +1094,61 @@
1147 1094
       "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
1148 1095
       "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
1149 1096
     },
1097
+    "fuse-native": {
1098
+      "version": "2.0.2",
1099
+      "resolved": "https://registry.npmjs.org/fuse-native/-/fuse-native-2.0.2.tgz",
1100
+      "integrity": "sha512-+fuyIPNEmXU4ehrYJiPDpfC/ZEr5NlncfQ0H+CqJrAMu//7lP46faH9/QgmWmVcZvVjs1i478Sl2IQzkxa+CUQ==",
1101
+      "optional": true,
1102
+      "requires": {
1103
+        "fuse-shared-library": "^1.0.2",
1104
+        "nanoresource": "^1.3.0",
1105
+        "napi-macros": "^2.0.0",
1106
+        "node-gyp-build": "^4.2.0"
1107
+      },
1108
+      "dependencies": {
1109
+        "napi-macros": {
1110
+          "version": "2.0.0",
1111
+          "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz",
1112
+          "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==",
1113
+          "optional": true
1114
+        },
1115
+        "node-gyp-build": {
1116
+          "version": "4.2.0",
1117
+          "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.0.tgz",
1118
+          "integrity": "sha512-4oiumOLhCDU9Rronz8PZ5S4IvT39H5+JEv/hps9V8s7RSLhsac0TCP78ulnHXOo8X1wdpPiTayGlM1jr4IbnaQ==",
1119
+          "optional": true
1120
+        }
1121
+      }
1122
+    },
1123
+    "fuse-shared-library": {
1124
+      "version": "1.1.1",
1125
+      "resolved": "https://registry.npmjs.org/fuse-shared-library/-/fuse-shared-library-1.1.1.tgz",
1126
+      "integrity": "sha512-EfgTo/eS1euZFUe7x8KqyA40hV4DwP7kqp1VNZApu2nlPnJv8SanraBE3VXyX7ff41sxw7M0oWY7re3G3wnZVA==",
1127
+      "optional": true,
1128
+      "requires": {
1129
+        "fuse-shared-library-darwin": "^1.0.3",
1130
+        "fuse-shared-library-linux": "^1.0.1",
1131
+        "fuse-shared-library-linux-arm": "^1.0.0"
1132
+      }
1133
+    },
1134
+    "fuse-shared-library-darwin": {
1135
+      "version": "1.0.3",
1136
+      "resolved": "https://registry.npmjs.org/fuse-shared-library-darwin/-/fuse-shared-library-darwin-1.0.3.tgz",
1137
+      "integrity": "sha512-CrQaTriJeFKns/vEK4rFpjdlM3HrDJwD+UINGPc2ArYq57+6EF/R36puQ4BUV/Uyn79Oxu356Iogtq3VqhKeJg==",
1138
+      "optional": true
1139
+    },
1140
+    "fuse-shared-library-linux": {
1141
+      "version": "1.0.1",
1142
+      "resolved": "https://registry.npmjs.org/fuse-shared-library-linux/-/fuse-shared-library-linux-1.0.1.tgz",
1143
+      "integrity": "sha512-07MQRSobrBKwW4D7oKm0gM2TwgvZWb+gC08JdiYDG4KBTncxk9ssqEDiDMKll8hpseZufsY2w1yc/feOu2DPmQ==",
1144
+      "optional": true
1145
+    },
1146
+    "fuse-shared-library-linux-arm": {
1147
+      "version": "1.0.0",
1148
+      "resolved": "https://registry.npmjs.org/fuse-shared-library-linux-arm/-/fuse-shared-library-linux-arm-1.0.0.tgz",
1149
+      "integrity": "sha512-Dj4ssxo1/MKGvOsVWRblSRu+o5F5OJTrVPDkjSyGDU2yKvVnIzQSwy1deiWA0qCcS/Q8iJMlZaCpCcZWSwvoug==",
1150
+      "optional": true
1151
+    },
1150 1152
     "generate-function": {
1151 1153
       "version": "2.3.1",
1152 1154
       "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
@@ -1173,7 +1175,6 @@
1173 1175
       "version": "7.1.6",
1174 1176
       "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
1175 1177
       "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
1176
-      "dev": true,
1177 1178
       "requires": {
1178 1179
         "fs.realpath": "^1.0.0",
1179 1180
         "inflight": "^1.0.4",
@@ -1260,11 +1261,6 @@
1260 1261
         "is-stream": "^1.0.1"
1261 1262
       }
1262 1263
     },
1263
-    "hashlru": {
1264
-      "version": "2.3.0",
1265
-      "resolved": "https://registry.npmjs.org/hashlru/-/hashlru-2.3.0.tgz",
1266
-      "integrity": "sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A=="
1267
-    },
1268 1264
     "hmac-blake2b": {
1269 1265
       "version": "0.2.0",
1270 1266
       "resolved": "https://registry.npmjs.org/hmac-blake2b/-/hmac-blake2b-0.2.0.tgz",
@@ -1493,22 +1489,22 @@
1493 1489
         }
1494 1490
       }
1495 1491
     },
1492
+    "hyperdrive-fuse": {
1493
+      "version": "1.2.1",
1494
+      "resolved": "https://registry.npmjs.org/hyperdrive-fuse/-/hyperdrive-fuse-1.2.1.tgz",
1495
+      "integrity": "sha512-hiIiNLJaLP+nexHRylY8oc3BBpasMPxL2M9HSUZ3GJSRGR1tgbz3tjRJssJqSSzw1LVvc18v6zpCvbhZsU6P2Q==",
1496
+      "optional": true,
1497
+      "requires": {
1498
+        "dat-encoding": "^5.0.1",
1499
+        "filesystem-constants": "^1.0.0",
1500
+        "fuse-native": "2.0.2"
1501
+      }
1502
+    },
1496 1503
     "hyperdrive-schemas": {
1497 1504
       "version": "0.13.0",
1498 1505
       "resolved": "https://registry.npmjs.org/hyperdrive-schemas/-/hyperdrive-schemas-0.13.0.tgz",
1499 1506
       "integrity": "sha512-srjT95l+3CfYa6GvvxvHNcuzDVC3es5Bsd+CjFDme8Xxhp/1ZR9G3cjqSPVuxL9kFoy88wYchqlpQYCI2nWq9g=="
1500 1507
     },
1501
-    "hyperswarm": {
1502
-      "version": "2.4.0",
1503
-      "resolved": "https://registry.npmjs.org/hyperswarm/-/hyperswarm-2.4.0.tgz",
1504
-      "integrity": "sha512-24D/zFCbhTh6Ld3zu9dgZzHwoJgnGu7e1eAZmCWKVs3x9rM0keIokmszV8NHYV9WQ3HFQJUKwF6+pGebNugzhA==",
1505
-      "requires": {
1506
-        "@hyperswarm/discovery": "^1.1.0",
1507
-        "@hyperswarm/network": "^1.1.2",
1508
-        "shuffled-priority-queue": "^2.1.0",
1509
-        "utp-native": "^2.1.3"
1510
-      }
1511
-    },
1512 1508
     "hypertrie": {
1513 1509
       "version": "4.0.0",
1514 1510
       "resolved": "https://registry.npmjs.org/hypertrie/-/hypertrie-4.0.0.tgz",
@@ -1613,7 +1609,6 @@
1613 1609
       "version": "1.0.6",
1614 1610
       "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
1615 1611
       "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
1616
-      "dev": true,
1617 1612
       "requires": {
1618 1613
         "once": "^1.3.0",
1619 1614
         "wrappy": "1"
@@ -1637,12 +1632,8 @@
1637 1632
     "ip": {
1638 1633
       "version": "1.1.5",
1639 1634
       "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
1640
-      "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo="
1641
-    },
1642
-    "ipv4-peers": {
1643
-      "version": "2.0.0",
1644
-      "resolved": "https://registry.npmjs.org/ipv4-peers/-/ipv4-peers-2.0.0.tgz",
1645
-      "integrity": "sha512-6ZMWB3JnCWT0gISUkzChcUEkJS6+LpGRU3h10f9Mfc0usVmyIcbcTN9+QPMg29gLOY8WtaKFbM5ME8qNySoh8g=="
1635
+      "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
1636
+      "optional": true
1646 1637
     },
1647 1638
     "is-arguments": {
1648 1639
       "version": "1.0.4",
@@ -1728,7 +1719,8 @@
1728 1719
     "is-typedarray": {
1729 1720
       "version": "1.0.0",
1730 1721
       "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
1731
-      "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
1722
+      "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
1723
+      "optional": true
1732 1724
     },
1733 1725
     "isarray": {
1734 1726
       "version": "1.0.0",
@@ -1868,6 +1860,7 @@
1868 1860
       "version": "3.3.1",
1869 1861
       "resolved": "https://registry.npmjs.org/k-bucket/-/k-bucket-3.3.1.tgz",
1870 1862
       "integrity": "sha512-kgwWqYT79rAahn4maIVTP8dIe+m1KulufWW+f1bB9DlZrRFiGpZ4iJOg2HUp4xJYBWONP3+rOPIWF/RXABU6mw==",
1863
+      "optional": true,
1871 1864
       "requires": {
1872 1865
         "buffer-equals": "^1.0.3",
1873 1866
         "inherits": "^2.0.1",
@@ -1878,6 +1871,7 @@
1878 1871
       "version": "4.3.1",
1879 1872
       "resolved": "https://registry.npmjs.org/k-rpc/-/k-rpc-4.3.1.tgz",
1880 1873
       "integrity": "sha512-mgAJZeFYbpP0xzJzmS0TQTYoFI0sjy3GnKFhg8wyboL+KvWg2WLaA2Oy9PthLPx2Rxz4WeBMk4y3MSOrDJ95FA==",
1874
+      "optional": true,
1881 1875
       "requires": {
1882 1876
         "buffer-equals": "^1.0.3",
1883 1877
         "k-bucket": "^4.0.0",
@@ -1890,6 +1884,7 @@
1890 1884
           "version": "4.0.1",
1891 1885
           "resolved": "https://registry.npmjs.org/k-bucket/-/k-bucket-4.0.1.tgz",
1892 1886
           "integrity": "sha512-YvDpmY3waI999h1zZoW1rJ04fZrgZ+5PAlVmvwDHT6YO/Q1AOhdel07xsKy9eAvJjQ9xZV1wz3rXKqEfaWvlcQ==",
1887
+          "optional": true,
1893 1888
           "requires": {
1894 1889
             "inherits": "^2.0.1",
1895 1890
             "randombytes": "^2.0.3"
@@ -1901,6 +1896,7 @@
1901 1896
       "version": "1.11.1",
1902 1897
       "resolved": "https://registry.npmjs.org/k-rpc-socket/-/k-rpc-socket-1.11.1.tgz",
1903 1898
       "integrity": "sha512-8xtA8oqbZ6v1Niryp2/g4GxW16EQh5MvrUylQoOG+zcrDff5CKttON2XUXvMwlIHq4/2zfPVFiinAccJ+WhxoA==",
1899
+      "optional": true,
1904 1900
       "requires": {
1905 1901
         "bencode": "^2.0.0",
1906 1902
         "chrome-dgram": "^3.0.2",
@@ -1912,6 +1908,7 @@
1912 1908
           "version": "2.0.1",
1913 1909
           "resolved": "https://registry.npmjs.org/bencode/-/bencode-2.0.1.tgz",
1914 1910
           "integrity": "sha512-2uhEl8FdjSBUyb69qDTgOEeeqDTa+n3yMQzLW0cOzNf1Ow5bwcg3idf+qsWisIKRH8Bk8oC7UXL8irRcPA8ZEQ==",
1911
+          "optional": true,
1915 1912
           "requires": {
1916 1913
             "safe-buffer": "^5.1.1"
1917 1914
           }
@@ -1919,19 +1916,30 @@
1919 1916
       }
1920 1917
     },
1921 1918
     "kappa-core": {
1922
-      "version": "7.0.0-alpha1",
1923
-      "resolved": "https://registry.npmjs.org/kappa-core/-/kappa-core-7.0.0-alpha1.tgz",
1924
-      "integrity": "sha512-ZfMFIHf6mj3Xx4fd7isxVomKUdQFQWtdH8hqBFU6BknfDRv4pfbxUNK89dONwHUcii9PGv0/OcyRwZ5innzY6w==",
1919
+      "version": "github:Frando/kappa-core#15777919bf820c7eaac6b76d1947cce93f922dac",
1920
+      "from": "github:Frando/kappa-core#exp-0.1.3",
1925 1921
       "requires": {
1926 1922
         "inherits": "^2.0.4",
1927 1923
         "stream-collector": "^1.0.1",
1928 1924
         "thunky": "^1.1.0"
1929 1925
       }
1930 1926
     },
1927
+    "kappa-drive-mount": {
1928
+      "version": "1.0.6",
1929
+      "resolved": "https://registry.npmjs.org/kappa-drive-mount/-/kappa-drive-mount-1.0.6.tgz",
1930
+      "integrity": "sha512-FzVwWaedsw2hjhfHdlJJ2fwWOguNeQ02cWIZPFb2H7pL77Ry3wBR2vLCkBCHhMdRKHNLqY4hgqt+BepoQ3S+7A==",
1931
+      "optional": true,
1932
+      "requires": {
1933
+        "call-me-maybe": "^1.0.1",
1934
+        "debug": "^4.1.1",
1935
+        "hyperdrive-fuse": "1.2.1",
1936
+        "mkdirp": "^0.5.1",
1937
+        "rimraf": "^2.6.3"
1938
+      }
1939
+    },
1931 1940
     "kappa-sparse-indexer": {
1932
-      "version": "0.4.0",
1933
-      "resolved": "https://registry.npmjs.org/kappa-sparse-indexer/-/kappa-sparse-indexer-0.4.0.tgz",
1934
-      "integrity": "sha512-FYIhVMdTlpOtDVq1ldBrqNk5Ursju7tthAK7emjmD1xkDBiDguURBWdJFrYnsb4teD6bED4Pini47dxZNBdCsQ==",
1941
+      "version": "github:Frando/kappa-sparse-indexer#c49f3c8abbfe8a1c97c6001410e6949771343720",
1942
+      "from": "github:Frando/kappa-sparse-indexer#master",
1935 1943
       "requires": {
1936 1944
         "debug": "^4.1.1",
1937 1945
         "mutexify": "^1.2.0",
@@ -1941,8 +1949,8 @@
1941 1949
       }
1942 1950
     },
1943 1951
     "kappa-view-kv": {
1944
-      "version": "github:coboxcoop/kappa-view-kv#0bb40f44d8a57a38743a7b6c1944053156581683",
1945
-      "from": "github:coboxcoop/kappa-view-kv#0bb40f4",
1952
+      "version": "github:coboxcoop/kappa-view-kv#261329330865ae0169afffcf08922f530df7f448",
1953
+      "from": "github:coboxcoop/kappa-view-kv#kappa5",
1946 1954
       "requires": {
1947 1955
         "through2": "^2.0.3",
1948 1956
         "unordered-materialized-kv": "^1.2.1"
@@ -1968,6 +1976,7 @@
1968 1976
       "version": "3.0.4",
1969 1977
       "resolved": "https://registry.npmjs.org/length-prefixed-message/-/length-prefixed-message-3.0.4.tgz",
1970 1978
       "integrity": "sha512-Tqyx4nggb9nkLD6p4hyIz7UiVNg5u3OnCP2h0hS/HXpheH88rsoNEgNB8xTnpPMw6zWXGZ7Cpg1zhWPlsJ0/TQ==",
1979
+      "optional": true,
1971 1980
       "requires": {
1972 1981
         "varint": "^3.0.1"
1973 1982
       },
@@ -1975,7 +1984,8 @@
1975 1984
         "varint": {
1976 1985
           "version": "3.0.1",
1977 1986
           "resolved": "https://registry.npmjs.org/varint/-/varint-3.0.1.tgz",
1978
-          "integrity": "sha1-nT9T4DbAqxIACnS8LSTL8JOlgdk="
1987
+          "integrity": "sha1-nT9T4DbAqxIACnS8LSTL8JOlgdk=",
1988
+          "optional": true
1979 1989
         }
1980 1990
       }
1981 1991
     },
@@ -1983,6 +1993,7 @@
1983 1993
       "version": "5.0.1",
1984 1994
       "resolved": "https://registry.npmjs.org/level/-/level-5.0.1.tgz",
1985 1995
       "integrity": "sha512-wcak5OQeA4rURGacqS62R/xNHjCYnJSQDBOlm4KNUGJVE9bWv2B04TclqReYejN+oD65PzD4FsqeWoI5wNC5Lg==",
1996
+      "optional": true,
1986 1997
       "requires": {
1987 1998
         "level-js": "^4.0.0",
1988 1999
         "level-packager": "^5.0.0",
@@ -2034,6 +2045,7 @@
2034 2045
       "version": "4.0.2",
2035 2046
       "resolved": "https://registry.npmjs.org/level-js/-/level-js-4.0.2.tgz",
2036 2047
       "integrity": "sha512-PeGjZsyMG4O89KHiez1zoMJxStnkM+oBIqgACjoo5PJqFiSUUm3GNod/KcbqN5ktyZa8jkG7I1T0P2u6HN9lIg==",
2048
+      "optional": true,
2037 2049
       "requires": {
2038 2050
         "abstract-leveldown": "~6.0.1",
2039 2051
         "immediate": "~3.2.3",
@@ -2061,6 +2073,7 @@
2061 2073
       "version": "5.1.1",
2062 2074
       "resolved": "https://registry.npmjs.org/level-packager/-/level-packager-5.1.1.tgz",
2063 2075
       "integrity": "sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ==",
2076
+      "optional": true,
2064 2077
       "requires": {
2065 2078
         "encoding-down": "^6.3.0",
2066 2079
         "levelup": "^4.3.2"
@@ -2078,6 +2091,7 @@
2078 2091
       "version": "5.4.1",
2079 2092
       "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.4.1.tgz",
2080 2093
       "integrity": "sha512-3lMPc7eU3yj5g+qF1qlALInzIYnkySIosR1AsUKFjL9D8fYbTLuENBAeDRZXIG4qeWOAyqRItOoLu2v2avWiMA==",
2094
+      "optional": true,
2081 2095
       "requires": {
2082 2096
         "abstract-leveldown": "~6.2.1",
2083 2097
         "napi-macros": "~2.0.0",
@@ -2088,6 +2102,7 @@
2088 2102
           "version": "6.2.2",
2089 2103
           "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.2.tgz",
2090 2104
           "integrity": "sha512-/a+Iwj0rn//CX0EJOasNyZJd2o8xur8Ce9C57Sznti/Ilt/cb6Qd8/k98A4ZOklXgTG+iAYYUs1OTG0s1eH+zQ==",
2105
+          "optional": true,
2091 2106
           "requires": {
2092 2107
             "level-concat-iterator": "~2.0.0",
2093 2108
             "level-supports": "~1.0.0",
@@ -2097,12 +2112,14 @@
2097 2112
         "napi-macros": {
2098 2113
           "version": "2.0.0",
2099 2114
           "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz",
2100
-          "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg=="
2115
+          "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==",
2116
+          "optional": true
2101 2117
         },
2102 2118
         "node-gyp-build": {
2103 2119
           "version": "4.1.1",
2104 2120
           "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz",
2105
-          "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ=="
2121
+          "integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ==",
2122
+          "optional": true
2106 2123
         }
2107 2124
       }
2108 2125
     },
@@ -2360,7 +2377,6 @@
2360 2377
       "version": "3.0.4",
2361 2378
       "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
2362 2379
       "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
2363
-      "dev": true,
2364 2380
       "requires": {
2365 2381
         "brace-expansion": "^1.1.7"
2366 2382
       }
@@ -2481,6 +2497,7 @@
2481 2497
       "version": "7.2.0",
2482 2498
       "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.0.tgz",
2483 2499
       "integrity": "sha512-Tu2QORGOFANB124NWQ/JTRhMf/ODouVLEuvu5Dz8YWEU55zQgRgFGnBHfIh5PbfNDAuaRl7yLB+pgWhSqVxi2Q==",
2500
+      "optional": true,
2484 2501
       "requires": {
2485 2502
         "dns-packet": "^4.0.0",
2486 2503
         "thunky": "^1.0.2"
@@ -2505,6 +2522,7 @@
2505 2522
       "version": "2.1.1",
2506 2523
       "resolved": "https://registry.npmjs.org/multistream/-/multistream-2.1.1.tgz",
2507 2524
       "integrity": "sha512-xasv76hl6nr1dEy3lPvy7Ej7K/Lx3O/FCvwge8PeVJpciPPoNCbaANcNiBug3IpdvTveZUcAV0DJzdnUDMesNQ==",
2525
+      "optional": true,
2508 2526
       "requires": {
2509 2527
         "inherits": "^2.0.1",
2510 2528
         "readable-stream": "^2.0.5"
@@ -2567,7 +2585,8 @@
2567 2585
     "network-address": {
2568 2586
       "version": "1.1.2",
2569 2587
       "resolved": "https://registry.npmjs.org/network-address/-/network-address-1.1.2.tgz",
2570
-      "integrity": "sha1-Sqe/1D8D8LgclwKxPWqFjdsybz4="
2588
+      "integrity": "sha1-Sqe/1D8D8LgclwKxPWqFjdsybz4=",
2589
+      "optional": true
2571 2590
     },
2572 2591
     "node-gyp-build": {
2573 2592
       "version": "3.9.0",
@@ -2698,7 +2717,8 @@
2698 2717
     "opencollective-postinstall": {
2699 2718
       "version": "2.0.2",
2700 2719
       "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz",
2701
-      "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw=="
2720
+      "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==",
2721
+      "optional": true
2702 2722
     },
2703 2723
     "optimist": {
2704 2724
       "version": "0.6.1",
@@ -2785,8 +2805,7 @@
2785 2805
     "path-is-absolute": {
2786 2806
       "version": "1.0.1",
2787 2807
       "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
2788
-      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
2789
-      "dev": true
2808
+      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
2790 2809
     },
2791 2810
     "path-parse": {
2792 2811
       "version": "1.0.6",
@@ -2974,6 +2993,7 @@
2974 2993
       "version": "2.1.0",
2975 2994
       "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
2976 2995
       "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
2996
+      "optional": true,
2977 2997
       "requires": {
2978 2998
         "safe-buffer": "^5.1.0"
2979 2999
       }
@@ -3031,11 +3051,6 @@
3031 3051
         }
3032 3052
       }
3033 3053
     },
3034
-    "record-cache": {
3035
-      "version": "1.1.0",
3036
-      "resolved": "https://registry.npmjs.org/record-cache/-/record-cache-1.1.0.tgz",
3037
-      "integrity": "sha512-u8rbtLEJV7HRacl/ZYwSBFD8NFyB3PfTTfGLP37IW3hftQCwu6z4Q2RLyxo1YJUNRTEzJfpLpGwVuEYdaIkG9Q=="
3038
-    },
3039 3054
     "release-zalgo": {
3040 3055
       "version": "1.0.0",
3041 3056
       "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz",
@@ -3096,7 +3111,6 @@
3096 3111
       "version": "2.7.1",
3097 3112
       "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
3098 3113
       "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
3099
-      "dev": true,
3100 3114
       "requires": {
3101 3115
         "glob": "^7.1.3"
3102 3116
       }
@@ -3104,12 +3118,14 @@
3104 3118
     "run-series": {
3105 3119
       "version": "1.1.8",
3106 3120
       "resolved": "https://registry.npmjs.org/run-series/-/run-series-1.1.8.tgz",
3107
-      "integrity": "sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg=="
3121
+      "integrity": "sha512-+GztYEPRpIsQoCSraWHDBs9WVy4eVME16zhOtDB4H9J4xN0XRhknnmLOl+4gRgZtu8dpp9N/utSPjKH/xmDzXg==",
3122
+      "optional": true
3108 3123
     },
3109 3124
     "rusha": {
3110 3125
       "version": "0.8.13",
3111 3126
       "resolved": "https://registry.npmjs.org/rusha/-/rusha-0.8.13.tgz",
3112
-      "integrity": "sha1-mghOe4YLF7/zAVuSxnpqM2GRUTo="
3127
+      "integrity": "sha1-mghOe4YLF7/zAVuSxnpqM2GRUTo=",
3128
+      "optional": true
3113 3129
     },
3114 3130
     "safe-buffer": {
3115 3131
       "version": "5.2.0",
@@ -3127,14 +3143,6 @@
3127 3143
       "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
3128 3144
       "dev": true
3129 3145
     },
3130
-    "shuffled-priority-queue": {
3131
-      "version": "2.1.0",
3132
-      "resolved": "https://registry.npmjs.org/shuffled-priority-queue/-/shuffled-priority-queue-2.1.0.tgz",
3133
-      "integrity": "sha512-xhdh7fHyMsr0m/w2kDfRJuBFRS96b9l8ZPNWGaQ+PMvnUnZ/Eh+gJJ9NsHBd7P9k0399WYlCLzsy18EaMfyadA==",
3134
-      "requires": {
3135
-        "unordered-set": "^2.0.1"
3136
-      }
3137
-    },
3138 3146
     "signal-exit": {
3139 3147
       "version": "3.0.2",
3140 3148
       "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
@@ -3209,6 +3217,7 @@
3209 3217
       "version": "2.1.2",
3210 3218
       "resolved": "https://registry.npmjs.org/simple-sha1/-/simple-sha1-2.1.2.tgz",
3211 3219
       "integrity": "sha512-TQl9rm4rdKAVmhO++sXAb8TNN0D6JAD5iyI1mqEPNpxUzTRrtm4aOG1pDf/5W/qCFihiaoK6uuL9rvQz1x1VKw==",
3220
+      "optional": true,
3212 3221
       "requires": {
3213 3222
         "rusha": "^0.8.1"
3214 3223
       }
@@ -3326,7 +3335,8 @@
3326 3335
     "speedometer": {
3327 3336
       "version": "1.1.0",
3328 3337
       "resolved": "https://registry.npmjs.org/speedometer/-/speedometer-1.1.0.tgz",
3329
-      "integrity": "sha512-z/wAiTESw2XVPssY2XRcme4niTc4S5FkkJ4gknudtVoc33Zil8TdTxHy5torRcgqMqksJV2Yz8HQcvtbsnw0mQ=="
3338
+      "integrity": "sha512-z/wAiTESw2XVPssY2XRcme4niTc4S5FkkJ4gknudtVoc33Zil8TdTxHy5torRcgqMqksJV2Yz8HQcvtbsnw0mQ==",
3339
+      "optional": true
3330 3340
     },
3331 3341
     "split": {
3332 3342
       "version": "1.0.0",
@@ -3725,11 +3735,6 @@
3725 3735
       "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
3726 3736
       "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
3727 3737
     },
3728
-    "time-ordered-set": {
3729
-      "version": "1.0.2",
3730
-      "resolved": "https://registry.npmjs.org/time-ordered-set/-/time-ordered-set-1.0.2.tgz",
3731
-      "integrity": "sha512-vGO99JkxvgX+u+LtOKQEpYf31Kj3i/GNwVstfnh4dyINakMgeZCpew1e3Aj+06hEslhtHEd52g7m5IV+o1K8Mw=="
3732
-    },
3733 3738
     "timeout-refresh": {
3734 3739
       "version": "1.0.0",
3735 3740
       "resolved": "https://registry.npmjs.org/timeout-refresh/-/timeout-refresh-1.0.0.tgz",
@@ -3747,7 +3752,8 @@
3747 3752
     "to-buffer": {
3748 3753
       "version": "1.1.1",
3749 3754
       "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
3750
-      "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg=="
3755
+      "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==",
3756
+      "optional": true
3751 3757
     },
3752 3758
     "to-fast-properties": {
3753 3759
       "version": "2.0.0",
@@ -3770,6 +3776,7 @@
3770 3776
       "version": "3.1.5",
3771 3777
       "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
3772 3778
       "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
3779
+      "optional": true,
3773 3780
       "requires": {
3774 3781
         "is-typedarray": "^1.0.0"
3775 3782
       }
@@ -3858,6 +3865,7 @@
3858 3865
       "version": "2.1.6",
3859 3866
       "resolved": "https://registry.npmjs.org/utp-native/-/utp-native-2.1.6.tgz",
3860 3867
       "integrity": "sha512-5I26dyWbRNR7ZLcMaNOxURSAnlJvMMr2FCPrVEQHOJdIXYnOyfQdv2pyZvFxyTDmZxcl5P+kVsISKk5e69agtw==",
3868
+      "optional": true,
3861 3869
       "requires": {
3862 3870
         "napi-macros": "^2.0.0",
3863 3871
         "node-gyp-build": "^4.2.0",
@@ -3869,17 +3877,20 @@
3869 3877
         "napi-macros": {
3870 3878
           "version": "2.0.0",
3871 3879
           "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz",
3872
-          "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg=="
3880
+          "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==",
3881
+          "optional": true
3873 3882
         },
3874 3883
         "node-gyp-build": {
3875 3884
           "version": "4.2.0",
3876 3885
           "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.0.tgz",
3877
-          "integrity": "sha512-4oiumOLhCDU9Rronz8PZ5S4IvT39H5+JEv/hps9V8s7RSLhsac0TCP78ulnHXOo8X1wdpPiTayGlM1jr4IbnaQ=="
3886
+          "integrity": "sha512-4oiumOLhCDU9Rronz8PZ5S4IvT39H5+JEv/hps9V8s7RSLhsac0TCP78ulnHXOo8X1wdpPiTayGlM1jr4IbnaQ==",
3887
+          "optional": true
3878 3888
         },
3879 3889
         "readable-stream": {
3880 3890
           "version": "3.5.0",
3881 3891
           "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz",
3882 3892
           "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==",
3893
+          "optional": true,
3883 3894
           "requires": {
3884 3895
             "inherits": "^2.0.3",
3885 3896
             "string_decoder": "^1.1.1",
@@ -3957,11 +3968,6 @@
3957 3968
         "signal-exit": "^3.0.2"
3958 3969
       }
3959 3970
     },
3960
-    "xor-distance": {
3961
-      "version": "2.0.0",
3962
-      "resolved": "https://registry.npmjs.org/xor-distance/-/xor-distance-2.0.0.tgz",
3963
-      "integrity": "sha512-AsAqZfPAuWx7qB/0kyRDUEvoU3QKsHWzHU9smFlkaiprEpGfJ/NBbLze2Uq0rdkxCxkNM9uOLvz/KoNBCbZiLQ=="
3964
-    },
3965 3971
     "xsalsa20": {
3966 3972
       "version": "1.1.0",
3967 3973
       "resolved": "https://registry.npmjs.org/xsalsa20/-/xsalsa20-1.1.0.tgz",

+ 8
- 8
package.json View File

@@ -16,19 +16,13 @@
16 16
     "collect-stream": "^1.2.1",
17 17
     "contains-path": "^1.0.0",
18 18
     "corestore": "^2.0.0",
19
-    "dat-swarm-defaults": "^1.0.2",
20
-    "discovery-swarm": "^6.0.0",
21
-    "events": "^3.0.0",
22 19
     "hypercore-crypto": "^1.0.0",
23 20
     "hyperdrive": "^10.3.2",
24
-    "hyperswarm": "^2.1.0",
25 21
     "hypertrie": "^4.0.0",
26 22
     "kappa-core": "github:Frando/kappa-core#exp-0.1.3",
27 23
     "kappa-sparse-indexer": "github:Frando/kappa-sparse-indexer#master",
28 24
     "kappa-view-kv": "github:coboxcoop/kappa-view-kv#kappa5",
29
-    "level": "^5.0.1",
30 25
     "memdb": "^1.3.1",
31
-    "minimist": "^1.2.0",
32 26
     "mountable-hypertrie": "^0.10.4",
33 27
     "multifeed": "^5.1.1",
34 28
     "nanoresource": "^1.3.0",
@@ -36,7 +30,6 @@
36 30
     "random-access-memory": "^3.1.1",
37 31
     "subleveldown": "^4.1.4",
38 32
     "through2": "^3.0.1",
39
-    "thunky": "^1.1.0",
40 33
     "unique-stream": "^2.3.1",
41 34
     "unixify": "^1.0.0"
42 35
   },
@@ -45,13 +38,20 @@
45 38
     "mkdirp": "^0.5.1",
46 39
     "nyc": "^14.1.1",
47 40
     "protocol-buffers": "^4.1.0",
48
-    "pump": "^3.0.0",
49 41
     "rimraf": "^2.6.3",
50 42
     "tap-spec": "^5.0.0",
51 43
     "tape": "^4.10.1",
52 44
     "tape-plus": "^1.0.0",
53 45
     "tmp": "^0.1.0"
54 46
   },
47
+  "optionalDependencies": {
48
+    "dat-swarm-defaults": "^1.0.2",
49
+    "discovery-swarm": "^6.0.0",
50
+    "kappa-drive-mount": "^1.0.6",
51
+    "level": "^5.0.1",
52
+    "minimist": "^1.2.0",
53
+    "pump": "^3.0.0"
54
+  },
55 55
   "directories": {
56 56
     "test": "test"
57 57
   },

+ 6
- 16
swarm.js View File

@@ -3,27 +3,17 @@ const pump = require('pump')
3 3
 const config = require('dat-swarm-defaults')
4 4
 const debug = require('debug')
5 5
 
6
-// for trying it out
7
-const hyperswarm = require('hyperswarm')
8
-
9 6
 module.exports = function (drive, opts = {}) {
10
-  var swarm = opts.hyperswarm ? hyperswarm() : discovery(config())
7
+  var swarm = discovery(config())
11 8
   var log = opts.logger || debug('kappa-drive')
12
-  log(`[SWARM] on ${drive.discoveryKey.toString('hex')}`)
9
+  log(`swarming on ${drive.discoveryKey.toString('hex')}`)
13 10
   swarm.join(drive.discoveryKey)
14 11
 
15
-  if (opts.hyperswarm) {
16
-    swarm.on('connection', (socket, details) => {
17
-      log(`[CONNECTION]  ${JSON.stringify(details, null, 4)}`)
18
-      pump(socket, drive.replicate(), socket)
19
-    })
20
-  } else {
21
-    swarm.on('connection', (connection, peer) => {
22
-      log(`[PEER] ${peer.id.toString('hex')}`)
12
+  swarm.on('connection', (connection, peer) => {
13
+    log(`[PEER] ${peer.id.toString('hex')}`)
23 14
 
24
-      pump(connection, drive.replicate(), connection)
25
-    })
26
-  }
15
+    pump(connection, drive.replicate(true, { live: true }), connection)
16
+  })
27 17
 
28 18
   return swarm
29 19
 }