-
Notifications
You must be signed in to change notification settings - Fork 9
Represent storetheindex v0 finder protocol in schema #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,20 +4,39 @@ type Envelope union { | |
| | GetP2PProvideResponse "get-p2p-provide-response" | ||
| } representation keyed | ||
|
|
||
| type Multihash Bytes | ||
|
|
||
| type GetP2PProvideRequest struct { | ||
| key Bytes | ||
| Multihashes [Multihash] | ||
| } | ||
|
|
||
| type GetP2PProvideResponse struct { | ||
| providers [Provider] | ||
| MultihashResults [MultihashResult] | ||
| } | ||
|
|
||
| type MultihashResult struct { | ||
| Multihash Multihash | ||
| ProviderResults [ProviderResult] | ||
| } | ||
|
|
||
| type ProviderResult struct { | ||
| Metadata Metadata | ||
| Provider Provider | ||
| } | ||
|
Comment on lines
+22
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @willscott I wanted to clarify + document some things I understood from our conversation today.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, following up from discussions today the metadata schema seems like it'll be important within the indexer as well as once you separate the "who published these records" from "who has these records" you'll want some way to evaluate if the records are good for your own reputation system purposes which means understanding some (even if not all) of the record types. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| # XXX: represent as union of known options | ||
| type Metadata struct { | ||
| ProtocolID Int | ||
| Data Bytes | ||
| } | ||
|
|
||
| type Provider union { | ||
| | Peer "peer" | ||
| } representation keyed | ||
|
|
||
| type Peer struct { | ||
| Multiaddress [Bytes] | ||
| ID Bytes | ||
| Addrs [Bytes] | ||
| } | ||
|
|
||
| # XXX: can we have a union representation that tries to parse in order of rules? | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@warpfork continuing from #7 (comment) (GitHub's lack of threads are brutal and I'd like to isolate this topic a bit).
Can
Anycurrently be parsed by codegen?Is this necessarily true? Say I have a keyed union for the keys "foo" and "bar", but my parser sees a "baz". Why would having a keyed union like the below be so rough to process, as soon as we notice the key isn't "foo" or "bar" we just treat it like an
Anywhich offhand doesn't seem like it'd be more work than processing a regular field that happens to be anAny.Also, some union types are more efficient than others for parsing so adding one more that eases consumer pain here doesn't seem too bad, but I could be missing things so lmk 😄.