container

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotExistErr = errors.New("not exist")

Functions

This section is empty.

Types

type BlockingKMapContainer added in v0.2.2

type BlockingKMapContainer struct {
	Tolerate float64
	// contains filtered or unexported fields
}

多线程读写安全的container,支持增量

func (*BlockingKMapContainer) Del added in v0.2.2

func (bm *BlockingKMapContainer) Del(key MapKey, value interface{})

func (*BlockingKMapContainer) Get added in v0.2.2

func (bm *BlockingKMapContainer) Get(key MapKey) (interface{}, error)

func (*BlockingKMapContainer) Len added in v0.2.2

func (bm *BlockingKMapContainer) Len() int

func (*BlockingKMapContainer) LoadBase added in v0.2.2

func (bm *BlockingKMapContainer) LoadBase(iterator DataIterator) error

func (*BlockingKMapContainer) LoadInc added in v0.2.2

func (bm *BlockingKMapContainer) LoadInc(iterator DataIterator) error

func (*BlockingKMapContainer) Range added in v0.2.2

func (bm *BlockingKMapContainer) Range(f func(key, value interface{}) bool)

func (*BlockingKMapContainer) Set added in v0.2.2

func (bm *BlockingKMapContainer) Set(key MapKey, value interface{}) error

type BlockingMapContainer

type BlockingMapContainer struct {
	Tolerate float64
	// contains filtered or unexported fields
}

多线程读写安全的container,支持增量

func CreateBlockingKSetContainer added in v0.2.2

func CreateBlockingKSetContainer(tolerate float64) *BlockingMapContainer

func CreateBlockingMapContainer

func CreateBlockingMapContainer(numPartision int, tolerate float64) *BlockingMapContainer

func (*BlockingMapContainer) Del

func (bm *BlockingMapContainer) Del(key MapKey, value interface{})

func (*BlockingMapContainer) Get

func (bm *BlockingMapContainer) Get(key MapKey) (interface{}, error)

func (*BlockingMapContainer) Len added in v0.1.1

func (bm *BlockingMapContainer) Len() int

func (*BlockingMapContainer) LoadBase

func (bm *BlockingMapContainer) LoadBase(iterator DataIterator) error

func (*BlockingMapContainer) LoadInc

func (bm *BlockingMapContainer) LoadInc(iterator DataIterator) error

func (*BlockingMapContainer) Range added in v0.1.1

func (bm *BlockingMapContainer) Range(f func(key, value interface{}) bool)

func (*BlockingMapContainer) Set

func (bm *BlockingMapContainer) Set(key MapKey, value interface{}) error

type BufferedKListContainer

type BufferedKListContainer struct {
	ErrorNum int
	// contains filtered or unexported fields
}

双bufMap, 仅提供Get/LoadBase接口

func CreateBufferedKListContainer added in v0.2.2

func CreateBufferedKListContainer() *BufferedKListContainer

func (*BufferedKListContainer) Del

func (bm *BufferedKListContainer) Del(key MapKey, value interface{})

func (*BufferedKListContainer) Get

func (bm *BufferedKListContainer) Get(key MapKey) (interface{}, error)

func (*BufferedKListContainer) LoadBase

func (bm *BufferedKListContainer) LoadBase(iterator DataIterator) error

func (*BufferedKListContainer) LoadInc

func (bm *BufferedKListContainer) LoadInc(iterator DataIterator) error

func (*BufferedKListContainer) Set

func (bm *BufferedKListContainer) Set(key MapKey, value interface{}) error

type BufferedMapContainer

type BufferedMapContainer struct {
	Tolerate float64
	// contains filtered or unexported fields
}

双bufMap, 仅提供Get/LoadBase接口

func (*BufferedMapContainer) Del

func (bm *BufferedMapContainer) Del(key MapKey, value interface{})

func (*BufferedMapContainer) Get

func (bm *BufferedMapContainer) Get(key MapKey) (interface{}, error)

func (*BufferedMapContainer) Len added in v0.1.1

func (bm *BufferedMapContainer) Len() int

func (*BufferedMapContainer) LoadBase

func (bm *BufferedMapContainer) LoadBase(iterator DataIterator) error

func (*BufferedMapContainer) LoadInc

func (bm *BufferedMapContainer) LoadInc(iterator DataIterator) error

func (*BufferedMapContainer) Range added in v0.1.1

func (bm *BufferedMapContainer) Range(f func(key, value interface{}) bool)

func (*BufferedMapContainer) Set

func (bm *BufferedMapContainer) Set(key MapKey, value interface{}) error

type Container

type Container interface {
	Get(key MapKey) (interface{}, error)
	Set(key MapKey, value interface{}) error
	Del(key MapKey, value interface{})

	Len() int
	Range(f func(key, value interface{}) bool)

	LoadBase(dataIter DataIterator) error
	LoadInc(dataIter DataIterator) error
}

type DataIterator

type DataIterator interface {
	HasNext() (bool, error)
	Next() (DataMode, MapKey, interface{}, error)
}

type DataMode

type DataMode int
const (
	DataModeAdd    DataMode = 0
	DataModeUpdate DataMode = 1
	DataModeDel    DataMode = 2
)

type Int64Key

type Int64Key struct {
	Data int64
}

func I64Key

func I64Key(key int64) *Int64Key

func (*Int64Key) PartitionKey

func (i *Int64Key) PartitionKey() int64

func (*Int64Key) Value

func (i *Int64Key) Value() interface{}

type MapKey

type MapKey interface {
	PartitionKey() int64
	Value() interface{}
}

key of the map, because of go-lang not support generic type, So, here defined an interface for int Data or string Data key

type StringKey

type StringKey struct {
	Data string
}

StringKey is for the string type key

func StrKey

func StrKey(key string) *StringKey

StrKey is to convert a string to StringKey

func (*StringKey) PartitionKey

func (s *StringKey) PartitionKey() int64

PartitionID is created by string's hash

func (*StringKey) Value

func (s *StringKey) Value() interface{}

Value is the raw string

Jump to

Keyboard shortcuts

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