common

package
v0.0.0-...-9dc9b3d Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HOT = iota
	COLD
)
View Source
const (
	ReadOK = 400 + iota
	ReadEOF
)

error code

View Source
const (
	STABLE = 111 + iota
	UNSTABLE
)

Status

View Source
const (
	ReplicaNum     = 2
	ColdReplicaNum = 1
	BlockSize      = 1 << 19 // 512KB

	HeartBeatInterval         = 500 * time.Millisecond
	GarbageCollectionInterval = 30 * time.Second // temp
	HeartBeatTimeout          = 5 * time.Second
	HealthCheckInterval       = 4 * HeartBeatInterval
	ExpireInterval            = 60 * time.Second // temp
	RearrangeInterval         = 2 * HealthCheckInterval

	ExpireTime = 3 * time.Minute
	MaxRetry   = 3
)

config

Variables

This section is empty.

Functions

func GenerateRandomData

func GenerateRandomData(length int64) []byte

func GetGoroutineID

func GetGoroutineID() uint64

func Logger

func Logger() *logrus.Entry

Types

type BlockHandle

type BlockHandle uint64

type BlockIndex

type BlockIndex int32

type BlockVersion

type BlockVersion int32

type Checksum

type Checksum int64

type Code

type Code int

type ColdKey

type ColdKey string

type Error

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

func (*Error) Error

func (e *Error) Error() (Code, string)

type HotKey

type HotKey string

type Node

type Node struct {
	Blocks  map[BlockHandle]bool
	Garbage []BlockHandle

	LastBeat time.Time
}

type NodeAddress

type NodeAddress string

func RemoveAddress

func RemoveAddress(nodeList []NodeAddress, target NodeAddress) ([]NodeAddress, error)

type NodeType

type NodeType int

type Offset

type Offset int64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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