storage

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: MPL-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KeyPrefix               string = "analytics-"
	ANALYTICS_KEYNAME       string = "tyk-system-analytics"
	UptimeAnalytics_KEYNAME string = "tyk-uptime-analytics"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticsStorage

type AnalyticsStorage interface {
	Init() error
	GetName() string
	GetAndDeleteSet(setName string, chunkSize int64, expire time.Duration) ([]interface{}, error)
}

type EnvMapString

type EnvMapString map[string]string

func (*EnvMapString) Decode

func (e *EnvMapString) Decode(value string) error

type IAMAuthConfig added in v1.17.0

type IAMAuthConfig struct {
	// Provider selects the cloud IAM provider. Currently supported: "gcp"
	// (GCP Memorystore for Valkey and Redis Cluster).
	Provider string `json:"provider" mapstructure:"provider"`
	// ServiceAccount, for GCP, optionally impersonates this service account to
	// mint tokens instead of using the ambient Application Default Credentials
	// identity. Leave empty to use the workload's own identity (Workload Identity
	// on GKE, or GOOGLE_APPLICATION_CREDENTIALS).
	ServiceAccount string `json:"service_account" mapstructure:"service_account"`
	// The access token issued by the IAM will be refreshed before expiry.
	// Set the time period before expiry when that refresh will take place as
	// a human readable duration (for example "2m30s", "5m").
	// Defaults to "5m" (five minutes) when empty.
	TokenRefreshBeforeExpiry string `json:"token_refresh_before_expiry" mapstructure:"token_refresh_before_expiry"`
	// Set to true to use IAM-based authentication for this storage connection.
	Enabled bool `json:"enabled" mapstructure:"enabled"`
}

Configure the cloud provider's Identity and Access Management (IAM) authentication for temporal storage (Redis/Valkey). If enabled, the standard username and password are ignored.

type TemporalStorageConfig added in v1.9.0

type TemporalStorageConfig struct {
	// Deprecated.
	Type string `json:"type" mapstructure:"type"`
	// Host value. For example: "localhost".
	Host string `json:"host" mapstructure:"host"`
	// Port value. For example: 6379.
	Port int `json:"port" mapstructure:"port"`
	// Deprecated: use Addrs instead.
	Hosts EnvMapString `json:"hosts" mapstructure:"hosts"`
	// Use instead of the host value if you're running a Redis cluster with multiple instances.
	Addrs []string `json:"addrs" mapstructure:"addrs"`
	// Sentinel master name.
	MasterName string `json:"master_name" mapstructure:"master_name"`
	// Sentinel password.
	SentinelPassword string `json:"sentinel_password" mapstructure:"sentinel_password"`
	// Database username.
	Username string `json:"username" mapstructure:"username"`
	// Database password.
	Password string `json:"password" mapstructure:"password"`
	// Database name.
	Database int `json:"database" mapstructure:"database"`
	// How long to allow for new connections to be established (in milliseconds). Defaults to 5sec.
	Timeout int `json:"timeout" mapstructure:"timeout"`
	// Maximum number of idle connections in the pool.
	MaxIdle int `json:"optimisation_max_idle" mapstructure:"optimisation_max_idle"`
	// Maximum number of connections allocated by the pool at a given time. When zero, there is no
	// limit on the number of connections in the pool. Defaults to 500.
	MaxActive int `json:"optimisation_max_active" mapstructure:"optimisation_max_active"`
	// Enable this option if you are using a cluster instance. Default is `false`.
	EnableCluster bool `json:"enable_cluster" mapstructure:"enable_cluster"`

	// Prefix the key names. Defaults to "analytics-".
	// Deprecated: use KeyPrefix instead.
	RedisKeyPrefix string `json:"redis_key_prefix" mapstructure:"redis_key_prefix"`
	// Prefix the key names. Defaults to "analytics-".
	KeyPrefix string `json:"key_prefix" mapstructure:"key_prefix"`

	// Setting this to true to use SSL when connecting to the DB.
	UseSSL bool `json:"use_ssl" mapstructure:"use_ssl"`
	// Set this to `true` to tell Pump to ignore database's cert validation.
	SSLInsecureSkipVerify bool `json:"ssl_insecure_skip_verify" mapstructure:"ssl_insecure_skip_verify"`
	// Path to the CA file.
	SSLCAFile string `json:"ssl_ca_file" mapstructure:"ssl_ca_file"`
	// Path to the cert file.
	SSLCertFile string `json:"ssl_cert_file" mapstructure:"ssl_cert_file"`
	// Path to the key file.
	SSLKeyFile string `json:"ssl_key_file" mapstructure:"ssl_key_file"`
	// Maximum supported TLS version. Defaults to TLS 1.3, valid values are TLS 1.0, 1.1, 1.2, 1.3.
	SSLMaxVersion string `json:"ssl_max_version" mapstructure:"ssl_max_version"`
	// Minimum supported TLS version. Defaults to TLS 1.2, valid values are TLS 1.0, 1.1, 1.2, 1.3.
	SSLMinVersion string `json:"ssl_min_version" mapstructure:"ssl_min_version"`
	// Setting this to true to use SSL when connecting to the DB.
	// Deprecated: use UseSSL instead.
	RedisUseSSL bool `json:"redis_use_ssl" mapstructure:"redis_use_ssl"`
	// Set this to `true` to tell Pump to ignore database's cert validation.
	// Deprecated: use SSLInsecureSkipVerify instead.
	RedisSSLInsecureSkipVerify bool `json:"redis_ssl_insecure_skip_verify" mapstructure:"redis_ssl_insecure_skip_verify"`

	// Configure the cloud provider's Identity and Access Management (IAM)
	// authentication solution for temporal storage (for example, GCP MemoryStore IAM)
	// instead of the traditional fixed username and password.
	IAMAuth IAMAuthConfig `json:"iam_auth" mapstructure:"iam_auth"`
}

nolint:govet

type TemporalStorageHandler added in v1.9.0

type TemporalStorageHandler struct {
	Config *TemporalStorageConfig
	// contains filtered or unexported fields
}

TemporalStorageHandler is a storage manager that uses non data-persistent databases, like Redis.

func NewTemporalStorageHandler added in v1.9.0

func NewTemporalStorageHandler(config interface{}, forceReconnect bool) (*TemporalStorageHandler, error)

func (*TemporalStorageHandler) GetAndDeleteSet added in v1.9.0

func (r *TemporalStorageHandler) GetAndDeleteSet(keyName string, chunkSize int64, expire time.Duration) ([]interface{}, error)

func (*TemporalStorageHandler) GetName added in v1.9.0

func (r *TemporalStorageHandler) GetName() string

func (*TemporalStorageHandler) Init added in v1.9.0

func (r *TemporalStorageHandler) Init() error

func (*TemporalStorageHandler) SetKey added in v1.9.0

func (r *TemporalStorageHandler) SetKey(keyName, session string, timeout int64) error

SetKey will create (or update) a key value in the store

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL