Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Foundational Work For Codegen Rewrite #1817
Foundational Work For Codegen Rewrite #1817
Changes from 12 commits
7a1170b
d968a46
5755e2d
e3e6a38
562951f
86ffccb
3494a9d
90f1f73
013a822
bb83598
625886c
eb22a94
001fd7e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
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.
Apollo Android uses
CacheReference
too. I'd be in for renaming toEntityReference
as we're still at a moment where we can rename stuff on Android. Feels like that would be more adequate. It's a reference to an Entity, not to a Cache. Or maybeObjectReference
? (We don't have entity anywhere in the Android codebase)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.
@designatednerd What's your opinion on the naming of this? Entity, Object, something else?
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.
@martinbonnin Is your point that it's a reference to an entity within the cache rather than to the cache itself? I think that's valid, but
Entity
by itself is so overloaded I might go with something likeCacheEntityReference
.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.
Yes it was! Rereading that, I'm certainly overthinking this.
CacheReference
sounds reasonable.And now back to overthinking this... What's the difference between a
CacheReference
and aCacheKey
? Could we merge both somehow?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.
My recollection is that the key is the key used to access stored data vs the reference is the actual stored data - @AnthonyMDev is that about right?
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 got curious and tried to merge
CacheKey
andCacheReference
. Turns out it's working well: apollographql/apollo-kotlin#3157The only reason I can think of having two different data structures in Kotlin is if we want to make
CacheKey
a value class that is inlined to aString
for performance reasons. If we do that, we can't check the type ofCacheKey
anymore which means everything becomes a string and we can't serialize the CacheKey to their special String value.But besides that (which we don't optimize at the moment and I feel should be an implementation details if we ever decide to) I actually like the reduced mental load and API surface.
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.
Hmmmmm. I'm going to look into this. Thanks for that @martijnwalraven
No, the reference isn't the actual stored data. It's just a wrapper type for the CacheKey as a
String
. It indicates that the raw String data isn't just a regular raw a String property on the object, but is aString
representing the reference to the cache key of another object.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.
Gooooot it, thank you for clarifying