kvstorage

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNil = errors.New("nil response")

ErrNil in case of empty response

Functions

This section is empty.

Types

type ClusterInfoReader

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

ClusterInfoReader overrides group node accessing

func NewClusterInfoReader

func NewClusterInfoReader(kvclient KeyValueAccessor, appName ...string) *ClusterInfoReader

NewClusterInfoReader interface implementation

func (*ClusterInfoReader) ApplicationInfo

func (s *ClusterInfoReader) ApplicationInfo() (*monitor.ApplicationInfo, error)

ApplicationInfo returns application information

func (*ClusterInfoReader) ListOfNodes

func (s *ClusterInfoReader) ListOfNodes() (map[string][]string, int, error)

ListOfNodes returns list of registered nodes

func (*ClusterInfoReader) ListStorages

func (s *ClusterInfoReader) ListStorages() ([]*Storage, error)

ListStorages returns the list of redis storages

func (*ClusterInfoReader) ResetCache

func (s *ClusterInfoReader) ResetCache()

ResetCache of the nodes

func (*ClusterInfoReader) String added in v0.4.5

func (s *ClusterInfoReader) String() string

func (*ClusterInfoReader) TaskInfo

func (s *ClusterInfoReader) TaskInfo(name string) (*monitor.TaskInfo, error)

TaskInfo retuns information about the task

func (*ClusterInfoReader) TaskInfoByID

func (s *ClusterInfoReader) TaskInfoByID(id string) (*monitor.TaskInfo, error)

TaskInfoByID retuns information about the particular task

type KeyValueAccessor

type KeyValueAccessor interface {
	KeyValueBasic

	// Begin new transaction
	Begin() (KeyValueTxAccessor, error)
}

KeyValueAccessor defines the accessor with transaction

type KeyValueBasic

type KeyValueBasic interface {
	// Keys returns the list of keys with pattern "text"+*
	Keys(pattern string) ([]string, error)

	// Get value from key
	Get(key string) (interface{}, error)

	// MGet returns values from banch of keys in the same order
	MGet(keys ...string) ([]interface{}, error)

	// Incr value with key
	Incr(key string) (int64, error)

	// Set value for the key
	Set(key string, value interface{}, expiration ...time.Duration) error

	// MSet multiple set operation with {Key, Value, ...} input
	MSet(vals ...interface{}) error

	// Del keys from the storage
	Del(key ...string) error
}

KeyValueBasic provides basic data accessors

type KeyValueTxAccessor

type KeyValueTxAccessor interface {
	KeyValueBasic

	// Commit transaction changes
	Commit() error
}

KeyValueTxAccessor defines accessor which will apply changes only after commiting

type Option

type Option func(opt *Options)

Option type definition

func WithKVClient

func WithKVClient(client KeyValueAccessor) Option

WithKVClient returns option modifier with KV client

func WithTaskDetailInfo

func WithTaskDetailInfo(lifetime time.Duration) Option

WithTaskDetailInfo returns option modifier with detail task info

type Options

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

Options of the storage

type Storage

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

Storage monitor implementation for redis

func New

func New(opts ...Option) (*Storage, error)

New storage connector

func (*Storage) ApplicationInfo

func (s *Storage) ApplicationInfo() *monitor.ApplicationInfo

ApplicationInfo returns application information

func (*Storage) DeregisterApplication

func (s *Storage) DeregisterApplication() error

DeregisterApplication info in the storage

func (*Storage) ExecuteFailoverTask

func (s *Storage) ExecuteFailoverTask(event monitor.EventType, execTime time.Duration) error

ExecuteFailoverTask commits the execution event status

func (*Storage) ExecuteTask

func (s *Storage) ExecuteTask(event monitor.EventType, execTime time.Duration) error

ExecuteTask commits the execution event status

func (*Storage) FailoverTaskInfo

func (s *Storage) FailoverTaskInfo(name string) (*monitor.TaskInfo, error)

FailoverTaskInfo retuns information about the failover task

func (*Storage) ReceiveCount

func (s *Storage) ReceiveCount() (uint64, error)

ReceiveCount returns count of received messages

func (*Storage) ReceiveEvent

func (s *Storage) ReceiveEvent(event monitor.EventType) (err error)

ReceiveEvent register and increments counters

func (*Storage) RegisterApplication

func (s *Storage) RegisterApplication(appInfo *monitor.ApplicationInfo) error

RegisterApplication info in the storage

func (*Storage) TaskInfo

func (s *Storage) TaskInfo(name string) (*monitor.TaskInfo, error)

TaskInfo retuns information about the task

func (*Storage) TaskInfoByID

func (s *Storage) TaskInfoByID(id string) (*monitor.TaskInfo, error)

TaskInfoByID returns information about the particular task

Jump to

Keyboard shortcuts

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