redis

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvRedisAddr           = "REDIS_ADDR"
	EnvRedisUsername       = "REDIS_USERNAME"
	EnvRedisPassword       = "REDIS_PASSWORD"
	DefaultIntervalSeconds = 5
	DefaultTimeoutSeconds  = 5
)
View Source
const (
	AccountKeySpace = "octi:accounts"
	ShareKeySpace   = "octi:accounts:share"
)
View Source
const DeviceKeySpace = "octi:devices"

Variables

This section is empty.

Functions

func NewClientWithRegularPing

func NewClientWithRegularPing(ctx context.Context, config *config.Config) (*redis.Client, error)

func VerifyConnection

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

Types

type Account

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

func AccountFromUsername

func AccountFromUsername(username, hashedPass string) *Account

func (*Account) HashedPass

func (r *Account) HashedPass() string

func (*Account) Username

func (r *Account) Username() string

type Accounts

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

func NewAccounts

func NewAccounts(client *redis.Client) *Accounts

func (*Accounts) ActiveShares

func (r *Accounts) ActiveShares(ctx context.Context, username string) ([]string, 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) IsShared

func (r *Accounts) IsShared(ctx context.Context, username string, share string) (bool, error)

func (*Accounts) Register

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

func (*Accounts) Revoke

func (r *Accounts) Revoke(ctx context.Context, username string, shareCode string) error

func (*Accounts) Share

func (r *Accounts) Share(ctx context.Context, username string) (string, error)

type Device

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

func DeviceFromID

func DeviceFromID(deviceID string) *Device

func (*Device) ID

func (r *Device) ID() string

type Devices

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

func NewDevices

func NewDevices(client *redis.Client) *Devices

func (*Devices) FindByAccount

func (r *Devices) FindByAccount(ctx context.Context, acc service.Account) ([]service.Device, error)

func (*Devices) FindByDeviceID

func (r *Devices) FindByDeviceID(ctx context.Context, acc service.Account, deviceID string) (service.Device, error)

func (*Devices) HealthCheck

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

func (*Devices) Register

func (r *Devices) Register(ctx context.Context, acc service.Account, deviceID string) (service.Device, error)

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 {
	// contains filtered or unexported fields
}

func NewModules

func NewModules(client *redis.Client) *Modules

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

Jump to

Keyboard shortcuts

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