dont create ipnsfs filesystem until its needed
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Aug 13, 2015 at 15:16 UTC
a97639a78a6166eb81e55eec7903587187901dc0
2 files changed
+9
-10
core/core.go
-10
@@ -38,7 +38,6 @@ import (
38
39
routing "github.com/ipfs/go-ipfs/routing"
40
dht "github.com/ipfs/go-ipfs/routing/dht"
41
- kb "github.com/ipfs/go-ipfs/routing/kbucket"
41
nilrouting "github.com/ipfs/go-ipfs/routing/none"
42
offroute "github.com/ipfs/go-ipfs/routing/offline"
43
@@ -162,15 +161,6 @@ func NewIPFSNode(ctx context.Context, option ConfigOption) (*IpfsNode, error) {
161
}
162
node.Resolver = &path.Resolver{DAG: node.DAG}
163
165
- // Setup the mutable ipns filesystem structure
166
- if node.OnlineMode() {
167
- fs, err := ipnsfs.NewFilesystem(ctx, node.DAG, node.Namesys, node.Pinning, node.PrivateKey)
168
- if err != nil && err != kb.ErrLookupFailure {
169
- return nil, err
170
- }
171
- node.IpnsFs = fs
172
- }
173
-
164
success = true
165
return node, nil
166
}
fuse/ipns/mount_unix.go
+9
@@ -6,6 +6,7 @@ package ipns
6
import (
7
core "github.com/ipfs/go-ipfs/core"
8
mount "github.com/ipfs/go-ipfs/fuse/mount"
9
+ ipnsfs "github.com/ipfs/go-ipfs/ipnsfs"
10
)
11
12
// Mount mounts ipns at a given location, and returns a mount.Mount instance.
@@ -13,6 +14,14 @@ func Mount(ipfs *core.IpfsNode, ipnsmp, ipfsmp string) (mount.Mount, error) {
14
cfg := ipfs.Repo.Config()
15
allow_other := cfg.Mounts.FuseAllowOther
16
17
+ if ipfs.IpnsFs == nil {
18
+ fs, err := ipnsfs.NewFilesystem(ipfs.Context(), ipfs.DAG, ipfs.Namesys, ipfs.Pinning, ipfs.PrivateKey)
19
+ if err != nil {
20
+ return nil, err
21
+ }
22
+ ipfs.IpnsFs = fs
23
+ }
24
+
25
fsys, err := NewFileSystem(ipfs, ipfs.PrivateKey, ipfsmp, ipnsmp)
26
if err != nil {
27
return nil, err