Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

feat: add RoutingAPI to CoreAPI #91

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions coreapi.go
Original file line number Diff line number Diff line change
@@ -44,6 +44,9 @@ type CoreAPI interface {
// PubSub returns an implementation of PubSub API
PubSub() PubSubAPI

// Routing returns an implementation of Routing API
Routing() RoutingAPI

// ResolvePath resolves the path using Unixfs resolver
ResolvePath(context.Context, path.Path) (path.Resolved, error)

14 changes: 14 additions & 0 deletions routing.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package iface

import (
"context"
)

// RoutingAPI specifies the interface to the routing layer.
type RoutingAPI interface {
// Get retrieves the best value for a given key
Get(context.Context, string) ([]byte, error)

// Put sets a value for a given key
Put(ctx context.Context, key string, value []byte) error
}