-
Notifications
You must be signed in to change notification settings - Fork 50
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
signaling ADLs in selectors #301
Conversation
Added a test. I think this should be ready for review |
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.
🤷 it seems that all of the approaches to the ADL signalling problem that we've come up with have a smell about them, the main real benefit of this one is that there's actual code to do it. So maybe we just move the discussion forward by trying this out and seeing if its limitations are acceptable and leaning from it.
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.
Sounds good to me. I'll leave it to @warpfork to give the final seal of approval, as I'm not fully up to speed with the design and plans for the selector language and API.
Co-authored-by: Daniel Martí <mvdan@mvdan.cc>
…o feat/adlselection
traversal/selector/fieldKeys.go
Outdated
@@ -21,5 +22,6 @@ const ( | |||
SelectorKey_LimitNone = "none" | |||
SelectorKey_StopAt = "!" | |||
SelectorKey_Condition = "&" | |||
SelectorKey_As = "c" |
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.
I realize this would also be a specs change, since we merged that in the ipld/ipld
repo already, but since this will be the first implementation actually using it --
I still think we should change this key. There's no way I would either look at the spec and expect it to use the constant "c" here, nor look at the constant "c" in a message and guess remotely correctly what it stands for. (To wit: I just had to look it up again.)
Can we use "as"? I don't think a second byte is going to bother anyone, and my surprise factor would go down drastically.
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.
i'm very scared to go back to step one given that we're now 2 months in to a very simple change that has now missed 2 shipping deadlines because of the spec then implementation then wait long time for review approach.
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.
// Reifiable provides a feature detection interface on selectors to understand when | ||
// and if Reification of the datamodel.node should be attempted when performing traversals. | ||
type Reifiable interface { | ||
NamedReifier() string | ||
} |
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.
(Reviewing out loud, not a change request) This interface is implemented only once and used in only one place, so I wonder if it's necessary. Since the set of types for the compiled selectors[^1] is considered closed, it seems like we could just as well use a concrete type switch?
I'm okay leaving it this way too, because it certainly works, and I don't think it gets in the way, and perhaps someone has an idea that there will be more than one selector clause in the future which asks for a reification to be performed.
[^1] - (I wish we had done #236 by now so I could refer to what I mean by selectorengine.*
...)
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.
Error message typo fixes.
Also tried to push them to slightly more self-similarity while at it (but honestly this whole package needs an error consistency passover, somewhat badly).
Co-authored-by: Eric Myhre <hash@exultant.us>
Co-authored-by: Eric Myhre <hash@exultant.us>
…o feat/adlselection
Replaying a conversation that @willscott and I had elsewhere, for posterity: My initial thought was to hope we could put most logic like this -- anything that wants an ADL naming table -- into the middle of a This turns out not to fly together with this idea of Selectors carrying ADL signalling information. Putting the ADL naming table in the Perhaps a third option would've been adding a field to So we end up with this. I'm a little nervous about getting a map in the |
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.
Alright, let's go
Future wish: more test fixtures that exercise this feature in a data-driven way and live in the I don't feel able to hold folks up on that at the moment, but it would probably be easier to review those, and also we'll need them if we expect other languages and other implementations to be able to confidently match this implementation. |
- The prefix "Explore" on its name feels unnecessary; drop. (Doesn't change the protocol structurally.) - The 'as' field is no longer renamed to 'c' in the serial form. (DOES change the protocol structurally; but there's only one implementation of this, and we changed it too. See ipld/go-ipld-prime#301 (comment).) - Added a bunch of docs.
(Followup note: we actually got fixtures that happen to exercise this, recently: they appeared as part of the specification for range clauses for bytes in ipld/ipld#184. Fabulous!) |
ExploreInterpretAs
selector for specifying an ADL