Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1612e66

Browse files
committedAug 13, 2015
dont create ipnsfs filesystem until its needed
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent ace06b4 commit 1612e66

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed
 

‎core/core.go

-10
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ import (
3838

3939
routing "github.com/ipfs/go-ipfs/routing"
4040
dht "github.com/ipfs/go-ipfs/routing/dht"
41-
kb "github.com/ipfs/go-ipfs/routing/kbucket"
4241
offroute "github.com/ipfs/go-ipfs/routing/offline"
4342

4443
bstore "github.com/ipfs/go-ipfs/blocks/blockstore"
@@ -162,15 +161,6 @@ func NewIPFSNode(ctx context.Context, option ConfigOption) (*IpfsNode, error) {
162161
}
163162
node.Resolver = &path.Resolver{DAG: node.DAG}
164163

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-
174164
success = true
175165
return node, nil
176166
}

‎fuse/ipns/mount_unix.go

+9
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ package ipns
66
import (
77
core "github.com/ipfs/go-ipfs/core"
88
mount "github.com/ipfs/go-ipfs/fuse/mount"
9+
ipnsfs "github.com/ipfs/go-ipfs/ipnsfs"
910
)
1011

1112
// Mount mounts ipns at a given location, and returns a mount.Mount instance.
1213
func Mount(ipfs *core.IpfsNode, ipnsmp, ipfsmp string) (mount.Mount, error) {
1314
cfg := ipfs.Repo.Config()
1415
allow_other := cfg.Mounts.FuseAllowOther
1516

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+
1625
fsys, err := NewFileSystem(ipfs, ipfs.PrivateKey, ipfsmp, ipnsmp)
1726
if err != nil {
1827
return nil, err

0 commit comments

Comments
 (0)
Please sign in to comment.