Skip to content

Commit

Permalink
feat: bump protos to support list caches with metadata around limits (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bruuuuuuuce authored Aug 21, 2023
1 parent bcfb38e commit e47ae3a
Show file tree
Hide file tree
Showing 9 changed files with 1,253 additions and 15,463 deletions.
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 @@ -51,7 +51,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

0 comments on commit e47ae3a

Please sign in to comment.