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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,485 changes: 389 additions & 5,096 deletions packages/client-sdk-nodejs/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/client-sdk-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"uuid": "8.3.2"
},
"dependencies": {
"@gomomento/generated-types": "0.69.0",
"@gomomento/generated-types": "0.73.0",
"@gomomento/sdk-core": "file:../core",
"@grpc/grpc-js": "1.9.0",
"@types/google-protobuf": "3.15.6",
Expand Down
24 changes: 21 additions & 3 deletions packages/client-sdk-nodejs/src/internal/control-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import {
} from '@gomomento/sdk-core/dist/src/internal/utils';
import {normalizeSdkError} from '@gomomento/sdk-core/dist/src/errors';
import {_SigningKey} from '@gomomento/sdk-core/dist/src/messages/responses/grpc-response-types';
import {
CacheLimits,
TopicLimits,
} from '@gomomento/sdk-core/dist/src/messages/cache-info';

export interface ControlClientProps {
configuration: Configuration;
Expand Down Expand Up @@ -168,9 +172,23 @@ export class ControlClient {
if (err || !resp) {
resolve(new ListCaches.Error(cacheServiceErrorMapper(err)));
} else {
const caches = resp.cache.map(
cache => new CacheInfo(cache.cache_name)
);
const caches = resp.cache.map(cache => {
const cacheName = cache.cache_name;
const topicLimits: TopicLimits = {
maxPublishMessageSizeKb:
cache.topic_limits?.max_publish_message_size_kb || 0,
maxSubscriptionCount:
cache.topic_limits?.max_subscription_count || 0,
maxPublishRate: cache.topic_limits?.max_publish_rate || 0,
};
const cacheLimits: CacheLimits = {
maxTtlSeconds: cache.cache_limits?.max_ttl_seconds || 0,
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,
};
return new CacheInfo(cacheName, topicLimits, cacheLimits);
});
resolve(new ListCaches.Success(caches));
}
});
Expand Down
Loading