adapter

package
v0.0.0-...-c37d8b3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrettyProgressWriter

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

PrettyProgressWriter progress writer using go-pretty/progress library

func NewPrettyProgressWriter

func NewPrettyProgressWriter(output io.Writer) *PrettyProgressWriter

NewPrettyProgressWriter creates PrettyProgressWriter

func (*PrettyProgressWriter) AddTracker

func (p *PrettyProgressWriter) AddTracker(id string, total int64)

func (*PrettyProgressWriter) Increment

func (p *PrettyProgressWriter) Increment(id string, incrementBy int64)

Increment increments progress

func (*PrettyProgressWriter) SetNumTrackersExpected

func (p *PrettyProgressWriter) SetNumTrackersExpected(numTrackers int)

func (*PrettyProgressWriter) Start

func (p *PrettyProgressWriter) Start()

Start initiates progress writing progress, if total is unknown should be zero

func (*PrettyProgressWriter) Stop

func (p *PrettyProgressWriter) Stop()

Stop labels progress as finished and stops updating progress

type ProgressWriter

type ProgressWriter interface {
	// AddTracker adds a tracker to the progress writer
	// id is used to identify the tracker
	AddTracker(id string, total int64)
	// SetNumTrackersExpected sets the number of trackers expected
	SetNumTrackersExpected(numTrackers int)
	// Start initiates progress writing progress, if total is unknown should be zero
	Start()
	// Increment increments progress
	Increment(id string, incrementBy int64)
	// Stop labels progress as finished and stops updating progress
	Stop()
}

ProgressWriter abstraction of progress writer

type RedisService

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

RedisService implementation for iteration over redis

func NewRedisService

func NewRedisService(logger zerolog.Logger) RedisService

func (RedisService) GetCurrentNodeIp

func (s RedisService) GetCurrentNodeIp() string

func (RedisService) GetKeysCount

func (s RedisService) GetKeysCount(ctx context.Context) (int64, error)

GetKeysCount returns number of keys in the current database

func (RedisService) GetMemoryUsage

func (s RedisService) GetMemoryUsage(ctx context.Context, key string) (int64, error)

GetMemoryUsage returns memory usage of given key

func (RedisService) GetTotalShards

func (s RedisService) GetTotalShards(ctx context.Context) (int64, error)

func (RedisService) ScanAllShards

func (s RedisService) ScanAllShards(ctx context.Context, options ScanOptions, resultChan chan ShardScanUpdate) chan ShardInit

func (RedisService) ScanKeys

func (s RedisService) ScanKeys(ctx context.Context, options ScanOptions, resultChan chan ShardScanUpdate)

ScanKeys scans keys asynchroniously and sends them to the returned channel

func (*RedisService) SetClient

func (rs *RedisService) SetClient(client redis.Client)

func (*RedisService) SetClusterClient

func (rs *RedisService) SetClusterClient(client redis.ClusterClient)

type ScanOptions

type ScanOptions struct {
	Pattern   string
	ScanCount int
	Throttle  int
	IsCluster bool
}

ScanOptions options for scanning keyspace

type ShardInit

type ShardInit struct {
	ShardIp   string
	TotalKeys int64
}

type ShardScanUpdate

type ShardScanUpdate struct {
	ShardIp     string
	Key         string
	MemoryUsage int64
}

type Tracker

type Tracker interface {
	Increment(value int64)
	MarkAsDone()
}

Tracker is abstraction over libraries "Tracker" struct

Jump to

Keyboard shortcuts

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