redis

package
v0.11.0-dev.7 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMemoryLimitExceed = errors.New("redis: memory limit exceeded")

Functions

This section is empty.

Types

type Config

type Config struct {
	// MemoryLimit specifies a maximum memory limit for a single Oracle.
	MemoryLimit int64
	// TTL specifies how long messages should be kept in storage.
	TTL time.Duration
	// Address specifies Redis server address as "host:port".
	Address string
	// Username specifies Redis username for the ACL.
	Username string
	// Password specifies Redis server password.
	Password string
	// DB is the Redis database number.
	DB int
	// TLS specifies whether to use TLS for Redis connection.
	TLS bool
	// TLSServerName specifies the server name used to verify
	// the hostname on the returned certificates from the server.
	TLSServerName string
	// TLSCertFile specifies the path to the client certificate file.
	TLSCertFile string
	// TLSKeyFile specifies the path to the client key file.
	TLSKeyFile string
	// TLSRootCAFile specifies the path to the CA certificate file.
	TLSRootCAFile string
	// TLSInsecureSkipVerify specifies whether to skip server certificate verification.
	TLSInsecureSkipVerify bool
	// Cluster specifies whether the Redis server is a cluster.
	Cluster bool
	// ClusterAddrs specifies the Redis cluster addresses as "host:port".
	ClusterAddrs []string
}

Config is the configuration for the Storage.

type Storage added in v0.6.0

type Storage struct {
	// contains filtered or unexported fields
}

Storage provides storage mechanism for store.EventStore. It uses a Redis database to store events.

func New

func New(cfg Config) (*Storage, error)

New returns a new instance of Redis.

func (*Storage) Add added in v0.6.0

func (r *Storage) Add(ctx context.Context, author []byte, evt *messages.Event) (bool, error)

Add implements the store.Storage interface.

func (*Storage) Get added in v0.6.0

func (r *Storage) Get(ctx context.Context, typ string, idx []byte) ([]*messages.Event, error)

Get implements the store.Storage interface.

func (*Storage) Ping added in v0.7.1

func (r *Storage) Ping(ctx context.Context) error

Ping checks if the Redis server is available.

Jump to

Keyboard shortcuts

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