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

chore: add copy constructors for max send/recieve message length #1497

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,26 @@ export interface GrpcConfiguration {
*/
getMaxSendMessageLength(): number | undefined;

/**
* Copy constructor for overriding the max send message length.
* @param maxSendMessageLength the desired maximum message length the client can send to the server.
*/
withMaxSendMessageLength(maxSendMessageLength: number): GrpcConfiguration;

/**
* The maximum message length the client can receive from the server. If the server attempts to send a message larger than
* this size, it will result in a RESOURCE_EXHAUSTED error.
*/
getMaxReceiveMessageLength(): number | undefined;

/**
* Copy constructor for overriding the max receive message length.
* @param maxReceiveMessageLength the desired maximum message length the client can receive from the server.
*/
withMaxReceiveMessageLength(
maxReceiveMessageLength: number
): GrpcConfiguration;

/**
* @returns {number} the number of internal clients a cache client will create to communicate with Momento. More of
* them will allow for more concurrent requests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,28 @@ export class StaticGrpcConfiguration implements GrpcConfiguration {
return this.maxSendMessageLength;
}

withMaxSendMessageLength(
maxSendMessageLength: number
): StaticGrpcConfiguration {
return new StaticGrpcConfiguration({
...this,
maxSendMessageLength,
});
}

getMaxReceiveMessageLength(): number | undefined {
return this.maxReceiveMessageLength;
}

withMaxReceiveMessageLength(
maxReceiveMessageLength: number
): StaticGrpcConfiguration {
return new StaticGrpcConfiguration({
...this,
maxReceiveMessageLength,
});
}

getNumClients(): number {
return this.numClients;
}
Expand Down
Loading