Documentation
¶
Overview ¶
Package momento represents API CacheClient interface accessors including control/data operations, errors, operation requests and responses for the SDK.
Package momento represents API CacheClient interface accessors including control/data operations, errors, operation requests and responses for the SDK.
Package momento represents API CacheClient interface accessors including control/data operations, errors, operation requests and responses for the SDK.
Index ¶
- Constants
- Variables
- type AllCacheItems
- type AllCaches
- type AllTopics
- type AuthClient
- type BatchSetItem
- type Bytes
- type CacheClient
- func NewCacheClient(configuration config.Configuration, credentialProvider auth.CredentialProvider, ...) (CacheClient, error)
- func NewCacheClientWithDefaultCache(configuration config.Configuration, credentialProvider auth.CredentialProvider, ...) (CacheClient, error)
- func NewCacheClientWithEagerConnectTimeout(configuration config.Configuration, credentialProvider auth.CredentialProvider, ...) (CacheClient, error)
- type CacheClientProps
- type CacheItemKey
- type CacheItemKeyPrefix
- type CacheItemSelector
- type CacheName
- type CachePermission
- type CacheRole
- type CacheSelector
- type CreateCacheRequest
- type CreateStoreRequest
- type DecreaseTtlRequest
- type DeleteCacheRequest
- type DeleteRequest
- type DeleteStoreRequest
- type DictionaryElement
- func DictionaryElementsFromMap(theMap map[string]string) []DictionaryElement
- func DictionaryElementsFromMapStringBytes(theMap map[string][]byte) []DictionaryElement
- func DictionaryElementsFromMapStringString(theMap map[string]string) []DictionaryElement
- func DictionaryElementsFromMapStringValue(theMap map[string]Value) []DictionaryElement
- type DictionaryFetchRequest
- type DictionaryGetFieldRequest
- type DictionaryGetFieldsRequest
- type DictionaryIncrementRequest
- type DictionaryLengthRequest
- type DictionaryRemoveFieldRequest
- type DictionaryRemoveFieldsRequest
- type DictionarySetFieldRequest
- type DictionarySetFieldsRequest
- type DisposableTokenCachePermission
- type DisposableTokenCachePermissions
- type DisposableTokenProps
- type DisposableTokenScope
- func CacheKeyPrefixReadOnly(selector CacheSelector, keyPrefix Value) DisposableTokenScope
- func CacheKeyPrefixReadWrite(selector CacheSelector, keyPrefix Value) DisposableTokenScope
- func CacheKeyPrefixWriteOnly(selector CacheSelector, keyPrefix Value) DisposableTokenScope
- func CacheKeyReadOnly(selector CacheSelector, key Value) DisposableTokenScope
- func CacheKeyReadWrite(selector CacheSelector, key Value) DisposableTokenScope
- func CacheKeyWriteOnly(selector CacheSelector, key Value) DisposableTokenScope
- func TopicNamePrefixPublishOnly(selector CacheSelector, topicNamePrefix string) DisposableTokenScope
- func TopicNamePrefixPublishSubscribe(selector CacheSelector, topicNamePrefix string) DisposableTokenScope
- func TopicNamePrefixSubscribeOnly(selector CacheSelector, topicNamePrefix string) DisposableTokenScope
- type Field
- type GenerateApiKeyRequest
- type GenerateDisposableTokenRequest
- type GetBatchRequest
- type GetRequest
- type GetWithHashRequest
- type IncreaseTtlRequest
- type IncrementRequest
- type ItemGetTtlRequest
- type ItemGetTypeRequest
- type Key
- type KeysExistRequest
- type Leaderboard
- type LeaderboardFetchByRankRequest
- type LeaderboardFetchByScoreRequest
- type LeaderboardGetRankRequest
- type LeaderboardInternalDeleteRequest
- type LeaderboardInternalFetchByRankRequest
- type LeaderboardInternalFetchByScoreRequest
- type LeaderboardInternalGetRankRequest
- type LeaderboardInternalLengthRequest
- type LeaderboardInternalRemoveElementsRequest
- type LeaderboardInternalUpsertRequest
- type LeaderboardOrder
- type LeaderboardRemoveElementsRequest
- type LeaderboardRequest
- type LeaderboardUpsertElement
- type LeaderboardUpsertRequest
- type ListCachesRequest
- type ListConcatenateBackRequest
- type ListConcatenateFrontRequest
- type ListFetchRequest
- type ListLengthRequest
- type ListPopBackRequest
- type ListPopFrontRequest
- type ListPushBackRequest
- type ListPushFrontRequest
- type ListRemoveValueRequest
- type ListStoresRequest
- type MomentoError
- type Permission
- type PermissionScope
- type Permissions
- func CacheReadOnly(selector CacheSelector) Permissions
- func CacheReadWrite(selector CacheSelector) Permissions
- func CacheWriteOnly(selector CacheSelector) Permissions
- func TopicPublishOnly(cacheSelector CacheSelector, topicSelector TopicSelector) Permissions
- func TopicPublishSubscribe(cacheSelector CacheSelector, topicSelector TopicSelector) Permissions
- func TopicSubscribeOnly(cacheSelector CacheSelector, topicSelector TopicSelector) Permissions
- type PredefinedScope
- type PredefinedScopeInterface
- type PreviewLeaderboardClient
- type PreviewStorageClient
- type RefreshApiKeyRequest
- type SetAddElementRequest
- type SetAddElementsRequest
- type SetBatchRequest
- type SetContainsElementsRequest
- type SetFetchRequest
- type SetIfAbsentOrEqualRequest
- type SetIfAbsentOrHashEqualRequest
- type SetIfAbsentOrHashNotEqualRequest
- type SetIfAbsentRequest
- type SetIfEqualRequest
- type SetIfNotEqualRequest
- type SetIfNotExistsRequest
- type SetIfPresentAndHashEqualRequest
- type SetIfPresentAndHashNotEqualRequest
- type SetIfPresentAndNotEqualRequest
- type SetIfPresentRequest
- type SetLengthRequest
- type SetPopRequest
- type SetRemoveElementRequest
- type SetRemoveElementsRequest
- type SetRequest
- type SetWithHashRequest
- type SortedSetElement
- type SortedSetFetchByRankRequest
- type SortedSetFetchByScoreRequest
- type SortedSetGetRankRequest
- type SortedSetGetScoreRequest
- type SortedSetGetScoresRequest
- type SortedSetIncrementScoreRequest
- type SortedSetLengthByScoreRequest
- type SortedSetLengthRequest
- type SortedSetOrder
- type SortedSetPutElementRequest
- type SortedSetPutElementsRequest
- type SortedSetRemoveElementRequest
- type SortedSetRemoveElementsRequest
- type StorageDeleteRequest
- type StorageGetRequest
- type StoragePutRequest
- type String
- type TopicClient
- type TopicDiscontinuity
- type TopicEvent
- type TopicHeartbeat
- type TopicItem
- type TopicName
- type TopicNamePrefix
- type TopicPermission
- type TopicPublishRequest
- type TopicRole
- type TopicSelector
- type TopicSubscribeRequest
- type TopicSubscription
- type TopicValue
- type UpdateTtlRequest
- type Value
Constants ¶
const ( // InvalidArgumentError occurs when an invalid argument is passed to Momento client. InvalidArgumentError = "InvalidArgumentError" // InternalServerError occurs when an unexpected error is encountered while trying to fulfill the request. InternalServerError = "InternalServerError" // ClientSdkError occurs when a client side error happens. ClientSdkError = "ClientSdkError" // BadRequestError occurs when a request was invalid. BadRequestError = "BadRequestError" // CanceledError occurs when a request was cancelled by the server. CanceledError = "CanceledError" // TimeoutError occurs when an operation did not complete in time. TimeoutError = "TimeoutError" // PermissionError occurs when there are insufficient permissions to perform operation. PermissionError = "PermissionError" // AuthenticationError occurs when invalid authentication credentials to connect to cache service are provided. AuthenticationError = "AuthenticationError" // LimitExceededError occurs when request rate, bandwidth, or object size exceeded the limits for the account. LimitExceededError = "LimitExceededError" // NotFoundError occurs when a cache with specified name doesn't exist. // // Deprecated: Use more specific CacheNotFoundError, StoreNotFoundError, or ItemNotFoundError instead. NotFoundError = "NotFoundError" // CacheNotFoundError occurs when a cache with specified name doesn't exist. CacheNotFoundError = "NotFoundError" // StoreNotFoundError occurs when a store with specified name doesn't exist. StoreNotFoundError = "StoreNotFoundError" // ItemNotFoundError occurs when an item with specified key doesn't exist. ItemNotFoundError = "ItemNotFoundError" // AlreadyExistsError occurs when a cache with specified name already exists. AlreadyExistsError = "AlreadyExistsError" // UnknownServiceError occurs when an unknown error has occurred. UnknownServiceError = "UnknownServiceError" ServerUnavailableError = "ServerUnavailableError" // FailedPreconditionError occurs when the system is not in a state required for the operation's execution. FailedPreconditionError = "FailedPreconditionError" // ConnectionError occurs when there is an error connecting to Momento servers. ConnectionError = "ConnectionError" // ClientResourceExhausted occurs when a client resource (such as memory or number of concurrent grpc streams) is exhausted. ClientResourceExhaustedError = "ClientResourceExhaustedError" )
Momento Error codes
const DEFAULT_NUM_STREAM_GRPC_CHANNELS uint32 = 4
const DEFAULT_NUM_UNARY_GRPC_CHANNELS uint32 = 4
const MAX_CONCURRENT_STREAMS_PER_CHANNEL int = 100
Deprecated: use config.MAX_CONCURRENT_STREAMS_PER_CHANNEL instead
Variables ¶
var AllDataReadWrite = Permissions{ Permissions: []Permission{ TopicPermission{Topic: AllTopics{}, Cache: AllCaches{}, Role: PublishSubscribe}, CachePermission{Cache: AllCaches{}, Role: ReadWrite}, }, }
Functions ¶
This section is empty.
Types ¶
type AllCacheItems ¶ added in v1.14.0
type AllCacheItems struct{}
func (AllCacheItems) IsCacheItemSelector ¶ added in v1.14.0
func (AllCacheItems) IsCacheItemSelector()
type AllCaches ¶ added in v1.14.0
type AllCaches struct{}
func (AllCaches) IsAllCaches ¶ added in v1.14.0
type AllTopics ¶ added in v1.14.0
type AllTopics struct{}
func (AllTopics) IsAllTopics ¶ added in v1.14.0
type AuthClient ¶ added in v1.14.0
type AuthClient interface {
GenerateDisposableToken(ctx context.Context, request *GenerateDisposableTokenRequest) (responses.GenerateDisposableTokenResponse, error)
GenerateApiKey(ctx context.Context, request *GenerateApiKeyRequest) (responses.GenerateApiKeyResponse, error)
RefreshApiKey(ctx context.Context, request *RefreshApiKeyRequest) (responses.RefreshApiKeyResponse, error)
Close()
}
func NewAuthClient ¶ added in v1.14.0
func NewAuthClient(authConfiguration config.AuthConfiguration, credentialProvider auth.CredentialProvider) (AuthClient, error)
NewAuthClient returns a new AuthClient with provided configuration and credential provider arguments.
type BatchSetItem ¶ added in v1.19.0
Type to hold key-value pairs to set in a batch set request.
type CacheClient ¶ added in v0.11.0
type CacheClient interface {
Logger() logger.MomentoLogger
// CreateCache Creates a cache if it does not exist.
CreateCache(ctx context.Context, request *CreateCacheRequest) (responses.CreateCacheResponse, error)
// DeleteCache deletes a cache and all the items within it.
DeleteCache(ctx context.Context, request *DeleteCacheRequest) (responses.DeleteCacheResponse, error)
// ListCaches lists all caches.
ListCaches(ctx context.Context, request *ListCachesRequest) (responses.ListCachesResponse, error)
// Increment adds an integer quantity to a field value.
Increment(ctx context.Context, r *IncrementRequest) (responses.IncrementResponse, error)
// Set sets the value in cache with a given time to live (TTL)
Set(ctx context.Context, r *SetRequest) (responses.SetResponse, error)
// SetIfNotExists sets the value in cache with a given time to live (TTL) if key is not already present
//
// Deprecated: Use SetIfAbsent instead.
SetIfNotExists(ctx context.Context, r *SetIfNotExistsRequest) (responses.SetIfNotExistsResponse, error)
// SetIfAbsent sets the value in cache with a given time to live (TTL) if key is not already present
SetIfAbsent(ctx context.Context, r *SetIfAbsentRequest) (responses.SetIfAbsentResponse, error)
// SetIfPresent sets the value in cache with a given time to live (TTL) if key is present
SetIfPresent(ctx context.Context, r *SetIfPresentRequest) (responses.SetIfPresentResponse, error)
// SetIfPresentAndNotEqual sets the value in cache with a given time to live (TTL) if key is present and its value is not equal to the given value
SetIfPresentAndNotEqual(ctx context.Context, r *SetIfPresentAndNotEqualRequest) (responses.SetIfPresentAndNotEqualResponse, error)
// SetIfEqual sets the value in cache with a given time to live (TTL) if key is present and its value is equal to the given value
SetIfEqual(ctx context.Context, r *SetIfEqualRequest) (responses.SetIfEqualResponse, error)
// SetIfAbsentOrEqual sets the value in cache with a given time to live (TTL) if key is present and its value is equal to the given value
SetIfAbsentOrEqual(ctx context.Context, r *SetIfAbsentOrEqualRequest) (responses.SetIfAbsentOrEqualResponse, error)
// SetIfNotEqual sets the value in cache with a given time to live (TTL) if key is present and its value is not equal to the given value
SetIfNotEqual(ctx context.Context, r *SetIfNotEqualRequest) (responses.SetIfNotEqualResponse, error)
// SetIfPresentAndHashNotEqual sets the value in the cache with a given time to live (TTL) if key is present and the hash of the current value is not equal to the given hash
SetIfPresentAndHashNotEqual(ctx context.Context, r *SetIfPresentAndHashNotEqualRequest) (responses.SetIfPresentAndHashNotEqualResponse, error)
// SetIfPresentAndHashEqual sets the value in the cache with a given time to live (TTL) if key is present and the hash of the current value is equal to the given hash
SetIfPresentAndHashEqual(ctx context.Context, r *SetIfPresentAndHashEqualRequest) (responses.SetIfPresentAndHashEqualResponse, error)
// SetIfAbsentOrHashEqual sets the value in the cache with a given time to live (TTL) if key is present and the hash of the current value is equal to the given hash, or creates the item if it does not exist
SetIfAbsentOrHashEqual(ctx context.Context, r *SetIfAbsentOrHashEqualRequest) (responses.SetIfAbsentOrHashEqualResponse, error)
// SetIfAbsentOrHashNotEqual sets the value in the cache with a given time to live (TTL) if key is present and the hash of the current value is not equal to the given hash, or creates the item if it does not exist
SetIfAbsentOrHashNotEqual(ctx context.Context, r *SetIfAbsentOrHashNotEqualRequest) (responses.SetIfAbsentOrHashNotEqualResponse, error)
// SetWithHash sets the value in the cache with a given time to live (TTL) unconditionally (may overwrite existing value) and returns the hash of the new value
SetWithHash(ctx context.Context, r *SetWithHashRequest) (responses.SetWithHashResponse, error)
// SetBatch sets multiple values in cache with a given time to live (TTL)
SetBatch(ctx context.Context, r *SetBatchRequest) (responses.SetBatchResponse, error)
// Get gets the cache value stored for the given key.
Get(ctx context.Context, r *GetRequest) (responses.GetResponse, error)
// GetWithHash gets the cache value stored for the given key and the hash of the value.
GetWithHash(ctx context.Context, r *GetWithHashRequest) (responses.GetWithHashResponse, error)
// GetBatch gets the cache values stored for the given keys.
GetBatch(ctx context.Context, r *GetBatchRequest) (responses.GetBatchResponse, error)
// Delete removes the key from the cache.
Delete(ctx context.Context, r *DeleteRequest) (responses.DeleteResponse, error)
// KeysExist checks if provided keys exist in the cache.
KeysExist(ctx context.Context, r *KeysExistRequest) (responses.KeysExistResponse, error)
// ItemGetType returns the type of the key in the cache
ItemGetType(ctx context.Context, r *ItemGetTypeRequest) (responses.ItemGetTypeResponse, error)
// ItemGetTtl returns the TTL for a key in the cache
ItemGetTtl(ctx context.Context, r *ItemGetTtlRequest) (responses.ItemGetTtlResponse, error)
// SortedSetFetchByRank fetches the elements in the given sorted set by rank.
SortedSetFetchByRank(ctx context.Context, r *SortedSetFetchByRankRequest) (responses.SortedSetFetchResponse, error)
// SortedSetFetchByScore fetches the elements in the given sorted set by score.
SortedSetFetchByScore(ctx context.Context, r *SortedSetFetchByScoreRequest) (responses.SortedSetFetchResponse, error)
// SortedSetPutElement adds an element to the given sorted set. If the element already exists,
// its score is updated. Creates the sorted set if it does not exist.
SortedSetPutElement(ctx context.Context, r *SortedSetPutElementRequest) (responses.SortedSetPutElementResponse, error)
// SortedSetPutElements adds elements to the given sorted set. If an element already exists,
// its score is updated. Creates the sorted set if it does not exist.
SortedSetPutElements(ctx context.Context, r *SortedSetPutElementsRequest) (responses.SortedSetPutElementsResponse, error)
// SortedSetGetScore looks up the score of an element in the sorted set, by the value of the elements.
SortedSetGetScore(ctx context.Context, r *SortedSetGetScoreRequest) (responses.SortedSetGetScoreResponse, error)
// SortedSetGetScores looks up the scores of multiple elements in the sorted set, by the value of the elements.
SortedSetGetScores(ctx context.Context, r *SortedSetGetScoresRequest) (responses.SortedSetGetScoresResponse, error)
// SortedSetRemoveElement removes an element from the sorted set.
SortedSetRemoveElement(ctx context.Context, r *SortedSetRemoveElementRequest) (responses.SortedSetRemoveElementResponse, error)
// SortedSetRemoveElements removes elements from the sorted set.
SortedSetRemoveElements(ctx context.Context, r *SortedSetRemoveElementsRequest) (responses.SortedSetRemoveElementsResponse, error)
// SortedSetGetRank looks up the rank of an element in the sorted set, by the value of the element.
SortedSetGetRank(ctx context.Context, r *SortedSetGetRankRequest) (responses.SortedSetGetRankResponse, error)
// SortedSetLength gets the number of elements in the sorted set.
SortedSetLength(ctx context.Context, r *SortedSetLengthRequest) (responses.SortedSetLengthResponse, error)
// SortedSetLengthByScore gets the number of elements in the sorted set by an optional score range.
SortedSetLengthByScore(ctx context.Context, r *SortedSetLengthByScoreRequest) (responses.SortedSetLengthByScoreResponse, error)
// SortedSetIncrementScore increments the score of an element in the sorted set.
SortedSetIncrementScore(ctx context.Context, r *SortedSetIncrementScoreRequest) (responses.SortedSetIncrementScoreResponse, error)
// SetAddElement adds an element to the given set. Creates the set if it does not already exist.
SetAddElement(ctx context.Context, r *SetAddElementRequest) (responses.SetAddElementResponse, error)
// SetAddElements adds multiple elements to the given set. Creates the set if it does not already exist.
SetAddElements(ctx context.Context, r *SetAddElementsRequest) (responses.SetAddElementsResponse, error)
// SetFetch fetches the requested set.
SetFetch(ctx context.Context, r *SetFetchRequest) (responses.SetFetchResponse, error)
// SetLength gets the number of elements in the set.
SetLength(ctx context.Context, r *SetLengthRequest) (responses.SetLengthResponse, error)
// SetRemoveElement removes an element from the given set.
SetRemoveElement(ctx context.Context, r *SetRemoveElementRequest) (responses.SetRemoveElementResponse, error)
// SetRemoveElements removes multiple elements from the set.
SetRemoveElements(ctx context.Context, r *SetRemoveElementsRequest) (responses.SetRemoveElementsResponse, error)
// SetContainsElements checks if provided elements are in the given set.
SetContainsElements(ctx context.Context, r *SetContainsElementsRequest) (responses.SetContainsElementsResponse, error)
// SetPop removes and returns a given number of elements from the given set.
SetPop(ctx context.Context, r *SetPopRequest) (responses.SetPopResponse, error)
// ListPushFront adds an element to the front of the given list. Creates the list if it does not already exist.
ListPushFront(ctx context.Context, r *ListPushFrontRequest) (responses.ListPushFrontResponse, error)
// ListPushBack adds an element to the back of the given list. Creates the list if it does not already exist.
ListPushBack(ctx context.Context, r *ListPushBackRequest) (responses.ListPushBackResponse, error)
// ListPopFront gets and removes the first value from the given list.
ListPopFront(ctx context.Context, r *ListPopFrontRequest) (responses.ListPopFrontResponse, error)
// ListPopBack gets and removes the last value from the given list.
ListPopBack(ctx context.Context, r *ListPopBackRequest) (responses.ListPopBackResponse, error)
// ListConcatenateFront adds multiple elements to the front of the given list. Creates the list if it does not already exist.
ListConcatenateFront(ctx context.Context, r *ListConcatenateFrontRequest) (responses.ListConcatenateFrontResponse, error)
// ListConcatenateBack adds multiple elements to the back of the given list. Creates the list if it does not already exist.
ListConcatenateBack(ctx context.Context, r *ListConcatenateBackRequest) (responses.ListConcatenateBackResponse, error)
// ListFetch fetches all elements of the given list.
ListFetch(ctx context.Context, r *ListFetchRequest) (responses.ListFetchResponse, error)
// ListLength gets the number of elements in the given list.
ListLength(ctx context.Context, r *ListLengthRequest) (responses.ListLengthResponse, error)
// ListRemoveValue removes all elements from the given list equal to the given value.
ListRemoveValue(ctx context.Context, r *ListRemoveValueRequest) (responses.ListRemoveValueResponse, error)
// DictionarySetField adds an element to the given dictionary. Creates the dictionary if it does not already exist.
DictionarySetField(ctx context.Context, r *DictionarySetFieldRequest) (responses.DictionarySetFieldResponse, error)
// DictionarySetFields adds multiple elements to the given dictionary. Creates the dictionary if it does not already exist.
// Use momento.DictionaryElementsFromMap to help construct the Request from a map object.
DictionarySetFields(ctx context.Context, r *DictionarySetFieldsRequest) (responses.DictionarySetFieldsResponse, error)
// DictionaryFetch fetches all elements of the given dictionary.
DictionaryFetch(ctx context.Context, r *DictionaryFetchRequest) (responses.DictionaryFetchResponse, error)
// DictionaryLength gets the number of items in the given dictionary.
DictionaryLength(ctx context.Context, r *DictionaryLengthRequest) (responses.DictionaryLengthResponse, error)
// DictionaryGetField gets the value stored for the given dictionary and field.
DictionaryGetField(ctx context.Context, r *DictionaryGetFieldRequest) (responses.DictionaryGetFieldResponse, error)
// DictionaryGetFields gets multiple values from the given dictionary.
DictionaryGetFields(ctx context.Context, r *DictionaryGetFieldsRequest) (responses.DictionaryGetFieldsResponse, error)
// DictionaryIncrement adds an integer quantity to a dictionary value.
// Incrementing the value of a missing field sets the value to amount.
DictionaryIncrement(ctx context.Context, r *DictionaryIncrementRequest) (responses.DictionaryIncrementResponse, error)
// DictionaryRemoveField removes an element from the given dictionary.
// Performs a no-op if the dictionary or field does not exist.
DictionaryRemoveField(ctx context.Context, r *DictionaryRemoveFieldRequest) (responses.DictionaryRemoveFieldResponse, error)
// DictionaryRemoveFields removes multiple fields from the given dictionary.
// Performs a no-op if the dictionary or fields do not exist.
DictionaryRemoveFields(ctx context.Context, r *DictionaryRemoveFieldsRequest) (responses.DictionaryRemoveFieldsResponse, error)
// UpdateTtl overwrites the TTL for key to the provided value.
UpdateTtl(ctx context.Context, r *UpdateTtlRequest) (responses.UpdateTtlResponse, error)
// IncreaseTtl sets the TTL for a key to the provided value only if it would increase the existing TTL.
IncreaseTtl(ctx context.Context, r *IncreaseTtlRequest) (responses.IncreaseTtlResponse, error)
// DecreaseTtl sets the TTL for a key to the provided value only if it would decrease the existing TTL.
DecreaseTtl(ctx context.Context, r *DecreaseTtlRequest) (responses.DecreaseTtlResponse, error)
// Ping pings the cache endpoint to check if the service is up and running.
Ping(ctx context.Context) (responses.PingResponse, error)
Close()
}
func NewCacheClient ¶ added in v0.11.0
func NewCacheClient(configuration config.Configuration, credentialProvider auth.CredentialProvider, defaultTtl time.Duration) (CacheClient, error)
NewCacheClient returns a new CacheClient with provided configuration, credential provider, and default TTL seconds arguments.
func NewCacheClientWithDefaultCache ¶ added in v1.1.0
func NewCacheClientWithDefaultCache(configuration config.Configuration, credentialProvider auth.CredentialProvider, defaultTtl time.Duration, cacheName string) (CacheClient, error)
func NewCacheClientWithEagerConnectTimeout ¶ added in v1.8.0
func NewCacheClientWithEagerConnectTimeout(configuration config.Configuration, credentialProvider auth.CredentialProvider, defaultTtl time.Duration, eagerConnectTimeout time.Duration) (CacheClient, error)
NewCacheClientWithEagerConnectTimeout returns a new CacheClient with provided configuration, credential provider, and default TTL seconds arguments, as well as eagerly attempting to establish gRPC connections. A value of 0 for eagerConnectTimeout indicates no eager connections.
type CacheClientProps ¶ added in v0.11.0
type CacheClientProps struct {
CacheName string
// Configuration to use for logging, transport, retries, and middlewares.
Configuration config.Configuration
// CredentialProvider Momento credential provider.
CredentialProvider auth.CredentialProvider
DefaultTtl time.Duration
EagerConnectTimeout time.Duration
}
func (CacheClientProps) String ¶ added in v1.32.1
func (c CacheClientProps) String() string
type CacheItemKey ¶ added in v1.14.0
type CacheItemKey struct {
Key []byte
}
func (CacheItemKey) IsCacheItemSelector ¶ added in v1.14.0
func (CacheItemKey) IsCacheItemSelector()
type CacheItemKeyPrefix ¶ added in v1.14.0
type CacheItemKeyPrefix struct {
KeyPrefix []byte
}
func (CacheItemKeyPrefix) IsCacheItemSelector ¶ added in v1.14.0
func (CacheItemKeyPrefix) IsCacheItemSelector()
type CacheItemSelector ¶ added in v1.14.0
type CacheItemSelector interface {
IsCacheItemSelector()
}
type CacheName ¶ added in v1.14.0
type CacheName struct {
Name string
}
func (CacheName) IsAllCaches ¶ added in v1.14.0
type CachePermission ¶ added in v1.14.0
type CachePermission struct {
Role CacheRole
Cache CacheSelector
}
func (CachePermission) IsPermission ¶ added in v1.14.0
func (CachePermission) IsPermission()
type CacheSelector ¶ added in v1.14.0
type CreateCacheRequest ¶
type CreateCacheRequest struct {
// string used to create a cache.
CacheName string
}
type CreateStoreRequest ¶ added in v1.23.0
type CreateStoreRequest struct {
// string used to create a store.
StoreName string
}
type DecreaseTtlRequest ¶ added in v0.12.0
type DeleteCacheRequest ¶
type DeleteCacheRequest struct {
// string cache name to delete.
CacheName string
}
type DeleteRequest ¶ added in v0.8.0
type DeleteStoreRequest ¶ added in v1.23.0
type DeleteStoreRequest struct {
// string store name to delete.
StoreName string
}
type DictionaryElement ¶ added in v0.12.0
type DictionaryElement struct {
Field, Value Value
}
Type to hold field/value elements in dictionaries for use with DictionarySetFields. Field and Value are both Value type which allows both Strings and Bytes.
func DictionaryElementsFromMap ¶ added in v0.15.1
func DictionaryElementsFromMap(theMap map[string]string) []DictionaryElement
DictionaryElementsFromMap converts a map[string]string to an array of momento DictionaryElements.
DictionaryElements are used as input to DictionarySetFields.
func DictionaryElementsFromMapStringBytes ¶ added in v0.15.1
func DictionaryElementsFromMapStringBytes(theMap map[string][]byte) []DictionaryElement
DictionaryElementsFromMapStringBytes converts a map[string][]byte to an array of momento DictionaryElements.
DictionaryElements are used as input to DictionarySetFields.
func DictionaryElementsFromMapStringString ¶ added in v0.15.1
func DictionaryElementsFromMapStringString(theMap map[string]string) []DictionaryElement
DictionaryElementsFromMapStringString converts a map[string]string to an array of momento DictionaryElements.
DictionaryElements are used as input to DictionarySetFields.
func DictionaryElementsFromMapStringValue ¶ added in v0.15.1
func DictionaryElementsFromMapStringValue(theMap map[string]Value) []DictionaryElement
DictionaryElementsFromMapStringValue converts a map[string]momento.Value to an array of momento DictionaryElements.
DictionaryElements are used as input to DictionarySetFields.
type DictionaryFetchRequest ¶ added in v0.10.0
type DictionaryGetFieldRequest ¶ added in v0.10.0
type DictionaryGetFieldsRequest ¶ added in v0.10.0
type DictionaryIncrementRequest ¶ added in v0.10.0
type DictionaryLengthRequest ¶ added in v1.7.0
type DictionaryRemoveFieldRequest ¶ added in v0.10.0
type DictionaryRemoveFieldsRequest ¶ added in v0.10.0
type DictionarySetFieldRequest ¶ added in v0.10.0
type DictionarySetFieldsRequest ¶ added in v0.10.0
type DictionarySetFieldsRequest struct {
CacheName string
DictionaryName string
Elements []DictionaryElement
Ttl *utils.CollectionTtl
}
DictionarySetFieldsRequest represents a request to store multiple elements in a Dictionary.
Use momento.DictionaryElementsFromMap to help construct the Request from a map object.
type DisposableTokenCachePermission ¶ added in v1.14.0
type DisposableTokenCachePermission struct {
Role CacheRole
Cache CacheSelector
Item CacheItemSelector
}
func (DisposableTokenCachePermission) IsPermission ¶ added in v1.14.0
func (DisposableTokenCachePermission) IsPermission()
type DisposableTokenCachePermissions ¶ added in v1.14.0
type DisposableTokenCachePermissions struct {
Permissions []DisposableTokenCachePermission
}
func (DisposableTokenCachePermissions) IsDisposableTokenScope ¶ added in v1.14.0
func (DisposableTokenCachePermissions) IsDisposableTokenScope()
type DisposableTokenProps ¶ added in v1.14.0
type DisposableTokenProps struct {
TokenId *string
}
type DisposableTokenScope ¶ added in v1.14.0
type DisposableTokenScope interface {
IsDisposableTokenScope()
}
func CacheKeyPrefixReadOnly ¶ added in v1.14.0
func CacheKeyPrefixReadOnly(selector CacheSelector, keyPrefix Value) DisposableTokenScope
func CacheKeyPrefixReadWrite ¶ added in v1.14.0
func CacheKeyPrefixReadWrite(selector CacheSelector, keyPrefix Value) DisposableTokenScope
func CacheKeyPrefixWriteOnly ¶ added in v1.14.0
func CacheKeyPrefixWriteOnly(selector CacheSelector, keyPrefix Value) DisposableTokenScope
func CacheKeyReadOnly ¶ added in v1.14.0
func CacheKeyReadOnly(selector CacheSelector, key Value) DisposableTokenScope
func CacheKeyReadWrite ¶ added in v1.14.0
func CacheKeyReadWrite(selector CacheSelector, key Value) DisposableTokenScope
func CacheKeyWriteOnly ¶ added in v1.14.0
func CacheKeyWriteOnly(selector CacheSelector, key Value) DisposableTokenScope
func TopicNamePrefixPublishOnly ¶ added in v1.14.0
func TopicNamePrefixPublishOnly(selector CacheSelector, topicNamePrefix string) DisposableTokenScope
func TopicNamePrefixPublishSubscribe ¶ added in v1.14.0
func TopicNamePrefixPublishSubscribe(selector CacheSelector, topicNamePrefix string) DisposableTokenScope
func TopicNamePrefixSubscribeOnly ¶ added in v1.14.0
func TopicNamePrefixSubscribeOnly(selector CacheSelector, topicNamePrefix string) DisposableTokenScope
type GenerateApiKeyRequest ¶ added in v1.25.0
type GenerateApiKeyRequest struct {
ExpiresIn utils.ExpiresIn
Scope PermissionScope
}
type GenerateDisposableTokenRequest ¶ added in v1.14.0
type GenerateDisposableTokenRequest struct {
ExpiresIn utils.ExpiresIn
Scope DisposableTokenScope
Props DisposableTokenProps
}
type GetBatchRequest ¶ added in v1.19.0
type GetRequest ¶ added in v0.8.0
type GetWithHashRequest ¶ added in v1.34.0
type IncreaseTtlRequest ¶ added in v0.12.0
type IncrementRequest ¶ added in v1.4.0
type IncrementRequest struct {
CacheName string
Field Field
Amount int64
Ttl *utils.CollectionTtl
}
type ItemGetTtlRequest ¶ added in v1.4.0
type ItemGetTypeRequest ¶ added in v1.4.0
type KeysExistRequest ¶ added in v0.12.0
type Leaderboard ¶ added in v1.20.0
type Leaderboard interface {
// Delete removes all elements from the leaderboard.
Delete(ctx context.Context) (responses.LeaderboardDeleteResponse, error)
// FetchByRank gets all elements that fall within the specified min and max ranks.
FetchByRank(ctx context.Context, request LeaderboardFetchByRankRequest) (responses.LeaderboardFetchResponse, error)
// FetchByScore gets elements that fall within the specified min and max scores. Elements with the same score
// will be returned in alphanumerical order based on their ID (e.g. IDs of elements with the same score would be
// returned in the order [1, 10, 123, 2, 234, ...] rather than [1, 2, 10, 123, 234, ...]).
FetchByScore(ctx context.Context, request LeaderboardFetchByScoreRequest) (responses.LeaderboardFetchResponse, error)
// GetRank fetches elements (with their rank, score, and ID) given a list of element IDs.
GetRank(ctx context.Context, request LeaderboardGetRankRequest) (responses.LeaderboardFetchResponse, error)
// Length gets the number of entries in the leaderboard.
Length(ctx context.Context) (responses.LeaderboardLengthResponse, error)
// RemoveElements deletes elements with the specified IDs from the leaderboard.
RemoveElements(ctx context.Context, request LeaderboardRemoveElementsRequest) (responses.LeaderboardRemoveElementsResponse, error)
// Upsert inserts elements if they do not already exist in the leaderboard and updates elements if they do
// already exist. There are no partial failures; an upsert call will either succeed or fail.
Upsert(ctx context.Context, request LeaderboardUpsertRequest) (responses.LeaderboardUpsertResponse, error)
}
Leaderboard defines the set of operations that can be performed on a leaderboard object.
type LeaderboardFetchByRankRequest ¶ added in v1.20.0
type LeaderboardFetchByRankRequest struct {
StartRank uint32
EndRank uint32
Order *LeaderboardOrder
}
type LeaderboardFetchByScoreRequest ¶ added in v1.20.0
type LeaderboardFetchByScoreRequest struct {
MinScore *float64
MaxScore *float64
Order *LeaderboardOrder
Offset *uint32
Count *uint32
}
type LeaderboardGetRankRequest ¶ added in v1.20.0
type LeaderboardGetRankRequest struct {
Ids []uint32
Order *LeaderboardOrder
}
type LeaderboardInternalDeleteRequest ¶ added in v1.20.0
type LeaderboardInternalFetchByRankRequest ¶ added in v1.20.0
type LeaderboardInternalFetchByRankRequest struct {
CacheName string
LeaderboardName string
StartRank uint32
EndRank uint32
Order *LeaderboardOrder
}
type LeaderboardInternalFetchByScoreRequest ¶ added in v1.20.0
type LeaderboardInternalGetRankRequest ¶ added in v1.20.0
type LeaderboardInternalGetRankRequest struct {
CacheName string
LeaderboardName string
Ids []uint32
Order *LeaderboardOrder
}
type LeaderboardInternalLengthRequest ¶ added in v1.20.0
type LeaderboardInternalRemoveElementsRequest ¶ added in v1.20.0
type LeaderboardInternalUpsertRequest ¶ added in v1.20.0
type LeaderboardInternalUpsertRequest struct {
CacheName string
LeaderboardName string
Elements []LeaderboardUpsertElement
}
type LeaderboardOrder ¶ added in v1.20.0
type LeaderboardOrder = SortedSetOrder
type LeaderboardRemoveElementsRequest ¶ added in v1.20.0
type LeaderboardRemoveElementsRequest struct {
Ids []uint32
}
type LeaderboardRequest ¶ added in v1.20.0
type LeaderboardUpsertElement ¶ added in v1.20.0
type LeaderboardUpsertRequest ¶ added in v1.20.0
type LeaderboardUpsertRequest struct {
Elements []LeaderboardUpsertElement
}
type ListCachesRequest ¶
type ListCachesRequest struct{}
type ListConcatenateBackRequest ¶ added in v0.8.0
type ListConcatenateFrontRequest ¶ added in v0.8.0
type ListFetchRequest ¶ added in v0.8.0
type ListLengthRequest ¶ added in v0.8.0
type ListPopBackRequest ¶ added in v0.8.0
type ListPopFrontRequest ¶ added in v0.8.0
type ListPushBackRequest ¶ added in v0.8.0
type ListPushFrontRequest ¶ added in v0.8.0
type ListRemoveValueRequest ¶ added in v0.8.0
type ListStoresRequest ¶ added in v1.23.0
type ListStoresRequest struct{}
type MomentoError ¶ added in v0.2.0
type MomentoError interface {
// Satisfy the generic error interface.
error
// Code Returns Momento Error codes.
Code() string
// Message Returns the error details message.
Message() string
// OriginalErr Returns the original error if one was set. Nil is returned if not set.
OriginalErr() error
}
func NewMomentoError ¶ added in v0.2.0
func NewMomentoError(code string, message string, originalErr error) MomentoError
NewMomentoError returns an initialized MomentoError wrapper.
type Permission ¶ added in v1.14.0
type Permission interface {
IsPermission()
}
type PermissionScope ¶ added in v1.14.0
type PermissionScope interface {
IsPermissionScope()
}
type Permissions ¶ added in v1.14.0
type Permissions struct {
Permissions []Permission
}
func CacheReadOnly ¶ added in v1.14.0
func CacheReadOnly(selector CacheSelector) Permissions
func CacheReadWrite ¶ added in v1.14.0
func CacheReadWrite(selector CacheSelector) Permissions
func CacheWriteOnly ¶ added in v1.14.0
func CacheWriteOnly(selector CacheSelector) Permissions
func TopicPublishOnly ¶ added in v1.14.0
func TopicPublishOnly(cacheSelector CacheSelector, topicSelector TopicSelector) Permissions
func TopicPublishSubscribe ¶ added in v1.14.0
func TopicPublishSubscribe(cacheSelector CacheSelector, topicSelector TopicSelector) Permissions
func TopicSubscribeOnly ¶ added in v1.14.0
func TopicSubscribeOnly(cacheSelector CacheSelector, topicSelector TopicSelector) Permissions
func (Permissions) IsDisposableTokenScope ¶ added in v1.14.0
func (Permissions) IsDisposableTokenScope()
func (Permissions) IsPermissionScope ¶ added in v1.14.0
func (Permissions) IsPermissionScope()
type PredefinedScope ¶ added in v1.25.0
type PredefinedScope struct{}
func (PredefinedScope) IsPermissionScope ¶ added in v1.25.0
func (PredefinedScope) IsPermissionScope()
func (PredefinedScope) IsPredefinedScope ¶ added in v1.25.0
func (PredefinedScope) IsPredefinedScope()
type PredefinedScopeInterface ¶ added in v1.25.0
type PredefinedScopeInterface interface {
IsPredefinedScope()
}
type PreviewLeaderboardClient ¶ added in v1.20.0
type PreviewLeaderboardClient interface {
// Leaderboard creates a new leaderboard object in a given cache with the provided leaderboard name.
Leaderboard(ctx context.Context, request *LeaderboardRequest) (Leaderboard, error)
// Close will shut down the leaderboard client and related resources.
Close()
}
func NewPreviewLeaderboardClient ¶ added in v1.20.0
func NewPreviewLeaderboardClient(leaderboardConfiguration config.LeaderboardConfiguration, credentialProvider auth.CredentialProvider) (PreviewLeaderboardClient, error)
NewPreviewLeaderboardClient creates a new instance of a Preview Leaderboard Client.
type PreviewStorageClient ¶ added in v1.23.0
type PreviewStorageClient interface {
Logger() logger.MomentoLogger
// CreateStore creates a new store if it does not exist.
CreateStore(ctx context.Context, request *CreateStoreRequest) (responses.CreateStoreResponse, error)
// DeleteStore deletes a store and all the items within it.
DeleteStore(ctx context.Context, request *DeleteStoreRequest) (responses.DeleteStoreResponse, error)
// ListStores lists all the stores.
ListStores(ctx context.Context, request *ListStoresRequest) (responses.ListStoresResponse, error)
// Get retrieves a value from a store.
Get(ctx context.Context, request *StorageGetRequest) (responses.StorageGetResponse, error)
// Put sets a value in a store.
Put(ctx context.Context, request *StoragePutRequest) (responses.StoragePutResponse, error)
// Delete removes a value from a store.
Delete(ctx context.Context, request *StorageDeleteRequest) (responses.StorageDeleteResponse, error)
// Close closes the client.
Close()
}
PreviewStorageClient PREVIEW Momento Storage Client
WARNING: the API for this client is not yet stable and may change without notice. Please contact Momento if you would like to try this preview.
func NewPreviewStorageClient ¶ added in v1.23.0
func NewPreviewStorageClient(storageConfiguration config.StorageConfiguration, credentialProvider auth.CredentialProvider) (PreviewStorageClient, error)
NewPreviewStorageClient creates a new PreviewStorageClient with the provided configuration and credential provider.
WARNING: the API for this client is not yet stable and may change without notice. Please contact Momento if you would like to try this preview.
type RefreshApiKeyRequest ¶ added in v1.26.0
type RefreshApiKeyRequest struct {
RefreshToken string
}
type SetAddElementRequest ¶ added in v0.10.0
type SetAddElementRequest struct {
CacheName string
SetName string
Element Value
Ttl *utils.CollectionTtl
}
type SetAddElementsRequest ¶ added in v0.10.0
type SetAddElementsRequest struct {
CacheName string
SetName string
Elements []Value
Ttl *utils.CollectionTtl
}
type SetBatchRequest ¶ added in v1.19.0
type SetBatchRequest struct {
CacheName string
Items []BatchSetItem
Ttl time.Duration
// contains filtered or unexported fields
}
type SetContainsElementsRequest ¶ added in v0.12.0
type SetFetchRequest ¶ added in v0.10.0
type SetIfAbsentOrEqualRequest ¶ added in v1.17.0
type SetIfAbsentOrEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
Equal Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfAbsentOrHashEqualRequest ¶ added in v1.34.0
type SetIfAbsentOrHashEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
HashEqual Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfAbsentOrHashNotEqualRequest ¶ added in v1.34.0
type SetIfAbsentOrHashNotEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
HashNotEqual Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfAbsentRequest ¶ added in v1.17.0
type SetIfAbsentRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfEqualRequest ¶ added in v1.17.0
type SetIfEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
Equal Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfNotEqualRequest ¶ added in v1.17.0
type SetIfNotEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
NotEqual Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfNotExistsRequest ¶ added in v1.7.0
type SetIfNotExistsRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfPresentAndHashEqualRequest ¶ added in v1.34.0
type SetIfPresentAndHashEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
HashEqual Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfPresentAndHashNotEqualRequest ¶ added in v1.34.0
type SetIfPresentAndHashNotEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
HashNotEqual Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfPresentAndNotEqualRequest ¶ added in v1.17.0
type SetIfPresentAndNotEqualRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// string or byte value to compare with the existing value in the cache.
NotEqual Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetIfPresentRequest ¶ added in v1.17.0
type SetIfPresentRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetLengthRequest ¶ added in v1.7.0
type SetPopRequest ¶ added in v1.12.0
type SetRemoveElementRequest ¶ added in v0.10.0
type SetRemoveElementsRequest ¶ added in v0.10.0
type SetRequest ¶ added in v0.8.0
type SetRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SetWithHashRequest ¶ added in v1.34.0
type SetWithHashRequest struct {
// Name of the cache to store the item in.
CacheName string
// string or byte key to be used to store item.
Key Key
// string ot byte value to be stored.
Value Value
// Optional Time to live in cache in seconds.
// If not provided, then default TTL for the cache client instance is used.
Ttl time.Duration
}
type SortedSetElement ¶ added in v0.8.0
func SortedSetElementsFromMap ¶ added in v0.15.1
func SortedSetElementsFromMap(theMap map[string]float64) []SortedSetElement
SortedSetElementsFromMap converts a map[string]float64 to an array of momento SortedSetElements.
SortedSetElements are used as input to SortedSetPutElements.
type SortedSetFetchByRankRequest ¶ added in v0.16.0
type SortedSetFetchByRankRequest struct {
CacheName string
SetName string
Order SortedSetOrder
StartRank *int32
EndRank *int32
}
type SortedSetFetchByScoreRequest ¶ added in v0.16.0
type SortedSetGetRankRequest ¶ added in v0.8.0
type SortedSetGetRankRequest struct {
CacheName string
SetName string
Value Value
Order SortedSetOrder
}
type SortedSetGetScoreRequest ¶ added in v0.8.0
type SortedSetGetScoresRequest ¶ added in v0.11.0
type SortedSetIncrementScoreRequest ¶ added in v0.9.0
type SortedSetLengthByScoreRequest ¶ added in v1.7.0
type SortedSetLengthRequest ¶ added in v1.7.0
type SortedSetOrder ¶ added in v0.8.0
type SortedSetOrder int
const ( ASCENDING SortedSetOrder = 0 DESCENDING SortedSetOrder = 1 )
type SortedSetPutElementRequest ¶ added in v0.15.0
type SortedSetPutElementsRequest ¶ added in v0.14.0
type SortedSetPutElementsRequest struct {
CacheName string
SetName string
Elements []SortedSetElement
Ttl *utils.CollectionTtl
}
type SortedSetRemoveElementRequest ¶ added in v0.15.0
type SortedSetRemoveElementsRequest ¶ added in v0.14.0
type StorageDeleteRequest ¶ added in v1.23.0
type StorageGetRequest ¶ added in v1.23.0
type StoragePutRequest ¶ added in v1.23.0
type StoragePutRequest struct {
// StoreName is the name of the store to put the value in.
StoreName string
// Key is the key to put the value for.
Key string
// Value is the `Value` value to put in the store.
Value storageTypes.Value
}
type String ¶ added in v0.9.0
type String string
String string type that will be converted to []byte
type TopicClient ¶ added in v0.11.0
type TopicClient interface {
Subscribe(ctx context.Context, request *TopicSubscribeRequest) (TopicSubscription, error)
Publish(ctx context.Context, request *TopicPublishRequest) (responses.TopicPublishResponse, error)
Close()
}
func NewTopicClient ¶ added in v0.11.0
func NewTopicClient(topicsConfiguration config.TopicsConfiguration, credentialProvider auth.CredentialProvider) (TopicClient, error)
NewTopicClient returns a new TopicClient with provided configuration and credential provider arguments.
type TopicDiscontinuity ¶ added in v1.27.0
type TopicDiscontinuity struct {
// contains filtered or unexported fields
}
func NewTopicDiscontinuity ¶ added in v1.27.0
func NewTopicDiscontinuity(lastKnownSequenceNumber uint64, newSequenceNumber uint64, newSequencePage uint64) TopicDiscontinuity
func (TopicDiscontinuity) GetLastKnownSequenceNumber ¶ added in v1.27.0
func (d TopicDiscontinuity) GetLastKnownSequenceNumber() uint64
func (TopicDiscontinuity) GetNewSequenceNumber ¶ added in v1.27.0
func (d TopicDiscontinuity) GetNewSequenceNumber() uint64
func (TopicDiscontinuity) GetNewSequencePage ¶ added in v1.29.0
func (d TopicDiscontinuity) GetNewSequencePage() uint64
type TopicEvent ¶ added in v1.27.0
type TopicEvent interface {
// contains filtered or unexported methods
}
TopicEvent is an interface that represents all possible events that can be received from a topic subscription. This includes messages, heartbeats, and discontinuities.
type TopicHeartbeat ¶ added in v1.27.0
type TopicHeartbeat struct{}
type TopicItem ¶ added in v1.27.0
type TopicItem struct {
// contains filtered or unexported fields
}
func NewTopicItem ¶ added in v1.27.0
func NewTopicItem(message TopicValue, publisherId String, topicSequenceNumber uint64, topicSequencePage uint64) TopicItem
func (TopicItem) GetPublisherId ¶ added in v1.27.0
func (TopicItem) GetTopicSequenceNumber ¶ added in v1.27.0
func (TopicItem) GetTopicSequencePage ¶ added in v1.29.0
func (TopicItem) GetValue ¶ added in v1.27.0
func (m TopicItem) GetValue() TopicValue
type TopicName ¶ added in v1.14.0
type TopicName struct {
Name string
}
func (TopicName) IsAllTopics ¶ added in v1.14.0
type TopicNamePrefix ¶ added in v1.14.0
type TopicNamePrefix struct {
NamePrefix string
}
func (TopicNamePrefix) IsAllTopics ¶ added in v1.14.0
func (TopicNamePrefix) IsAllTopics() bool
func (TopicNamePrefix) TopicName ¶ added in v1.14.0
func (t TopicNamePrefix) TopicName() string
type TopicPermission ¶ added in v1.14.0
type TopicPermission struct {
Role TopicRole
Cache CacheSelector
Topic TopicSelector
}
func (TopicPermission) IsPermission ¶ added in v1.14.0
func (TopicPermission) IsPermission()
type TopicPublishRequest ¶ added in v0.8.0
type TopicPublishRequest struct {
CacheName string
TopicName string
Value TopicValue
}
type TopicSelector ¶ added in v1.14.0
type TopicSubscribeRequest ¶ added in v0.8.0
type TopicSubscription ¶ added in v0.8.0
type TopicSubscription interface {
// Item returns only subscription events that contain a string or byte message.
// Example:
//
// item, err := sub.Item(ctx)
// if err != nil {
// panic(err)
// }
// switch msg := item.(type) {
// case momento.String:
// fmt.Printf("received message as string: '%v'\n", msg)
// case momento.Bytes:
// fmt.Printf("received message as bytes: '%v'\n", msg)
// }
Item(ctx context.Context) (TopicValue, error)
// Event returns all possible topics subscription events, such as messages,
// discontinuities, and heartbeats.
//
// Example:
//
// event, err := sub.Event(ctx)
// if err != nil {
// panic(err)
// }
//
// switch e := event.(type) {
// case momento.TopicItem:
// fmt.Printf("received item with sequence number %d\n", e.GetTopicSequenceNumber())
// fmt.Printf("received item with publisher Id %s\n", e.GetPublisherId())
// switch msg := e.GetValue().(type) {
// case momento.String:
// fmt.Printf("received message as string: '%v'\n", msg)
// case momento.Bytes:
// fmt.Printf("received message as bytes: '%v'\n", msg)
// }
// case momento.TopicHeartbeat:
// fmt.Printf("received heartbeat\n")
// case momento.TopicDiscontinuity:
// fmt.Printf("received discontinuity\n")
// }
Event(ctx context.Context) (TopicEvent, error)
// Close closes the subscription stream.
Close()
}
type TopicValue ¶ added in v0.8.0
type TopicValue interface {
// contains filtered or unexported methods
}
TopicValue For now, topics take the same types as normal methods. In the future this might not be so, topics might take different types than methods.
The TopicValue interface alias future proofs us. Topics still take the normal String and Bytes, but in the future we can add types that other methods might not take.
type UpdateTtlRequest ¶ added in v0.12.0
Source Files
¶
- auth_client.go
- cache_client.go
- create_cache.go
- create_store.go
- decrease_ttl.go
- delete.go
- delete_cache.go
- delete_store.go
- dictionary_fetch.go
- dictionary_get_field.go
- dictionary_get_fields.go
- dictionary_increment.go
- dictionary_length.go
- dictionary_remove_field.go
- dictionary_remove_fields.go
- dictionary_set_field.go
- dictionary_set_fields.go
- disposable_token_scope.go
- disposable_token_scopes.go
- error.go
- generate_api_key.go
- generate_disposable_token.go
- get.go
- get_batch.go
- get_with_hash.go
- increase_ttl.go
- increment.go
- internal_auth_client.go
- item_get_ttl.go
- item_get_type.go
- keys_exist.go
- leaderboard.go
- leaderboard_client.go
- leaderboard_data_client.go
- leaderboard_delete.go
- leaderboard_fetch_by_rank.go
- leaderboard_fetch_by_score.go
- leaderboard_get_rank.go
- leaderboard_length.go
- leaderboard_remove_elements.go
- leaderboard_request.go
- leaderboard_upsert.go
- list_caches.go
- list_concatenate_back.go
- list_concatenate_front.go
- list_fetch.go
- list_length.go
- list_pop_back.go
- list_pop_front.go
- list_push_back.go
- list_push_front.go
- list_remove_value.go
- list_stores.go
- permission_scope.go
- permissions_scopes.go
- pubsub_client.go
- refresh_api_key.go
- requester.go
- scs_data_client.go
- set.go
- set_add_element.go
- set_add_elements.go
- set_batch.go
- set_contains_elements.go
- set_fetch.go
- set_if_absent.go
- set_if_absent_or_equal.go
- set_if_absent_or_hash_equal.go
- set_if_absent_or_hash_not_equal.go
- set_if_equal.go
- set_if_not_equal.go
- set_if_not_exists.go
- set_if_present.go
- set_if_present_and_hash_equal.go
- set_if_present_and_hash_not_equal.go
- set_if_present_and_not_equal.go
- set_length.go
- set_pop.go
- set_remove_element.go
- set_remove_elements.go
- set_with_hash.go
- sorted_set_fetch_by_rank.go
- sorted_set_fetch_by_score.go
- sorted_set_get_rank.go
- sorted_set_get_score.go
- sorted_set_get_scores.go
- sorted_set_increment_score.go
- sorted_set_length.go
- sorted_set_length_by_score.go
- sorted_set_put_element.go
- sorted_set_put_elements.go
- sorted_set_remove_element.go
- sorted_set_remove_elements.go
- storage_client.go
- storage_data_client.go
- storage_delete.go
- storage_get.go
- storage_put.go
- token_client.go
- topic_client.go
- topic_event.go
- topic_publish.go
- topic_subscribe.go
- topic_subscription.go
- topic_value.go
- update_ttl.go
- value.go