swarm/api: refactor and improve HTTP API (#3773)
This PR deprecates the file related RPC calls in favour of an improved HTTP API. The main aim is to expose a simple to use API which can be consumed by thin clients (e.g. curl and HTML forms) without the need for complex logic (e.g. manipulating prefix trie manifests).
This commit is contained in:
committed by
Felix Lange
parent
9aca9e6deb
commit
71fdaa4238
@ -53,8 +53,8 @@ type Swarm struct {
|
||||
privateKey *ecdsa.PrivateKey
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
type SwarmAPI struct {
|
||||
@ -241,13 +241,6 @@ func (self *Swarm) Protocols() []p2p.Protocol {
|
||||
func (self *Swarm) APIs() []rpc.API {
|
||||
return []rpc.API{
|
||||
// public APIs
|
||||
{
|
||||
Namespace: "bzz",
|
||||
Version: "0.1",
|
||||
Service: api.NewStorage(self.api),
|
||||
Public: true,
|
||||
},
|
||||
|
||||
{
|
||||
Namespace: "bzz",
|
||||
Version: "0.1",
|
||||
@ -255,11 +248,6 @@ func (self *Swarm) APIs() []rpc.API {
|
||||
Public: true,
|
||||
},
|
||||
// admin APIs
|
||||
{
|
||||
Namespace: "bzz",
|
||||
Version: "0.1",
|
||||
Service: api.NewFileSystem(self.api),
|
||||
Public: false},
|
||||
{
|
||||
Namespace: "bzz",
|
||||
Version: "0.1",
|
||||
@ -278,6 +266,20 @@ func (self *Swarm) APIs() []rpc.API {
|
||||
Service: self.sfs,
|
||||
Public: false,
|
||||
},
|
||||
// storage APIs
|
||||
// DEPRECATED: Use the HTTP API instead
|
||||
{
|
||||
Namespace: "bzz",
|
||||
Version: "0.1",
|
||||
Service: api.NewStorage(self.api),
|
||||
Public: true,
|
||||
},
|
||||
{
|
||||
Namespace: "bzz",
|
||||
Version: "0.1",
|
||||
Service: api.NewFileSystem(self.api),
|
||||
Public: false,
|
||||
},
|
||||
// {Namespace, Version, api.NewAdmin(self), false},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user