swarm/api: FUSE read-write support (#13872)

- Moved fuse related code in a new package, swarm/fuse
- Added write support
  - Create new files
  - Delete existing files
  - Append to files (with limitations)
- More test coverage
This commit is contained in:
Zahoor Mohamed
2017-04-12 05:36:02 +05:30
committed by Felix Lange
parent dd37064a15
commit 1d1d988aa7
15 changed files with 1693 additions and 362 deletions

View File

@ -34,6 +34,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/swarm/api"
httpapi "github.com/ethereum/go-ethereum/swarm/api/http"
"github.com/ethereum/go-ethereum/swarm/fuse"
"github.com/ethereum/go-ethereum/swarm/network"
"github.com/ethereum/go-ethereum/swarm/storage"
)
@ -54,7 +55,7 @@ type Swarm struct {
corsString string
swapEnabled bool
lstore *storage.LocalStore // local store, needs to store for releasing resources after node stopped
sfs *api.SwarmFS // need this to cleanup all the active mounts on node exit
sfs *fuse.SwarmFS // need this to cleanup all the active mounts on node exit
}
type SwarmAPI struct {
@ -143,7 +144,7 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api.
// Manifests for Smart Hosting
log.Debug(fmt.Sprintf("-> Web3 virtual server API"))
self.sfs = api.NewSwarmFS(self.api)
self.sfs = fuse.NewSwarmFS(self.api)
log.Debug("-> Initializing Fuse file system")
return self, nil
@ -262,7 +263,7 @@ func (self *Swarm) APIs() []rpc.API {
},
{
Namespace: "swarmfs",
Version: api.Swarmfs_Version,
Version: fuse.Swarmfs_Version,
Service: self.sfs,
Public: false,
},