Documentation
¶
Overview ¶
Package config provides pre-built configurations.
Package config provides pre-built configurations.
Package config provides pre-built configurations.
Package config provides pre-built configurations.
Index ¶
- Constants
- type AuthConfiguration
- type AuthConfigurationProps
- type Configuration
- func InRegionLatest() Configuration
- func InRegionLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) Configuration
- func LambdaLatest() Configuration
- func LambdaLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) Configuration
- func LaptopLatest() Configuration
- func LaptopLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) Configuration
- func NewCacheConfiguration(props *ConfigurationProps) Configuration
- type ConfigurationProps
- type GrpcConfiguration
- type GrpcConfigurationProps
- type IGrpcConfiguration
- type LeaderboardConfiguration
- type LeaderboardConfigurationProps
- type ReadConcern
- type StaticGrpcConfiguration
- func (s *StaticGrpcConfiguration) GetDeadline() time.Duration
- func (s *StaticGrpcConfiguration) GetKeepAlivePermitWithoutCalls() bool
- func (s *StaticGrpcConfiguration) GetKeepAliveTime() time.Duration
- func (s *StaticGrpcConfiguration) GetKeepAliveTimeout() time.Duration
- func (s *StaticGrpcConfiguration) GetMaxReceiveMessageLength() int
- func (s *StaticGrpcConfiguration) GetMaxSendMessageLength() int
- func (s *StaticGrpcConfiguration) String() string
- func (s *StaticGrpcConfiguration) WithDeadline(deadline time.Duration) GrpcConfiguration
- func (s *StaticGrpcConfiguration) WithKeepAliveDisabled() GrpcConfiguration
- func (s *StaticGrpcConfiguration) WithKeepAlivePermitWithoutCalls(keepAlivePermitWithoutCalls bool) GrpcConfiguration
- func (s *StaticGrpcConfiguration) WithKeepAliveTime(keepAliveTime time.Duration) GrpcConfiguration
- func (s *StaticGrpcConfiguration) WithKeepAliveTimeout(keepAliveTimeout time.Duration) GrpcConfiguration
- type StaticTransportStrategy
- func (s *StaticTransportStrategy) GetClientSideTimeout() time.Duration
- func (s *StaticTransportStrategy) GetGrpcConfig() GrpcConfiguration
- func (s *StaticTransportStrategy) GetMaxIdle() time.Duration
- func (s *StaticTransportStrategy) String() string
- func (s *StaticTransportStrategy) WithClientTimeout(clientTimeout time.Duration) TransportStrategy
- func (s *StaticTransportStrategy) WithGrpcConfig(grpcConfig GrpcConfiguration) TransportStrategy
- func (s *StaticTransportStrategy) WithMaxIdle(maxIdle time.Duration) TransportStrategy
- type StorageConfiguration
- type StorageConfigurationProps
- type TopicsConfiguration
- type TopicsConfigurationProps
- type TopicsGrpcConfiguration
- type TopicsGrpcConfigurationProps
- type TopicsStaticGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) GetClientTimeout() time.Duration
- func (s *TopicsStaticGrpcConfiguration) GetKeepAlivePermitWithoutCalls() bool
- func (s *TopicsStaticGrpcConfiguration) GetKeepAliveTime() time.Duration
- func (s *TopicsStaticGrpcConfiguration) GetKeepAliveTimeout() time.Duration
- func (s *TopicsStaticGrpcConfiguration) GetMaxReceiveMessageLength() int
- func (s *TopicsStaticGrpcConfiguration) GetMaxSendMessageLength() int
- func (s *TopicsStaticGrpcConfiguration) GetNumStreamGrpcChannels() uint32
- func (s *TopicsStaticGrpcConfiguration) GetNumUnaryGrpcChannels() uint32
- func (s *TopicsStaticGrpcConfiguration) String() string
- func (s *TopicsStaticGrpcConfiguration) WithClientTimeout(client_timeout time.Duration) TopicsGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) WithKeepAliveDisabled() TopicsGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) WithKeepAlivePermitWithoutCalls(keepAlivePermitWithoutCalls bool) TopicsGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) WithKeepAliveTime(keepAliveTime time.Duration) TopicsGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) WithKeepAliveTimeout(keepAliveTimeout time.Duration) TopicsGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsGrpcConfiguration
- func (s *TopicsStaticGrpcConfiguration) WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsGrpcConfiguration
- type TopicsStaticTransportStrategy
- func (s *TopicsStaticTransportStrategy) GetClientSideTimeout() time.Duration
- func (s *TopicsStaticTransportStrategy) GetGrpcConfig() TopicsGrpcConfiguration
- func (s *TopicsStaticTransportStrategy) GetNumStreamGrpcChannels() uint32
- func (s *TopicsStaticTransportStrategy) GetNumUnaryGrpcChannels() uint32
- func (s *TopicsStaticTransportStrategy) String() string
- func (s *TopicsStaticTransportStrategy) WithClientTimeout(clientTimeout time.Duration) TopicsTransportStrategy
- func (s *TopicsStaticTransportStrategy) WithGrpcConfig(grpcConfig TopicsGrpcConfiguration) TopicsTransportStrategy
- func (s *TopicsStaticTransportStrategy) WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsTransportStrategy
- func (s *TopicsStaticTransportStrategy) WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsTransportStrategy
- type TopicsTransportStrategy
- type TopicsTransportStrategyProps
- type TransportStrategy
- type TransportStrategyProps
Constants ¶
const DEFAULT_KEEPALIVE_TIME = 5000 * time.Millisecond
const DEFAULT_KEEPALIVE_TIMEOUT = 1000 * time.Millisecond
const DEFAULT_KEEPALIVE_WITHOUT_STREAM = true
const DEFAULT_MAX_MESSAGE_SIZE = 5_243_000
The default value for max_send_message_length is 4mb. We need to increase this to 5mb in order to support cases where users have requested a limit increase up to our maximum item size of 5mb.
const MAX_CONCURRENT_STREAMS_PER_CHANNEL int = 100
The maximum number of concurrent streams that can be created on a single gRPC channel.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfiguration ¶ added in v1.14.0
type AuthConfiguration interface {
// GetLoggerFactory Returns the current configuration options for logging verbosity and format
GetLoggerFactory() logger.MomentoLoggerFactory
}
func AuthDefault ¶ added in v1.14.0
func AuthDefault() AuthConfiguration
AuthDefault provides defaults configuration for a Auth Client
func AuthDefaultWithLogger ¶ added in v1.14.0
func AuthDefaultWithLogger(loggerFactory logger.MomentoLoggerFactory) AuthConfiguration
func NewAuthConfiguration ¶ added in v1.14.0
func NewAuthConfiguration(props *AuthConfigurationProps) AuthConfiguration
type AuthConfigurationProps ¶ added in v1.14.0
type AuthConfigurationProps struct {
// LoggerFactory represents a type used to configure the Momento logging system.
LoggerFactory logger.MomentoLoggerFactory
}
type Configuration ¶
type Configuration interface {
// GetLoggerFactory Returns the current configuration options for logging verbosity and format
GetLoggerFactory() logger.MomentoLoggerFactory
// GetRetryStrategy Returns the current configuration options for wire interactions with the Momento service
GetRetryStrategy() retry.Strategy
// GetTransportStrategy Returns the current configuration options for wire interactions with the Momento service
GetTransportStrategy() TransportStrategy
// GetClientSideTimeout Returns the current configuration options for client side timeout with the Momento service
GetClientSideTimeout() time.Duration
// GetNumGrpcChannels Returns the configuration option for the number of GRPC channels
// the cache client should open and work with.
GetNumGrpcChannels() uint32
GetReadConcern() ReadConcern
// GetMiddleware Returns the list of middleware to be used by the cache client.
GetMiddleware() []middleware.Middleware
// WithRetryStrategy Copy constructor for overriding TransportStrategy returns a new Configuration object
// with the specified momento.TransportStrategy
WithRetryStrategy(retryStrategy retry.Strategy) Configuration
// WithClientTimeout Copy constructor for overriding TransportStrategy client side timeout. Returns a new
// Configuration object with the specified momento.TransportStrategy using passed client side timeout.
WithClientTimeout(clientTimeout time.Duration) Configuration
// WithTransportStrategy Copy constructor for overriding TransportStrategy returns a new Configuration object
// with the specified momento.TransportStrategy
WithTransportStrategy(transportStrategy TransportStrategy) Configuration
// WithNumGrpcChannels Copy constructor for overriding NumGrpcChannels returns a new Configuration object
// with the specified NumGrpcChannels
WithNumGrpcChannels(numGrpcChannels uint32) Configuration
// WithReadConcern Copy constructor for overriding ReadConcern returns a new Configuration object
// with the specified ReadConcern
WithReadConcern(readConcern ReadConcern) Configuration
// WithMiddleware Copy constructor for overriding Middleware returns a new Configuration object. For example,
// the below configuration will cause each GetRequest and SetRequest to be processed by the
// MyMiddleware middleware request handler:
// loggerFactory := momento_default_logger.NewDefaultMomentoLoggerFactory(momento_default_logger.INFO)
// myConfig := config.LaptopLatest().WithMiddleware([]middleware.Middleware{
// NewMyMiddleware(middleware.Props{
// Logger: loggerFactory.GetLogger("MyMiddleware"),
// IncludeTypes: []interface{}{momento.GetRequest{}, momento.SetRequest{}},
// }),
// })
WithMiddleware(middleware []middleware.Middleware) Configuration
// AddMiddleware Copy constructor for adding Middleware returns a new Configuration object.
AddMiddleware(m middleware.Middleware) Configuration
}
func InRegionLatest ¶ added in v0.11.0
func InRegionLatest() Configuration
InRegionLatest provides defaults suitable for an environment where your client is running in the same region as the Momento service.
It has more aggressive timeouts and retry behavior than the Laptop config. It enables keep-alive pings by default because they are very important for long-lived server environments where there may be periods of time when the connection is idle.
func InRegionLatestWithLogger ¶ added in v0.13.0
func InRegionLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) Configuration
InRegionLatestWithLogger provides defaults suitable for an environment where your client is running in the same region as the Momento service and uses the specified logger.
It has more aggressive timeouts and retry behavior than the Laptop config. It enables keep-alive pings by default because they are very important for long-lived server environments where there may be periods of time when the connection is idle.
func LambdaLatest ¶ added in v1.18.0
func LambdaLatest() Configuration
LambdaLatest provides defaults suitable for an environment where your client is running in a serverless environment like AWS Lambda.
NOTE: keep-alives are very important for long-lived server environments where there may be periods of time when the connection is idle. However, they are very problematic for lambda environments where the lambda runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received from the server. This can cause the keep-alive to timeout even though the connection is completely healthy. Therefore, keep-alives should be disabled in lambda and similar environments.
func LambdaLatestWithLogger ¶ added in v1.18.0
func LambdaLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) Configuration
LambdaLatestWithLogger provides defaults suitable for an environment where your client is running in a serverless environment like AWS Lambda and uses the specified logger.
NOTE: keep-alives are very important for long-lived server environments where there may be periods of time when the connection is idle. However, they are very problematic for lambda environments where the lambda runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received from the server. This can cause the keep-alive to timeout even though the connection is completely healthy. Therefore, keep-alives should be disabled in lambda and similar environments.
func LaptopLatest ¶ added in v0.11.0
func LaptopLatest() Configuration
LaptopLatest provides defaults suitable for a medium-to-high-latency dev environment.
Permissive timeouts, retries, and relaxed latency and throughput targets. It enables keep-alive pings by default because they are very important for long-lived server environments where there may be periods of time when the connection is idle.
func LaptopLatestWithLogger ¶ added in v0.13.0
func LaptopLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) Configuration
LaptopLatestWithLogger provides defaults suitable for a medium-to-high-latency dev environment and uses the specified logger.
Permissive timeouts, retries, and relaxed latency and throughput targets. It enables keep-alive pings by default because they are very important for long-lived server environments where there may be periods of time when the connection is idle.
func NewCacheConfiguration ¶ added in v0.11.0
func NewCacheConfiguration(props *ConfigurationProps) Configuration
type ConfigurationProps ¶
type ConfigurationProps struct {
// LoggerFactory represents a type used to configure the Momento logging system.
LoggerFactory logger.MomentoLoggerFactory
// TransportStrategy is responsible for configuring network tunables.
TransportStrategy TransportStrategy
// RetryStrategy defines a contract for how and when to retry a request.
RetryStrategy retry.Strategy
// NumGrpcChannels is the number of GRPC channels the client should open and work with.
NumGrpcChannels uint32
// ReadConcern is the read concern for the cache client.
ReadConcern ReadConcern
// Middleware is a list of middleware to be used by the cache client.
Middleware []middleware.Middleware
}
type GrpcConfiguration ¶
type GrpcConfiguration interface {
// GetDeadline Returns number of milliseconds the client is willing to wait for an RPC to complete before
// it is terminated with a DeadlineExceeded error.
GetDeadline() time.Duration
// WithDeadline Copy constructor for overriding the client-side deadline. Returns a new GrpcConfiguration
// with the specified client-side deadline
WithDeadline(deadline time.Duration) GrpcConfiguration
// GetKeepAlivePermitWithoutCalls returns bool indicating if it is permissible to send keepalive pings from the client without any outstanding calls.
GetKeepAlivePermitWithoutCalls() bool
// WithKeepAlivePermitWithoutCalls Copy constructor for overriding the keepalive permit without calls.
// Indicates if it permissible to send keepalive pings from the client without any outstanding streams.
//
// NOTE: keep-alives are very important for long-lived server environments where there may be periods of time
// when the connection is idle. However, they are very problematic for lambda environments where the lambda
// runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received
// from the server. This can cause the keep-alive to timeout even though the connection is completely healthy.
// Therefore, keep-alives should be disabled in lambda and similar environments.
WithKeepAlivePermitWithoutCalls(keepAlivePermitWithoutCalls bool) GrpcConfiguration
// GetKeepAliveTimeout returns number of milliseconds the client will wait for a response from a keepalive or ping.
GetKeepAliveTimeout() time.Duration
// WithKeepAliveTimeout Copy constructor for overriding the keepalive timeout. After waiting for a duration of this time,
// if the keepalive ping sender does not receive the ping ack, it will close the transport.
//
// NOTE: keep-alives are very important for long-lived server environments where there may be periods of time
// when the connection is idle. However, they are very problematic for lambda environments where the lambda
// runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received
// from the server. This can cause the keep-alive to timeout even though the connection is completely healthy.
// Therefore, keep-alives should be disabled in lambda and similar environments.
WithKeepAliveTimeout(keepAliveTimeout time.Duration) GrpcConfiguration
// GetKeepAliveTime returns the interval at which to send the keepalive or ping.
GetKeepAliveTime() time.Duration
// WithKeepAliveTime Copy constructor for overriding the keepalive time.
// After a duration of this time the client/server pings its peer to see if the transport is still alive.
//
// NOTE: keep-alives are very important for long-lived server environments where there may be periods of time
// when the connection is idle. However, they are very problematic for lambda environments where the lambda
// runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received
// from the server. This can cause the keep-alive to timeout even though the connection is completely healthy.
// Therefore, keep-alives should be disabled in lambda and similar environments.
WithKeepAliveTime(keepAliveTime time.Duration) GrpcConfiguration
// WithKeepAliveDisabled disables grpc keepalives“`
// Returns a new GrpcConfiguration with keepalive settings disabled (they're enabled by default)
WithKeepAliveDisabled() GrpcConfiguration
// GetMaxSendMessageLength is the maximum message length the client can send to the server. If the client attempts to send a message
// larger than this size, it will result in a RESOURCE_EXHAUSTED error.
GetMaxSendMessageLength() int
// GetMaxReceiveMessageLength is 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() int
}
GrpcConfiguration Encapsulates gRPC configuration tunables.
type GrpcConfigurationProps ¶
type GrpcConfigurationProps struct {
// contains filtered or unexported fields
}
type IGrpcConfiguration ¶ added in v1.33.0
type IGrpcConfiguration interface {
GetKeepAlivePermitWithoutCalls() bool
GetKeepAliveTimeout() time.Duration
GetKeepAliveTime() time.Duration
GetMaxSendMessageLength() int
GetMaxReceiveMessageLength() int
}
Used by `AllDialOptions()` and `GrpcChannelOptionsFromGrpcConfig()` in grpc managers to translate these configurations into grpc.DialOptions.
type LeaderboardConfiguration ¶ added in v1.20.0
type LeaderboardConfiguration interface {
// GetLoggerFactory Returns the current configuration options for logging verbosity and format
GetLoggerFactory() logger.MomentoLoggerFactory
// GetTransportStrategy Returns the current configuration options for wire interactions with the Momento service
GetTransportStrategy() TransportStrategy
// WithTransportStrategy Copy constructor for overriding TransportStrategy returns a new Configuration object
// with the specified momento.TransportStrategy
WithTransportStrategy(transportStrategy TransportStrategy) LeaderboardConfiguration
// GetClientSideTimeout Returns the current configuration options for client side timeout with the Momento service
GetClientSideTimeout() time.Duration
// WithClientTimeout Copy constructor for overriding TransportStrategy client side timeout. Returns a new
// Configuration object with the specified momento.TransportStrategy using passed client side timeout.
WithClientTimeout(clientTimeout time.Duration) LeaderboardConfiguration
}
func LeaderboardDefault ¶ added in v1.20.0
func LeaderboardDefault() LeaderboardConfiguration
LeaderboardDefault provides defaults configuration for a Leaderboard Client
func LeaderboardDefaultWithLogger ¶ added in v1.20.0
func LeaderboardDefaultWithLogger(loggerFactory logger.MomentoLoggerFactory) LeaderboardConfiguration
func NewLeaderboardConfiguration ¶ added in v1.20.0
func NewLeaderboardConfiguration(props *LeaderboardConfigurationProps) LeaderboardConfiguration
type LeaderboardConfigurationProps ¶ added in v1.20.0
type LeaderboardConfigurationProps struct {
// LoggerFactory represents a type used to configure the Momento logging system.
LoggerFactory logger.MomentoLoggerFactory
// TransportStrategy is responsible for configuring network tunables.
TransportStrategy TransportStrategy
}
type ReadConcern ¶ added in v1.16.0
type ReadConcern string
const ( // BALANCED is the default read concern for the cache client. BALANCED ReadConcern = "balanced" // CONSISTENT read concern guarantees read after write consistency. CONSISTENT ReadConcern = "consistent" )
type StaticGrpcConfiguration ¶
type StaticGrpcConfiguration struct {
// contains filtered or unexported fields
}
func NewStaticGrpcConfiguration ¶
func NewStaticGrpcConfiguration(grpcConfiguration *GrpcConfigurationProps) *StaticGrpcConfiguration
NewStaticGrpcConfiguration constructs a new GrpcConfiguration to tune lower-level grpc settings. Note: keepalive settings are enabled by default, use WithKeepAliveDisabled() to disable all of them, or use the appropriate copy constructor to override individual settings.
func (*StaticGrpcConfiguration) GetDeadline ¶
func (s *StaticGrpcConfiguration) GetDeadline() time.Duration
func (*StaticGrpcConfiguration) GetKeepAlivePermitWithoutCalls ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) GetKeepAlivePermitWithoutCalls() bool
func (*StaticGrpcConfiguration) GetKeepAliveTime ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) GetKeepAliveTime() time.Duration
func (*StaticGrpcConfiguration) GetKeepAliveTimeout ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) GetKeepAliveTimeout() time.Duration
func (*StaticGrpcConfiguration) GetMaxReceiveMessageLength ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) GetMaxReceiveMessageLength() int
func (*StaticGrpcConfiguration) GetMaxSendMessageLength ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) GetMaxSendMessageLength() int
func (*StaticGrpcConfiguration) String ¶ added in v1.32.1
func (s *StaticGrpcConfiguration) String() string
func (*StaticGrpcConfiguration) WithDeadline ¶
func (s *StaticGrpcConfiguration) WithDeadline(deadline time.Duration) GrpcConfiguration
func (*StaticGrpcConfiguration) WithKeepAliveDisabled ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) WithKeepAliveDisabled() GrpcConfiguration
func (*StaticGrpcConfiguration) WithKeepAlivePermitWithoutCalls ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) WithKeepAlivePermitWithoutCalls(keepAlivePermitWithoutCalls bool) GrpcConfiguration
func (*StaticGrpcConfiguration) WithKeepAliveTime ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) WithKeepAliveTime(keepAliveTime time.Duration) GrpcConfiguration
func (*StaticGrpcConfiguration) WithKeepAliveTimeout ¶ added in v1.18.0
func (s *StaticGrpcConfiguration) WithKeepAliveTimeout(keepAliveTimeout time.Duration) GrpcConfiguration
type StaticTransportStrategy ¶
type StaticTransportStrategy struct {
// contains filtered or unexported fields
}
func (*StaticTransportStrategy) GetClientSideTimeout ¶
func (s *StaticTransportStrategy) GetClientSideTimeout() time.Duration
func (*StaticTransportStrategy) GetGrpcConfig ¶
func (s *StaticTransportStrategy) GetGrpcConfig() GrpcConfiguration
func (*StaticTransportStrategy) GetMaxIdle ¶
func (s *StaticTransportStrategy) GetMaxIdle() time.Duration
func (*StaticTransportStrategy) String ¶ added in v1.32.1
func (s *StaticTransportStrategy) String() string
func (*StaticTransportStrategy) WithClientTimeout ¶
func (s *StaticTransportStrategy) WithClientTimeout(clientTimeout time.Duration) TransportStrategy
func (*StaticTransportStrategy) WithGrpcConfig ¶
func (s *StaticTransportStrategy) WithGrpcConfig(grpcConfig GrpcConfiguration) TransportStrategy
func (*StaticTransportStrategy) WithMaxIdle ¶
func (s *StaticTransportStrategy) WithMaxIdle(maxIdle time.Duration) TransportStrategy
type StorageConfiguration ¶ added in v1.23.0
type StorageConfiguration interface {
GetLoggerFactory() logger.MomentoLoggerFactory
GetTransportStrategy() TransportStrategy
WithTransportStrategy(transportStrategy TransportStrategy) StorageConfiguration
GetClientSideTimeout() time.Duration
WithClientTimeout(clientTimeout time.Duration) StorageConfiguration
GetNumGrpcChannels() uint32
WithNumGrpcChannels(numGrpcChannels uint32) StorageConfiguration
}
func NewStorageConfiguration ¶ added in v1.23.0
func NewStorageConfiguration(props *StorageConfigurationProps) StorageConfiguration
func StorageLaptopLatest ¶ added in v1.23.0
func StorageLaptopLatest() StorageConfiguration
func StorageLaptopLatestWithLogger ¶ added in v1.23.0
func StorageLaptopLatestWithLogger(loggerFactory logger.MomentoLoggerFactory) StorageConfiguration
type StorageConfigurationProps ¶ added in v1.23.0
type StorageConfigurationProps struct {
LoggerFactory logger.MomentoLoggerFactory
TransportStrategy TransportStrategy
NumGrpcChannels uint32
}
type TopicsConfiguration ¶ added in v1.5.0
type TopicsConfiguration interface {
// GetLoggerFactory Returns the current configuration options for logging verbosity and format
GetLoggerFactory() logger.MomentoLoggerFactory
// GetMaxSubscriptions Returns the configuration option for the maximum number of subscriptions
// a client is allowed
// Deprecated: Use GetNumGrpcChannels instead.
GetMaxSubscriptions() uint32
// WithMaxSubscriptions sets the maximum number of subscriptions the topic client will support.
// The topic client will create a dynamic pool of gRPC channels under the hood to support the
// specified number of subscriptions.
// Using WithMaxSubscriptions will override the NumStreamGrpcChannels setting, which creates a static
// pool of gRPC channels.
WithMaxSubscriptions(maxSubscriptions uint32) TopicsConfiguration
// Deprecated: use GetNumStreamGrpcChannels and GetNumUnaryGrpcChannels instead.
// GetNumGrpcChannels Returns the configuration option for the number of gRPC channels
// the topic client should open and work with.
GetNumGrpcChannels() uint32
// Deprecated: please use WithMaxSubscriptions to set the maximum number of subscriptions you
// expect a topic client to support, or use the WithNumStreamGrpcChannels and WithNumUnaryGrpcChannels
// overrides to tune the number of gRPC channels for stream and unary operations, respectively.
// Using WithNumGrpcChannels now will default creating 4 unary channels and `numGrpcChannels`
// number of stream channels.
//
// WithNumGrpcChannels creates the specified number of gRPC connections
// (each gRPC connection can multiplex 100 subscribers/publishers). Defaults to 1.
WithNumGrpcChannels(numGrpcChannels uint32) TopicsConfiguration
// GetNumStreamGrpcChannels Returns the configuration option for the number of GRPC channels
// the topic client should open and work with for stream operations (i.e. topic subscriptions).
GetNumStreamGrpcChannels() uint32
// WithNumStreamGrpcChannels tells the topic client to create a static pool of the specified number
// of gRPC connections for stream operations. Each gRPC connection can multiplex 100 concurrent subscriptions.
// Defaults to 4.
WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsConfiguration
// GetNumUnaryGrpcChannels Returns the configuration option for the number of GRPC channels
// the topic client should open and work with for unary operations (i.e. topic publishes).
GetNumUnaryGrpcChannels() uint32
// WithNumUnaryGrpcChannels tells the topic client to create a static pool of the specified number
// of gRPC connections for unary operations. Each gRPC connection can multiplex 100 concurrent publish requests.
// Defaults to 4.
WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsConfiguration
// GetTransportStrategy returns the current transport strategy
GetTransportStrategy() TopicsTransportStrategy
// WithTransportStrategy updates the configuration to use the specified transport strategy.
WithTransportStrategy(transportStrategy TopicsTransportStrategy) TopicsConfiguration
// GetClientSideTimeout Returns the current configuration options for client side timeout with the Momento service
GetClientSideTimeout() time.Duration
// WithRetryStrategy updates the configuration to use the specified retry strategy.
WithRetryStrategy(retryStrategy retry.Strategy) TopicsConfiguration
// GetRetryStrategy Returns the current strategy for topic subscription reconnection
GetRetryStrategy() retry.Strategy
// GetMiddleware Returns the list of middleware to be used by the topic client.
GetMiddleware() []middleware.TopicMiddleware
// WithMiddleware Copy constructor for overriding Middleware returns a new Configuration object
// with the specified Middleware
WithMiddleware(middleware []middleware.TopicMiddleware) TopicsConfiguration
// AddMiddleware Copy constructor for adding Middleware returns a new Configuration object.
AddMiddleware(m middleware.TopicMiddleware) TopicsConfiguration
}
func NewTopicConfiguration ¶ added in v1.5.0
func NewTopicConfiguration(props *TopicsConfigurationProps) TopicsConfiguration
func TopicsDefault ¶ added in v1.5.0
func TopicsDefault() TopicsConfiguration
TopicsDefault provides defaults configuration for a Topic Client
func TopicsDefaultWithLogger ¶ added in v1.5.0
func TopicsDefaultWithLogger(loggerFactory logger.MomentoLoggerFactory) TopicsConfiguration
type TopicsConfigurationProps ¶ added in v1.5.0
type TopicsConfigurationProps struct {
// LoggerFactory represents a type used to configure the Momento logging system.
LoggerFactory logger.MomentoLoggerFactory
// MaxSubscriptions is the maximum number of subscriptions the topic client will support.
// The topic client will create a dynamic pool of gRPC channels under the hood to support the
// specified number of subscriptions.
// Using WithMaxSubscriptions will override the NumStreamGrpcChannels setting, which creates a static
// pool of gRPC channels.
MaxSubscriptions uint32
// Deprecated: use NumStreamGrpcChannels and NumUnaryGrpcChannels instead.
NumGrpcChannels uint32
// TransportStrategy is responsible for configuring network tunables for the GRPC client,
// including the number of stream and unary grpc channels that should be used.
TransportStrategy TopicsTransportStrategy
// RetryStrategy is responsible for configuring the strategy for reconnecting a subscription to a
// topic that has been interrupted. It is not applicable to publish requests.
RetryStrategy retry.Strategy
// Middleware is a list of middleware to be used by the topic client.
Middleware []middleware.TopicMiddleware
}
type TopicsGrpcConfiguration ¶ added in v1.33.0
type TopicsGrpcConfiguration interface {
// GetClientTimeout Returns number of milliseconds the client is willing to wait for an RPC to complete before
// it is terminated with a DeadlineExceeded error.
GetClientTimeout() time.Duration
// WithClientTimeout Copy constructor for overriding the client-side deadline. Returns a new GrpcConfiguration
// with the specified client-side deadline
WithClientTimeout(deadline time.Duration) TopicsGrpcConfiguration
// GetKeepAlivePermitWithoutCalls returns bool indicating if it is permissible to send keepalive pings from the client without any outstanding calls.
GetKeepAlivePermitWithoutCalls() bool
// WithKeepAlivePermitWithoutCalls Copy constructor for overriding the keepalive permit without calls.
// Indicates if it permissible to send keepalive pings from the client without any outstanding streams.
//
// NOTE: keep-alives are very important for long-lived server environments where there may be periods of time
// when the connection is idle. However, they are very problematic for lambda environments where the lambda
// runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received
// from the server. This can cause the keep-alive to timeout even though the connection is completely healthy.
// Therefore, keep-alives should be disabled in lambda and similar environments.
WithKeepAlivePermitWithoutCalls(keepAlivePermitWithoutCalls bool) TopicsGrpcConfiguration
// GetKeepAliveTimeout returns number of milliseconds the client will wait for a response from a keepalive or ping.
GetKeepAliveTimeout() time.Duration
// WithKeepAliveTimeout Copy constructor for overriding the keepalive timeout. After waiting for a duration of this time,
// if the keepalive ping sender does not receive the ping ack, it will close the transport.
//
// NOTE: keep-alives are very important for long-lived server environments where there may be periods of time
// when the connection is idle. However, they are very problematic for lambda environments where the lambda
// runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received
// from the server. This can cause the keep-alive to timeout even though the connection is completely healthy.
// Therefore, keep-alives should be disabled in lambda and similar environments.
WithKeepAliveTimeout(keepAliveTimeout time.Duration) TopicsGrpcConfiguration
// GetKeepAliveTime returns the interval at which to send the keepalive or ping.
GetKeepAliveTime() time.Duration
// WithKeepAliveTime Copy constructor for overriding the keepalive time.
// After a duration of this time the client/server pings its peer to see if the transport is still alive.
//
// NOTE: keep-alives are very important for long-lived server environments where there may be periods of time
// when the connection is idle. However, they are very problematic for lambda environments where the lambda
// runtime is continuously frozen and unfrozen, because the lambda may be frozen before the "ACK" is received
// from the server. This can cause the keep-alive to timeout even though the connection is completely healthy.
// Therefore, keep-alives should be disabled in lambda and similar environments.
WithKeepAliveTime(keepAliveTime time.Duration) TopicsGrpcConfiguration
// WithKeepAliveDisabled disables grpc keepalives“`
// Returns a new GrpcConfiguration with keepalive settings disabled (they're enabled by default)
WithKeepAliveDisabled() TopicsGrpcConfiguration
// GetMaxSendMessageLength is the maximum message length the client can send to the server. If the client attempts to send a message
// larger than this size, it will result in a RESOURCE_EXHAUSTED error.
GetMaxSendMessageLength() int
// GetMaxReceiveMessageLength is 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() int
// GetNumStreamGrpcChannels Returns the configuration option for the number of GRPC channels
// the topic client should open and work with for stream operations (i.e. topic subscriptions).
GetNumStreamGrpcChannels() uint32
// WithNumStreamGrpcChannels is currently implemented to create the specified number of GRPC connections
// for stream operations. Each GRPC connection can multiplex 100 concurrent subscriptions.
// Defaults to 4.
WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsGrpcConfiguration
// GetNumUnaryGrpcChannels Returns the configuration option for the number of GRPC channels
// the topic client should open and work with for unary operations (i.e. topic publishes).
GetNumUnaryGrpcChannels() uint32
// WithNumUnaryGrpcChannels is currently implemented to create the specified number of GRPC connections
// for unary operations. Each GRPC connection can multiplex 100 concurrent publish requests.
// Defaults to 4.
WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsGrpcConfiguration
}
GrpcConfiguration Encapsulates gRPC configuration tunables.
type TopicsGrpcConfigurationProps ¶ added in v1.33.0
type TopicsGrpcConfigurationProps struct {
// contains filtered or unexported fields
}
type TopicsStaticGrpcConfiguration ¶ added in v1.33.0
type TopicsStaticGrpcConfiguration struct {
// contains filtered or unexported fields
}
func NewTopicsStaticGrpcConfiguration ¶ added in v1.33.0
func NewTopicsStaticGrpcConfiguration(grpcConfiguration *TopicsGrpcConfigurationProps) *TopicsStaticGrpcConfiguration
NewStaticGrpcConfiguration constructs a new TopicsGrpcConfiguration to tune lower-level grpc settings. Note: keepalive settings are enabled by default, use WithKeepAliveDisabled() to disable all of them, or use the appropriate copy constructor to override individual settings.
func (*TopicsStaticGrpcConfiguration) GetClientTimeout ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetClientTimeout() time.Duration
func (*TopicsStaticGrpcConfiguration) GetKeepAlivePermitWithoutCalls ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetKeepAlivePermitWithoutCalls() bool
func (*TopicsStaticGrpcConfiguration) GetKeepAliveTime ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetKeepAliveTime() time.Duration
func (*TopicsStaticGrpcConfiguration) GetKeepAliveTimeout ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetKeepAliveTimeout() time.Duration
func (*TopicsStaticGrpcConfiguration) GetMaxReceiveMessageLength ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetMaxReceiveMessageLength() int
func (*TopicsStaticGrpcConfiguration) GetMaxSendMessageLength ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetMaxSendMessageLength() int
func (*TopicsStaticGrpcConfiguration) GetNumStreamGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetNumStreamGrpcChannels() uint32
func (*TopicsStaticGrpcConfiguration) GetNumUnaryGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) GetNumUnaryGrpcChannels() uint32
func (*TopicsStaticGrpcConfiguration) String ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) String() string
func (*TopicsStaticGrpcConfiguration) WithClientTimeout ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithClientTimeout(client_timeout time.Duration) TopicsGrpcConfiguration
func (*TopicsStaticGrpcConfiguration) WithKeepAliveDisabled ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithKeepAliveDisabled() TopicsGrpcConfiguration
func (*TopicsStaticGrpcConfiguration) WithKeepAlivePermitWithoutCalls ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithKeepAlivePermitWithoutCalls(keepAlivePermitWithoutCalls bool) TopicsGrpcConfiguration
func (*TopicsStaticGrpcConfiguration) WithKeepAliveTime ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithKeepAliveTime(keepAliveTime time.Duration) TopicsGrpcConfiguration
func (*TopicsStaticGrpcConfiguration) WithKeepAliveTimeout ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithKeepAliveTimeout(keepAliveTimeout time.Duration) TopicsGrpcConfiguration
func (*TopicsStaticGrpcConfiguration) WithNumStreamGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsGrpcConfiguration
func (*TopicsStaticGrpcConfiguration) WithNumUnaryGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticGrpcConfiguration) WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsGrpcConfiguration
type TopicsStaticTransportStrategy ¶ added in v1.33.0
type TopicsStaticTransportStrategy struct {
// contains filtered or unexported fields
}
func (*TopicsStaticTransportStrategy) GetClientSideTimeout ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) GetClientSideTimeout() time.Duration
func (*TopicsStaticTransportStrategy) GetGrpcConfig ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) GetGrpcConfig() TopicsGrpcConfiguration
func (*TopicsStaticTransportStrategy) GetNumStreamGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) GetNumStreamGrpcChannels() uint32
func (*TopicsStaticTransportStrategy) GetNumUnaryGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) GetNumUnaryGrpcChannels() uint32
func (*TopicsStaticTransportStrategy) String ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) String() string
func (*TopicsStaticTransportStrategy) WithClientTimeout ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) WithClientTimeout(clientTimeout time.Duration) TopicsTransportStrategy
func (*TopicsStaticTransportStrategy) WithGrpcConfig ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) WithGrpcConfig(grpcConfig TopicsGrpcConfiguration) TopicsTransportStrategy
func (*TopicsStaticTransportStrategy) WithNumStreamGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsTransportStrategy
func (*TopicsStaticTransportStrategy) WithNumUnaryGrpcChannels ¶ added in v1.33.0
func (s *TopicsStaticTransportStrategy) WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsTransportStrategy
type TopicsTransportStrategy ¶ added in v1.33.0
type TopicsTransportStrategy interface {
// GetGrpcConfig Configures the low-level gRPC settings for the Momento client's communication
// with the Momento server.
GetGrpcConfig() TopicsGrpcConfiguration
// WithGrpcConfig Copy constructor for overriding the gRPC configuration. Returns a new
// TransportStrategy with the specified gRPC config.
WithGrpcConfig(grpcConfig TopicsGrpcConfiguration) TopicsTransportStrategy
// GetClientSideTimeout Gets configuration for client side timeout from transport strategy
GetClientSideTimeout() time.Duration
// WithClientTimeout Copy constructor for overriding the client sie timeout. Returns a new
// TransportStrategy with the specified client side timeout.
WithClientTimeout(clientTimeout time.Duration) TopicsTransportStrategy
// GetNumStreamGrpcChannels Returns the configuration option for the number of GRPC channels
// the topic client should open and work with for stream operations (i.e. topic subscriptions).
GetNumStreamGrpcChannels() uint32
// WithNumStreamGrpcChannels is currently implemented to create the specified number of GRPC connections
// for stream operations. Each GRPC connection can multiplex 100 concurrent subscriptions.
// Defaults to 4.
WithNumStreamGrpcChannels(numStreamGrpcChannels uint32) TopicsTransportStrategy
// GetNumUnaryGrpcChannels Returns the configuration option for the number of GRPC channels
// the topic client should open and work with for unary operations (i.e. topic publishes).
GetNumUnaryGrpcChannels() uint32
// WithNumUnaryGrpcChannels is currently implemented to create the specified number of GRPC connections
// for unary operations. Each GRPC connection can multiplex 100 concurrent publish requests.
// Defaults to 4.
WithNumUnaryGrpcChannels(numUnaryGrpcChannels uint32) TopicsTransportStrategy
}
func NewTopicsStaticTransportStrategy ¶ added in v1.33.0
func NewTopicsStaticTransportStrategy(props *TopicsTransportStrategyProps) TopicsTransportStrategy
type TopicsTransportStrategyProps ¶ added in v1.33.0
type TopicsTransportStrategyProps struct {
// low-level gRPC settings for communication with the Momento server
GrpcConfiguration TopicsGrpcConfiguration
}
type TransportStrategy ¶
type TransportStrategy interface {
// GetGrpcConfig Configures the low-level gRPC settings for the Momento client's communication
// with the Momento server.
GetGrpcConfig() GrpcConfiguration
// WithGrpcConfig Copy constructor for overriding the gRPC configuration. Returns a new
// TransportStrategy with the specified gRPC config.
WithGrpcConfig(grpcConfig GrpcConfiguration) TransportStrategy
// GetClientSideTimeout Gets configuration for client side timeout from transport strategy
GetClientSideTimeout() time.Duration
// WithClientTimeout Copy constructor for overriding the client sie timeout. Returns a new
// TransportStrategy with the specified client side timeout.
WithClientTimeout(clientTimeout time.Duration) TransportStrategy
}
func NewStaticTransportStrategy ¶
func NewStaticTransportStrategy(props *TransportStrategyProps) TransportStrategy
type TransportStrategyProps ¶
type TransportStrategyProps struct {
// low-level gRPC settings for communication with the Momento server
GrpcConfiguration GrpcConfiguration
}