redis

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: LGPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// NonceSlidingWindowSize is the maximum distance a new nonce can be from the max nonce before it is rejected
	// outright.
	NonceSlidingWindowSize = 1000
)

Variables

View Source
var (
	ErrNoSchemaFound = errors.New("no schema found")
)
View Source
var ErrNonceHasAlreadyBeenUsed = errors.New("nonce has already been used")

Functions

This section is empty.

Types

type NonceStorage

type NonceStorage struct {
	Client *redis.Client
	// contains filtered or unexported fields
}

func NewNonceStorage

func NewNonceStorage(client *redis.Client) NonceStorage

func (*NonceStorage) UseNonce

func (r *NonceStorage) UseNonce(signerAddress string, nonce uint64) error

UseNonce atomically marks the given nonce as used. The nonce is valid if nil is returned. A non-nil error means there was an error verifying the nonce, or the nonce was already used.

type Options

type Options = redis.Options

type SchemaStorage

type SchemaStorage struct {
	Client *redis.Client
}

func NewSchemaStorage

func NewSchemaStorage(client *redis.Client) SchemaStorage

func (*SchemaStorage) GetSchema

func (r *SchemaStorage) GetSchema(componentName string) ([]byte, error)

func (*SchemaStorage) SetSchema

func (r *SchemaStorage) SetSchema(componentName string, schemaData []byte) error

type Storage

type Storage struct {
	Namespace string
	Client    *redis.Client
	Log       zerolog.Logger
	NonceStorage
	SchemaStorage
}

func NewRedisStorage

func NewRedisStorage(options Options, namespace string) Storage

func (*Storage) Close

func (r *Storage) Close() error

Jump to

Keyboard shortcuts

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