Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegated Routing: Allow to configure methods used by router. #9157

Closed
3 tasks done
ajnavarro opened this issue Aug 1, 2022 · 0 comments · Fixed by #9274
Closed
3 tasks done

Delegated Routing: Allow to configure methods used by router. #9157

ajnavarro opened this issue Aug 1, 2022 · 0 comments · Fixed by #9274
Assignees
Labels
kind/feature A new feature

Comments

@ajnavarro
Copy link
Member

ajnavarro commented Aug 1, 2022

Checklist

  • My issue is specific & actionable.
  • I am not suggesting a protocol enhancement.
  • I have searched on the issue tracker for my issue.

Description

Description

As described here #8997 (review) we need a way to specify methods that a router will use from config.

Actual proposed config file:

{
  "Type": "reframe",
  "Enabled": true,
  "Methods" : ["put-ipns", "get-providers", ...],
  "Parameters": {
    "Endpoint": "https://cid.contact/reframe",
    "Priority": 100
  }
},
{
  "Type": "dht",
  "Enabled": true,
  "Methods" : ["put-ipns", "get-providers", ...],
  "Parameters": {
    "Priority": 200,
    "DHTMode": "dhtclient",
    "TrackFullNetworkDHT": false,
    "Concurrency": 10
  }
}

I suggest making Methods param mandatory to make configuration discoverable. If it is not present or has some wrong methods, an error message will appear when Kubo starts, explaining what is wrong and the available methods for that router. Examples:

we found an error in the configuration. Router type "reframe" does not support "provide" method. Available methods: "get-providers", "get-ipns", "put-ipns"

we found an error in the configuration. "Methods" param is mandatory on "Routers" configuration. Available methods: "get-providers", "get-ipns", "put-ipns"

We can add a generic all method to simplify configuration if all methods are needed.

Implementation

I would say to keep it simple:

  • Create a list of available methods per routing type. This will be used to check if provided methods from config are correct.
  • Create a new Router wrapper that depending on the provided method list, will call or not the Router underneath. If the method is not allowed to be executed, the wrapper Router will return routing.ErrNotSupported
@ajnavarro ajnavarro added the kind/feature A new feature label Aug 1, 2022
@ajnavarro ajnavarro self-assigned this Aug 1, 2022
@ajnavarro ajnavarro moved this to 🏃‍♀️ In Progress in IPFS Shipyard Team Sep 12, 2022
Repository owner moved this from 🏃‍♀️ In Progress to 🎉 Done in IPFS Shipyard Team Sep 22, 2022
ajnavarro added a commit that referenced this issue Sep 22, 2022
New multi-router configuration system based on https://hackmd.io/G1KRDEX5T3qyfoBMkIrBew#Methods

- Added a new routing type: "custom"
- Added specific struct types for different Routers (instead of map[string]interface{})
- Added `Duration` config type, to make easier time string parsing
- Added config documentation.
- Use the latest go-delegated-routing library version with GET support.
- Added changelog notes for this feature.

It:
- closes #9157
- closes #9079
- closes #9186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A new feature
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant