util

package
v0.0.0-...-71dd0ca Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	DefaultDataPartitionSize = 120 * GB
	TaskWorkerInterval       = 1
)
View Source
const (
	BlockHeaderInoSize     = 8
	BlockHeaderCrcSize     = PerBlockCrcSize * BlockCount
	BlockHeaderCrcIndex    = BlockHeaderInoSize
	BlockHeaderDelMarkSize = 1
	BlockHeaderSize        = BlockHeaderInoSize + BlockHeaderCrcSize + BlockHeaderDelMarkSize
	BlockCount             = 1024
	MarkDelete             = 'D'
	UnMarkDelete           = 'U'
	MarkDeleteIndex        = BlockHeaderSize - 1
	BlockSize              = 65536 * 2
	ReadBlockSize          = BlockSize
	PerBlockCrcSize        = 4
	DeleteIndexFileName    = "delete.index"
	ExtentSize             = BlockCount * BlockSize
	ExtentFileSizeLimit    = BlockHeaderSize + ExtentSize
	PacketHeaderSize       = 45
)
View Source
const MEMINFO = "/proc/meminfo"

Variables

View Source
var (
	ErrNoValidMaster = errors.New("no valid master")
)

Functions

func GetLocalIP

func GetLocalIP() (localIP string, err error)

func GetMemInfo

func GetMemInfo() (total, used uint64, err error)

func IP

func IP(val interface{}) bool

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

Types

type MasterHelper

type MasterHelper interface {
	AddNode(address string)
	Nodes() []string
	Leader() string
	Request(method, path string, param map[string]string, body []byte) (data []byte, err error)
}

func NewMasterHelper

func NewMasterHelper() MasterHelper

type Set

type Set struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSet

func NewSet() *Set

func (*Set) Add

func (s *Set) Add(key int)

func (*Set) Has

func (s *Set) Has(key int) bool

func (*Set) Len

func (s *Set) Len() int

func (*Set) List

func (s *Set) List() []int

func (*Set) Remove

func (s *Set) Remove(key int)

func (*Set) RemoveAll

func (s *Set) RemoveAll()

Directories

Path Synopsis
Package btree implements in-memory B-Trees of arbitrary degree.
Package btree implements in-memory B-Trees of arbitrary degree.
Package gorocksdb provides the ability to create and access RocksDB databases.
Package gorocksdb provides the ability to create and access RocksDB databases.

Jump to

Keyboard shortcuts

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