@@ -5,33 +5,38 @@ import (
5
5
"net/http"
6
6
"sort"
7
7
8
- coreiface "github.com/ipfs/interface-go-ipfs-core"
9
- path "github.com/ipfs/interface-go-ipfs-core/path"
8
+ cid "github.com/ipfs/go-cid"
9
+ "github.com/ipfs/go-libipfs/blocks"
10
+ "github.com/ipfs/go-libipfs/files"
11
+ iface "github.com/ipfs/interface-go-ipfs-core"
12
+ options "github.com/ipfs/interface-go-ipfs-core/options"
13
+ "github.com/ipfs/interface-go-ipfs-core/path"
10
14
)
11
15
12
- // Config is the configuration that will be applied when creating a new gateway
13
- // handler.
16
+ // Config is the configuration used when creating a new gateway handler.
14
17
type Config struct {
15
- Headers map [string ][]string
16
- Writable bool
18
+ Headers map [string ][]string
17
19
}
18
20
19
- // NodeAPI defines the minimal set of API services required by a gateway handler
20
- type NodeAPI interface {
21
- // Unixfs returns an implementation of Unixfs API
22
- Unixfs () coreiface. UnixfsAPI
21
+ // API defines the minimal set of API services required for a gateway handler.
22
+ type API interface {
23
+ // GetUnixFsNode returns a read-only handle to a file tree referenced by a path.
24
+ GetUnixFsNode (context. Context , path. Path ) (files. Node , error )
23
25
24
- // Block returns an implementation of Block API
25
- Block () coreiface. BlockAPI
26
+ // LsUnixFsDir returns the list of links in a directory.
27
+ LsUnixFsDir (context. Context , path. Path , ... options. UnixfsLsOption ) ( <- chan iface. DirEntry , error )
26
28
27
- // Dag returns an implementation of Dag API
28
- Dag () coreiface. APIDagService
29
+ // GetBlock return a block from a certain CID.
30
+ GetBlock (context. Context , cid. Cid ) (blocks. Block , error )
29
31
30
- // Routing returns an implementation of Routing API.
31
- // Used for returning signed IPNS records, see IPIP-0328
32
- Routing () coreiface. RoutingAPI
32
+ // GetIPNSRecord retrieves the best IPNS record for a given CID (libp2p-key)
33
+ // from the routing system.
34
+ GetIPNSRecord (context. Context , cid. Cid ) ([] byte , error )
33
35
34
- // ResolvePath resolves the path using Unixfs resolver
36
+ // IsCached returns whether or not the path exists locally.
37
+ IsCached (context.Context , path.Path ) bool
38
+
39
+ // ResolvePath resolves the path using UnixFS resolver
35
40
ResolvePath (context.Context , path.Path ) (path.Resolved , error )
36
41
}
37
42
0 commit comments