commands

package
v0.0.0-...-30ccd6d Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(host, password, path string, databaseCount uint64, threadCount int)

func Restore

func Restore(host, password, path string, isSupportReplaceRestore bool)

Types

type DumpWorker

type DumpWorker struct {
	Client     *redis.Client
	DatabaseId uint64
	// contains filtered or unexported fields
}

func (*DumpWorker) CloseClient

func (dw *DumpWorker) CloseClient()

func (*DumpWorker) Dump

func (dw *DumpWorker) Dump(key string) (err error)

type Dumper

type Dumper struct {
	Host       string
	Password   string
	Client     *redis.Client
	Path       string
	DatabaseId uint64
	Count      atomic.Uint64

	Stream      *os.File
	ThreadCount int
	// contains filtered or unexported fields
}

func (*Dumper) CloseClient

func (d *Dumper) CloseClient()

func (*Dumper) Dump

func (d *Dumper) Dump()

func (*Dumper) PrintReport

func (d *Dumper) PrintReport()

type Record

type Record struct {
	DatabaseId uint64 `json:"db"`
	Key        string `json:"key"`
	Value      string `json:"value"`
	TTL        int64  `json:"ttl"`
}

type Restorer

type Restorer struct {
	Host     string
	Password string
	Client   map[uint64]*redis.Client
	Stream   *os.File
	Count    uint64

	IsSupportReplaceRestore bool
	// contains filtered or unexported fields
}

func (*Restorer) CloseClients

func (r *Restorer) CloseClients()

func (*Restorer) CloseStream

func (r *Restorer) CloseStream()

func (*Restorer) Init

func (r *Restorer) Init()

func (*Restorer) PrintReport

func (r *Restorer) PrintReport()

func (*Restorer) Restore

func (r *Restorer) Restore()

type SyncLauncher

type SyncLauncher struct {
	SourceHost              string
	SourcePassword          string
	DestinationHost         string
	DestinationPassword     string
	DatabaseCount           uint64
	SyncTimes               uint64
	ThreadCount             int
	IsSupportReplaceRestore bool
}

func (*SyncLauncher) Launch

func (launcher *SyncLauncher) Launch()

func (*SyncLauncher) SetDatabaseCount

func (launcher *SyncLauncher) SetDatabaseCount(databaseCount uint64) *SyncLauncher

func (*SyncLauncher) SetDestinationHost

func (launcher *SyncLauncher) SetDestinationHost(destinationHost string) *SyncLauncher

func (*SyncLauncher) SetDestinationPassword

func (launcher *SyncLauncher) SetDestinationPassword(destinationPassword string) *SyncLauncher

func (*SyncLauncher) SetIsSupportReplaceRestore

func (launcher *SyncLauncher) SetIsSupportReplaceRestore(isSupportReplaceRestore bool) *SyncLauncher

func (*SyncLauncher) SetSourceHost

func (launcher *SyncLauncher) SetSourceHost(sourceHost string) *SyncLauncher

func (*SyncLauncher) SetSourcePassword

func (launcher *SyncLauncher) SetSourcePassword(sourcePassword string) *SyncLauncher

func (*SyncLauncher) SetSyncTimes

func (launcher *SyncLauncher) SetSyncTimes(syncTimes uint64) *SyncLauncher

func (*SyncLauncher) SetThreadCount

func (launcher *SyncLauncher) SetThreadCount(threadCount int) *SyncLauncher

type SyncOneRound

type SyncOneRound struct {
	DatabaseId              uint64
	SourceClient            *redis.Client
	DestinationClient       *redis.Client
	KeysPipeline            chan string
	DestinationKeysPipeline chan string
	Workers                 *lib.Workers
	ThreadCount             int
	IsSupportReplace        bool
}

func (*SyncOneRound) CheckNotExistKeys

func (round *SyncOneRound) CheckNotExistKeys() uint64

func (*SyncOneRound) InitChannel

func (round *SyncOneRound) InitChannel()

func (*SyncOneRound) ReadDestinationKeys

func (round *SyncOneRound) ReadDestinationKeys()

func (*SyncOneRound) ReadKeys

func (round *SyncOneRound) ReadKeys()

func (*SyncOneRound) Sync

func (round *SyncOneRound) Sync() (count uint64)

func (*SyncOneRound) SyncData

func (round *SyncOneRound) SyncData() uint64

type SyncWorker

type SyncWorker struct {
	SourceClient      *redis.Client
	DestinationClient *redis.Client
}

type Synchronizer

type Synchronizer struct {
	Workers map[uint64]*SyncOneRound
}

func (*Synchronizer) Go

func (s *Synchronizer) Go(syncTimes uint64)

func (*Synchronizer) InitClients

func (s *Synchronizer) InitClients(sourceHost, sourcePassword, destinationHost, destinationPassword string, dbCount uint64, threadCount int, isSupportReplace bool)

type TransferRecord

type TransferRecord struct {
	Key   string        `json:"key"`
	Value string        `json:"value"`
	TTL   time.Duration `json:"ttl"`
}

Jump to

Keyboard shortcuts

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