common

package
v0.0.0-...-c2c101f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReqId

func GetReqId(ctx context.Context) string

func GetSpendTimeWithCtx

func GetSpendTimeWithCtx(ctx context.Context, action string) func()

func SetUniqueContext

func SetUniqueContext(ctx context.Context) context.Context

Types

type ConcurrentMap

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

func NewConcurrentMap

func NewConcurrentMap(keyType, valueType reflect.Type) (*ConcurrentMap, error)

func (*ConcurrentMap) Delete

func (cm *ConcurrentMap) Delete(key interface{})

func (*ConcurrentMap) Load

func (cm *ConcurrentMap) Load(key interface{}) (value interface{}, ok bool)

func (*ConcurrentMap) Range

func (cm *ConcurrentMap) Range(f func(key, value interface{}) bool)

func (*ConcurrentMap) Store

func (cm *ConcurrentMap) Store(key, value interface{})

type DeleteSegMetaResp

type DeleteSegMetaResp struct {
	Err error
}

type GcMapTreeResp

type GcMapTreeResp struct {
	Err      error
	RespInfo interface{}
}

type HashRing

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

HashRing to hold the nodes and indexes

func New

func New(replicaCount int, hash hash.Hash32) *HashRing

New returns a Hash ring with provided virtual node count and hash If hash is nil, fvn32a is used instead

func (*HashRing) Add

func (hr *HashRing) Add(node string) error

Add adds a node to Hash ring

func (*HashRing) Delete

func (hr *HashRing) Delete(node string) error

Delete deletes the nodes from hash ring

func (*HashRing) Locate

func (hr *HashRing) Locate(key string) (node string, err error)

Locate returns the node for a given key

type IdGenerator

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

func NewIdGenerator

func NewIdGenerator() (idGenerator *IdGenerator, err error)

func (*IdGenerator) GetId

func (ig *IdGenerator) GetId() string

type Segment

type Segment struct {
	FsId    string
	SegId0  uint64
	SegId1  uint64
	FileEnd uint64
}

type UpdateSegResp

type UpdateSegResp struct {
	Err error
	Seg *Segment
}

Jump to

Keyboard shortcuts

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