import { GrpcConfiguration, GrpcConfigurationProps } from './grpc-configuration'; export interface TransportStrategy { /** * Configures the low-level gRPC settings for the Momento client's communication * with the Momento server. * @returns {GrpcConfiguration} */ getGrpcConfig(): GrpcConfiguration; /** * Copy constructor for overriding the gRPC configuration * @param {GrpcConfiguration} grpcConfig * @returns {TransportStrategy} a new TransportStrategy with the specified gRPC config. */ withGrpcConfig(grpcConfig: GrpcConfiguration): TransportStrategy; /** * Copy constructor to update the client-side timeout * @param {number} clientTimeoutMillis * @returns {TransportStrategy} a new TransportStrategy with the specified client timeout */ withClientTimeoutMillis(clientTimeoutMillis: number): TransportStrategy; /** * The maximum duration for which a connection may remain idle before being replaced. This * setting can be used to force re-connection of a client if it has been idle for too long. * In environments such as AWS lambda, if the lambda is suspended for too long the connection * may be closed by the load balancer, resulting in an error on the subsequent request. If * this setting is set to a duration less than the load balancer timeout, we can ensure that * the connection will be refreshed to avoid errors. * @returns {number} */ getMaxIdleMillis(): number; /** * @returns {number} the interval time in milliseconds for when each cache client should be re-initialized. */ getMaxClientAgeMillis(): number | undefined; /** * Copy constructor to update the max idle connection timeout. (See {getMaxIdleMillis}.) * @param {number} maxIdleMillis * @returns {TransportStrategy} a new TransportStrategy with the specified max idle connection timeout. */ withMaxIdleMillis(maxIdleMillis: number): TransportStrategy; /** * Copy constructor to update the max client age in millis. (See {getMaxClientAgeMillis}.) * @param {number} maxClientAgeMillis * @returns {TransportStrategy} a new TransportStrategy with the specified max client age. */ withMaxClientAgeMillis(maxClientAgeMillis: number): TransportStrategy; /** * returns the maximum number of concurrent requests that can be made by the client. */ getMaxConcurrentRequests(): number | undefined; /** * Copy constructor to update the maximum number of concurrent requests that can be made by the client. * @param {number} maxConcurrentRequests * @returns {TransportStrategy} a new TransportStrategy with the specified concurrent requests limit. */ withMaxConcurrentRequests(maxConcurrentRequests: number): TransportStrategy; } export interface TransportStrategyProps { /** * low-level gRPC settings for communication with the Momento server */ grpcConfiguration: GrpcConfiguration; /** * The maximum duration for which a connection may remain idle before being replaced. This * setting can be used to force re-connection of a client if it has been idle for too long. * In environments such as AWS lambda, if the lambda is suspended for too long the connection * may be closed by the load balancer, resulting in an error on the subsequent request. If * this setting is set to a duration less than the load balancer timeout, we can ensure that * the connection will be refreshed to avoid errors. * @returns {number} */ maxIdleMillis: number; /** * Specifies the interval time in milliseconds for when each cache client should be re-initialized. */ maxClientAgeMillis?: number; } export declare class StaticGrpcConfiguration implements GrpcConfiguration { private readonly deadlineMillis; private readonly maxSessionMemoryMb; private readonly numClients; private readonly maxConcurrentRequests?; private readonly keepAlivePermitWithoutCalls?; private readonly keepAliveTimeoutMs?; private readonly keepAliveTimeMs?; private readonly maxSendMessageLength?; private readonly maxReceiveMessageLength?; constructor(props: GrpcConfigurationProps); getDeadlineMillis(): number; getMaxSessionMemoryMb(): number; getKeepAliveTimeoutMS(): number | undefined; getKeepAliveTimeMS(): number | undefined; getKeepAlivePermitWithoutCalls(): number | undefined; withDeadlineMillis(deadlineMillis: number): StaticGrpcConfiguration; withMaxSessionMemoryMb(maxSessionMemoryMb: number): StaticGrpcConfiguration; getMaxSendMessageLength(): number | undefined; withMaxSendMessageLength(maxSendMessageLength: number): StaticGrpcConfiguration; getMaxReceiveMessageLength(): number | undefined; withMaxReceiveMessageLength(maxReceiveMessageLength: number): StaticGrpcConfiguration; getNumClients(): number; withNumClients(numClients: number): GrpcConfiguration; getMaxConcurrentRequests(): number | undefined; withMaxConcurrentRequests(maxConcurrentRequests: number): GrpcConfiguration; } export declare class StaticTransportStrategy implements TransportStrategy { private readonly grpcConfiguration; private readonly maxIdleMillis; private readonly maxClientAgeMillis?; constructor(props: TransportStrategyProps); getGrpcConfig(): GrpcConfiguration; getMaxClientAgeMillis(): number | undefined; withGrpcConfig(grpcConfiguration: GrpcConfiguration): StaticTransportStrategy; getMaxIdleMillis(): number; withMaxIdleMillis(maxIdleMillis: number): TransportStrategy; withMaxClientAgeMillis(maxClientAgeMillis: number): TransportStrategy; withClientTimeoutMillis(clientTimeout: number): StaticTransportStrategy; getMaxConcurrentRequests(): number | undefined; withMaxConcurrentRequests(maxConcurrentRequests: number): StaticTransportStrategy; }