common

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GiB                       = 1024 * 1024 * 1024
	TIME_FORMAT               = "2006-01-02 15:04:05"
	TIME_MS_FORMAT            = "2006-01-02 15:04:05.000"
	CURVEBS_ADDRESS_DELIMITER = ","
	RAFT_REPLICAS_NUMBER      = 3
	RAFT_MARGIN               = 1000

	CHAR_TABLE = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

	// raft status
	RAFT_EMPTY_ADDR                            = "0.0.0.0:0:0"
	RAFT_STATUS_KEY_GROUPID                    = "group_id"
	RAFT_STATUS_KEY_LEADER                     = "leader"
	RAFT_STATUS_KEY_PEERS                      = "peers"
	RAFT_STATUS_KEY_STATE                      = "state"
	RAFT_STATUS_KEY_REPLICATOR                 = "replicator"
	RAFT_STATUS_KEY_LAST_LOG_ID                = "last_log_id"
	RAFT_STATUS_KEY_SNAPSHOT                   = "snapshot"
	RAFT_STATUS_KEY_NEXT_INDEX                 = "next_index"
	RAFT_STATUS_KEY_FLYING_APPEND_ENTRIES_SIZE = "flying_append_entries_size"
	RAFT_STATUS_KEY_STORAGE                    = "storage"

	RAFT_STATUS_STATE_LEADER       = "LEADER"
	RAFT_STATUS_STATE_FOLLOWER     = "FOLLOWER"
	RAFT_STATUS_STATE_TRANSFERRING = "TRANSFERRING"
	RAFT_STATUS_STATE_CANDIDATE    = "CANDIDATE"
)

Variables

This section is empty.

Functions

func GetHttpClient

func GetHttpClient() *http.Client

func GetIPFromEndpoint

func GetIPFromEndpoint(endpoint string) (string, error)

func GetMd5Sum32Little

func GetMd5Sum32Little(key string) string

func GetRandString

func GetRandString(n int) string

func MaxUint64

func MaxUint64(first, second uint64) uint64

func Mill2TimeStr

func Mill2TimeStr(mill int64) string

func MinUint32

func MinUint32(first, second uint32) uint32

Types

type QueryResult

type QueryResult struct {
	Key    interface{}
	Err    error
	Result interface{}
}

Jump to

Keyboard shortcuts

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