redis

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccountKeySpace = "octi:accounts"
	ShareKeySpace   = "octi:accounts:share"
)
View Source
const (
	EnvRedisAddr           = "REDIS_ADDR"
	EnvRedisUsername       = "REDIS_USERNAME"
	EnvRedisPassword       = "REDIS_PASSWORD"
	DefaultIntervalSeconds = 5
	DefaultTimeoutSeconds  = 5
	NoExpiry               = time.Duration(-1)
)
View Source
const DeviceKeySpace = "octi:devices"
View Source
const MetadataKeySpace = "octi:metadata"

Variables

This section is empty.

Functions

func StartPingingRedis added in v0.1.1

func StartPingingRedis(
	ctx context.Context,
	interval time.Duration,
	client redis.Cmdable,
	logger *zerolog.Logger,
)

func VerifyConnection

func VerifyConnection(ctx context.Context, client redis.Cmdable, timeout time.Duration) error

Types

type Accounts

type Accounts struct {
	Client redis.Cmdable
}

func (*Accounts) Create added in v0.2.1

func (r *Accounts) Create(ctx context.Context, username string) (service.Account, error)

func (*Accounts) Find

func (r *Accounts) Find(ctx context.Context, username string) (service.Account, error)

func (*Accounts) HealthCheck

func (r *Accounts) HealthCheck() service.HealthCheck

func (*Accounts) Revoke

func (r *Accounts) Revoke(ctx context.Context, shareCode service.ShareCode) error

func (*Accounts) Share

func (r *Accounts) Share(ctx context.Context, account service.Account) (service.ShareCode, error)

func (*Accounts) Shared added in v0.2.4

func (r *Accounts) Shared(ctx context.Context, shareCode service.ShareCode) (service.Account, error)

type ClientMutator added in v0.1.1

type ClientMutator func(client goredis.UniversalClient) goredis.UniversalClient

type ClientMutators added in v0.1.1

type ClientMutators map[string]ClientMutator

type ClientProvider added in v0.2.0

type ClientProvider func(config *config.Config) goredis.UniversalClient

type Clients added in v0.1.1

type Clients map[string]goredis.Cmdable

func NewClientsWithRegularPing added in v0.1.1

func NewClientsWithRegularPing(
	ctx context.Context,
	config *config.Config,
	provider ClientProvider,
	mutators ClientMutators,
) (Clients, error)

type Devices

type Devices struct {
	Client redis.Cmdable
}

func (*Devices) AddDevice added in v0.2.1

func (r *Devices) AddDevice(
	ctx context.Context, account service.Account, id service.DeviceID, password string,
) (service.Device, error)

func (*Devices) DeleteDevice added in v0.2.1

func (r *Devices) DeleteDevice(
	ctx context.Context,
	account service.Account,
	id service.DeviceID,
) error

func (*Devices) GetDevice added in v0.2.1

func (r *Devices) GetDevice(ctx context.Context, account service.Account, id service.DeviceID) (service.Device, error)

func (*Devices) GetDevices added in v0.2.1

func (r *Devices) GetDevices(
	ctx context.Context,
	account service.Account,
) (map[service.DeviceID]service.Device, error)

func (*Devices) HealthCheck

func (r *Devices) HealthCheck() service.HealthCheck

type MetadataProvider added in v0.4.0

type MetadataProvider struct {
	Client redis.Cmdable
}

func (*MetadataProvider) Get added in v0.4.0

func (*MetadataProvider) HealthCheck added in v0.4.0

func (r *MetadataProvider) HealthCheck() service.HealthCheck

func (*MetadataProvider) Set added in v0.4.0

type Module

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

func ModuleFromBytes

func ModuleFromBytes(data []byte) *Module

func ModuleFromReader

func ModuleFromReader(data io.Reader, size int) *Module

func (Module) Raw

func (r Module) Raw() io.Reader

func (Module) Size

func (r Module) Size() int

type Modules

type Modules struct {
	Client     redis.Cmdable
	Expiration time.Duration
}

func (*Modules) Delete added in v0.4.0

func (r *Modules) Delete(ctx context.Context, key string) error

func (*Modules) DeleteByPattern added in v0.4.0

func (r *Modules) DeleteByPattern(ctx context.Context, pattern string) error

func (*Modules) Get

func (r *Modules) Get(ctx context.Context, name string) (service.Module, error)

func (*Modules) HealthCheck

func (r *Modules) HealthCheck() service.HealthCheck

func (*Modules) Set

func (r *Modules) Set(ctx context.Context, name string, module service.Module) error

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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