utils

package
v0.0.0-...-69c43f4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GolangSecurityTime = "2006-01-02T15:04:05Z"
	// GolangSecurityTime = "2006-01-02 15:04:05"
	ReaderBufferSize = bytesize.MB * 32
	WriterBufferSize = bytesize.MB * 8

	LogLevelNone  = "none"
	LogLevelError = "error"
	LogLevelWarn  = "warn"
	LogLevelInfo  = "info"
	LogLevelAll   = "all"
)
View Source
const (
	KB = 1024
	MB = 1024 * KB
	GB = 1024 * MB
	TB = 1024 * GB
	PB = 1024 * TB
)

Variables

View Source
var (
	Version    = "$"
	LogRotater *logRotate.Logger
	StartTime  string
)
View Source
var (
	HttpApi *nimo.HttpRestProvider
)

Functions

func AuthPassword

func AuthPassword(c net.Conn, auth_type, passwd string)

func CheckHandleNetError

func CheckHandleNetError(err error) bool

func Float64ToByte

func Float64ToByte(float float64) string

func FlushWriter

func FlushWriter(w *bufio.Writer)

func GetFakeSlaveOffset

func GetFakeSlaveOffset(c redigo.Conn) (string, error)

func GetLocalIp

func GetLocalIp(preferdInterfaces []string) (ip string, interfaceName string, err error)

func GetRedisVersion

func GetRedisVersion(target, authType, auth string) (string, error)

func Goodbye

func Goodbye()

func InitHttpApi

func InitHttpApi(port int)

func Iocopy

func Iocopy(r io.Reader, w io.Writer, p []byte, max int) int

func KeyToSlot

func KeyToSlot(key string) uint16

func NewRDBLoader

func NewRDBLoader(reader *bufio.Reader, rbytes *atomic2.Int64, size int) chan *rdb.BinEntry

func OpenNetConn

func OpenNetConn(target, auth_type, passwd string) net.Conn

func OpenNetConnSoft

func OpenNetConnSoft(target, auth_type, passwd string) net.Conn

func OpenReadFile

func OpenReadFile(name string) (*os.File, int64)

func OpenReadWriteFile

func OpenReadWriteFile(name string) *os.File

func OpenRedisConn

func OpenRedisConn(target, auth_type, passwd string) redigo.Conn

func OpenRedisConnWithTimeout

func OpenRedisConnWithTimeout(target, auth_type, passwd string, readTimeout, writeTimeout time.Duration) redigo.Conn

func OpenSyncConn

func OpenSyncConn(target string, auth_type, passwd string) (net.Conn, <-chan int64)

func OpenWriteFile

func OpenWriteFile(name string) *os.File

func ParseInfo

func ParseInfo(content []byte) map[string]string

func ParseRedisInfo

func ParseRedisInfo(content []byte) map[string]string

func ReadRESPEnd

func ReadRESPEnd(c net.Conn) (string, error)

read until hit the end of RESP: "\r\n"

func RemoveRESPEnd

func RemoveRESPEnd(input string) string

func RestoreRdbEntry

func RestoreRdbEntry(c redigo.Conn, e *rdb.BinEntry)

func SelectDB

func SelectDB(c redigo.Conn, db uint32)

func SendPSyncAck

func SendPSyncAck(bw *bufio.Writer, offset int64) error

func SendPSyncContinue

func SendPSyncContinue(br *bufio.Reader, bw *bufio.Writer, runid string, offset int64)

func SendPSyncFullsync

func SendPSyncFullsync(br *bufio.Reader, bw *bufio.Writer) (string, int64, <-chan int64)

func SendPSyncListeningPort

func SendPSyncListeningPort(c net.Conn, port int)

func Welcome

func Welcome()

func WritePid

func WritePid(id string) (err error)

func WritePidById

func WritePidById(id string, path string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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