-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: bump protos to support list caches with metadata around limits #741
Conversation
The code LGTM but there aren't tests. Looks like we haven't implemented it on the backend yet? I think even if we haven't, we could just wire the tests to assert on 0 for the limits, and when we do implement it, we can just change them? |
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.
couple of nitpicks/questions but nothing big
@@ -1,11 +1,94 @@ | |||
type CacheLimitsProps = { |
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.
what's the difference between type
and interface
here?
maxTtlSeconds: number; | ||
}; | ||
|
||
export class CacheLimits { |
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.
nit: I'm guessing you did these as classes because the main CacheInfo object is a cache; but is there any reason to do these as classes instead of interfaces?
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.
yea I think an interface should work here as well
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 feel like that might be a little simpler/cleaner, wdyt?
I know it's not a huge deal either way but since this is technically going to be public API, just wanted to make sure our decision was deliberate.
maxItemSizeKb: cache.cache_limits?.max_item_size_kb || 0, | ||
maxThroughputKbps: cache.cache_limits?.max_throughput_kbps || 0, | ||
maxTrafficRate: cache.cache_limits?.max_traffic_rate || 0, | ||
}); |
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.
just checking my understanding of the proto changes - cache.cache_name
is always present but the cache_limits
and topics_limits
were modeled as optional?
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.
they are modeled as always present, but until the change gets all the way through the backend, they will be returned as null
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.
but I'm surprised the TS compiler will accept this? If the type is defined as non-null?
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 just thinks that || 0
will never be true, but it doesn't fail compilation because of that
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.
okay. interesting.
worth capturing a ticket to come back and remove the ?
later?
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.
why is it different for cache_name
though?
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 believe because it is a grpc object vs a string, but I am not entirely sure
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.
okay. it's probably fine like this. thanks.
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.
ill make a ticket to remove the ?
for the nodejs sdk tho
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.
protos now contains cache limits around
and topic limits around
unblocks ui for https://github.com/momentohq/momento-console/issues/293