feat: add RoutingAPI to CoreAPI
This commit was moved from ipfs/interface-go-ipfs-core@177d25ba92ed67ab4916cb13827321c389961de0 This commit was moved from ipfs/boxo@b3ab88834562c689b5eadfed2e08e732fea4392a
Henrique Dias committed
Nov 14, 2022 at 17:18 UTC
132206b573c44164a6571a551cf1b2c3acbcb438
2 files changed
+17
core/coreiface/coreapi.go
+3
@@ -44,6 +44,9 @@ type CoreAPI interface {
44
// PubSub returns an implementation of PubSub API
45
PubSub() PubSubAPI
46
47
+ // Routing returns an implementation of Routing API
48
+ Routing() RoutingAPI
49
+
50
// ResolvePath resolves the path using Unixfs resolver
51
ResolvePath(context.Context, path.Path) (path.Resolved, error)
52
core/coreiface/routing.go
new
+14
@@ -0,0 +1,14 @@
1
+package iface
2
+
3
+import (
4
+ "context"
5
+)
6
+
7
+// RoutingAPI specifies the interface to the routing layer.
8
+type RoutingAPI interface {
9
+ // Get retrieves the best value for a given key
10
+ Get(context.Context, string) ([]byte, error)
11
+
12
+ // Put sets a value for a given key
13
+ Put(ctx context.Context, key string, value []byte) error
14
+}