Skip to content
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

Merged
merged 7 commits into from
Aug 21, 2023

Conversation

bruuuuuuuce
Copy link
Contributor

@bruuuuuuuce bruuuuuuuce commented Aug 18, 2023

protos now contains cache limits around

  // The amount of transactions per second that can be exercised
  uint32 max_traffic_rate = 1; 
  // The amount of traffic per second that can be exercised in KiB
  uint32 max_throughput_kbps = 2;
  // The maximum size of a single item in KiB
  uint32 max_item_size_kb = 3;
  // The maximum TTL allowed for a single item, in seconds
  uint64 max_ttl_seconds = 4;

and topic limits around

  // The amount of messages that can be published per second
  uint32 max_publish_rate = 1;
  // The maximum amount of active subscriptions per cache
  uint32 max_subscription_count = 2;
  // The maximum size of a single publish message, in KiB
  uint32 max_publish_message_size_kb = 3;

unblocks ui for https://github.com/momentohq/momento-console/issues/293

@bruuuuuuuce bruuuuuuuce marked this pull request as ready for review August 18, 2023 17:12
@pratik151192
Copy link
Contributor

pratik151192 commented Aug 18, 2023

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?

rishtigupta
rishtigupta previously approved these changes Aug 21, 2023
Copy link
Contributor

@cprice404 cprice404 left a 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 = {
Copy link
Contributor

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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,
});
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bruuuuuuuce bruuuuuuuce merged commit e47ae3a into main Aug 21, 2023
@bruuuuuuuce bruuuuuuuce deleted the feat/listCachesWithMetadat branch August 21, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants