Things that will need changing #1

Closed
opened 2023-02-10 20:01:08 +13:00 by mikedilger · 1 comment
mikedilger commented 2023-02-10 20:01:08 +13:00 (Migrated from github.com)

So I just ripped this code out and got it to compile. It's not API ready.

First off, in gossip, the RelayPicker is Send+Sync and I can call into it asynchronously from multiple tasks. But I ruined that by adding Hooks without those hooks also being Send+Sync. If it needs to be Send + Sync, the Hooks should be declared as such.

Second, the hooks can't return Results with Errors because I couldn't figure out how to wrap the Hook Error type into the outer Error type. But it probably needs to be done.

Third, a consumer needs to use types from the nostr-types library. That's good, since those types have safety code in them. But they also have to exposed in the API.

Fourth, I'm not sure if the stuff declared as async needs to be async anymore, or if the hook functions should be async or not. Someone will have to make that call.

Fifth, the scoring might be degenerate since I ripped out the relay ranking score adjustments, and I'm not sure the hook function returns scores anymore as I type this.

So I just ripped this code out and got it to compile. It's not API ready. First off, in gossip, the RelayPicker is Send+Sync and I can call into it asynchronously from multiple tasks. But I ruined that by adding Hooks without those hooks also being Send+Sync. If it needs to be Send + Sync, the Hooks should be declared as such. Second, the hooks can't return Results with Errors because I couldn't figure out how to wrap the Hook Error type into the outer Error type. But it probably needs to be done. Third, a consumer needs to use types from the nostr-types library. That's good, since those types have safety code in them. But they also have to exposed in the API. Fourth, I'm not sure if the stuff declared as async needs to be async anymore, or if the hook functions should be async or not. Someone will have to make that call. Fifth, the scoring might be degenerate since I ripped out the relay ranking score adjustments, and I'm not sure the hook function returns scores anymore as I type this.
mikedilger commented 2023-02-25 15:43:54 +13:00 (Migrated from github.com)

Hooks are now Send + Sync.

Hook errors just need to impl Display. We aren't doing anything fancy except printing them for now.

We are now re-exporting the nostr-types types

We added a hook for scoring

This is all done now.

Hooks are now Send + Sync. Hook errors just need to impl Display. We aren't doing anything fancy except printing them for now. We are now re-exporting the nostr-types types We added a hook for scoring This is all done now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nostr/gossip-relay-picker#1
No description provided.