Documentation ¶
Overview ¶
Package skitlistmap ... concurrent akiplist map implementatin Copyright 2201 Kazuhisa TAKEI<[email protected]>. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package skitlistmap ... concurrent akiplist map implementatin Copyright 2201 Kazuhisa TAKEI<[email protected]>. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2201 Kazuhisa TAKEI<[email protected]>. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package loncha/list_head is like a kernel's LIST_HEAD list_head is used by loncha/gen/containers_list
Index ¶
- Constants
- Variables
- func ElementOf(head unsafe.Pointer, offset uintptr) unsafe.Pointer
- func IsDebug() bool
- func IsInfo() bool
- func KeyToHash(key interface{}) (uint64, uint64)
- func Log(l LogLevel, s string, args ...interface{})
- func MemHash(data []byte) uint64
- func MemHashString(str string) uint64
- func NewEntryMap(key, value interface{}) *entryHMap
- func PoolCap(len int) int
- func ResetStats()
- func SetLogIO(w io.Writer)
- func WithBucket(b *bucket) func(*hmapMethod)
- type CondOfFinder
- type ErrType
- type Error
- type HMapEntry
- type HMethodOpt
- type LevelHead
- type LogLevel
- type Map
- func (h *Map) AddLen(inc int64) int64
- func (h *Map) BackBucket() (bCur *bucket)
- func (h *Map) Delete(key interface{}) bool
- func (h *Map) DumpBucket(w io.Writer)
- func (h *Map) DumpBucketPerLevel(w io.Writer)
- func (h *Map) DumpEntry(w io.Writer)
- func (h *Map) FindBucket(reverse uint64) (b *bucket)
- func (h *Map) First() HMapEntry
- func (h *Map) Get(key interface{}) (value interface{}, ok bool)
- func (h *Map) GetByHash(hash, conflict uint64) (value interface{}, ok bool)
- func (h *Map) Last() HMapEntry
- func (h *Map) Len() int
- func (h *Map) LoadItem(key interface{}) (item MapItem, success bool)
- func (h *Map) LoadItemByHash(k uint64, conflict uint64) (item MapItem, success bool)
- func (h *Map) Options(opts ...OptHMap) (previouses []OptHMap)
- func (h *Map) Purge(key interface{}) bool
- func (h *Map) Range(f func(key, value interface{}) bool)
- func (h *Map) RangeItem(f func(MapItem) bool)
- func (h *Map) SearchKey(k uint64, opts ...searchArg) HMapEntry
- func (h *Map) Set(key, value interface{}) bool
- func (h *Map) StoreItem(item MapItem) bool
- func (h *Map) TestSet(k, conflict uint64, btable *bucket, item MapItem) bool
- type MapHead
- func (mh *MapHead) ConflictInHamp() uint64
- func (c *MapHead) FromListHead(l *elist_head.ListHead) elist_head.List
- func (mh *MapHead) IsDeleted() bool
- func (mh *MapHead) IsDummy() bool
- func (mh *MapHead) IsIgnored() bool
- func (mh *MapHead) KeyInHmap() uint64
- func (c *MapHead) NextWithNil() *MapHead
- func (mh *MapHead) Offset() uintptr
- func (c *MapHead) PrevtWithNil() *MapHead
- func (mh *MapHead) PtrListHead() *elist_head.ListHead
- type MapItem
- type OptHMap
- type Pool
- type SampleItem
- func (s *SampleItem) Delete()
- func (s *SampleItem) HmapEntryFromListHead(lhead *elist_head.ListHead) HMapEntry
- func (s *SampleItem) Key() interface{}
- func (s *SampleItem) KeyHash() (uint64, uint64)
- func (s *SampleItem) Next() HMapEntry
- func (s *SampleItem) Offset() uintptr
- func (s *SampleItem) Prev() HMapEntry
- func (s *SampleItem) PtrMapHead() *MapHead
- func (s *SampleItem) PtrMapeHead() *MapHead
- func (s *SampleItem) SetValue(v interface{}) bool
- func (s *SampleItem) Setup()
- func (s *SampleItem) Value() interface{}
- type SearchMode
Constants ¶
const ( CntSearchBucket statKey = 1 CntLevelBucket statKey = 2 CntSearchEntry statKey = 3 CntReverseSearch statKey = 4 CntOfGet statKey = 5 )
const ( CmdNone poolCmd = iota CmdGet CmdPut CmdClose )
const CntOfPersamepleItemPool = 64
count pool per one samepleItemPool
const SampleItemOffsetOf = unsafe.Offsetof(EmptySampleHMapEntry.ListHead)
const SampleItemSize = unsafe.Sizeof(*EmptySampleHMapEntry)
Variables ¶
var ( ErrItemInvalidAdd error = NewError(EIItemInvalidAdd, "dd: item is added. but not found", nil) ErrBucketNotFound error = NewError(EBucketNotFound, "bucket is not found", nil) ErrBucketAllocatedFail error = NewError(EBucketAllocatedFail, "cannot allocated level bucket buffer", nil) ErrBucketAlreadyExit error = NewError(EBucketAlreadyExist, "bucket is exist alread", nil) ErrBucketInvalidOrder error = NewError(EBucketInvalidOrder, "bucket is invalid order", nil) ErrIdxOverflow error = NewError(EIndexOverflow, "index overflow for slice", nil) EPoolAlreadyDeleted error = NewError(EIPoolAlreadyDeleted, "itemPool already deleted", nil) EPoolExpandFail error = NewError(EIPooExpandFail, "fail expand itemPool", nil) )
var DebugStats map[statKey]int = map[statKey]int{}
var (
EmptyEntryHMap *entryHMap = nil
)
var EmptysamepleItemPool *samepleItemPool = (*samepleItemPool)(unsafe.Pointer(uintptr(0)))
var EnableStats bool = false
var Failreverse uint64 = 0
var IsExtended = false
var UseGoroutineInPool bool = false
Functions ¶
func MemHashString ¶
func NewEntryMap ¶
func NewEntryMap(key, value interface{}) *entryHMap
func ResetStats ¶ added in v0.1.3
func ResetStats()
func WithBucket ¶
func WithBucket(b *bucket) func(*hmapMethod)
Types ¶
type CondOfFinder ¶
type CondOfFinder func(ehead *entryHMap) bool
func CondOfFind ¶
func CondOfFind(reverse uint64, l sync.Locker) CondOfFinder
type Error ¶ added in v0.2.4
type Error struct { Type ErrType // contains filtered or unexported fields }
type HMapEntry ¶
type HMapEntry interface { Offset() uintptr PtrMapHead() *MapHead PtrListHead() *elist_head.ListHead HmapEntryFromListHead(*elist_head.ListHead) HMapEntry Next() HMapEntry Prev() HMapEntry }
func NilMapEntry ¶ added in v0.6.1
func NilMapEntry() HMapEntry
type HMethodOpt ¶
type HMethodOpt func(*hmapMethod)
type Map ¶
type Map struct { ItemFn func() MapItem // contains filtered or unexported fields }
Map ... Skip List Map is an ordered and concurrent map. this Map is gourtine safety for reading/updating/deleting, require locking and coordination. This
func (*Map) BackBucket ¶ added in v0.2.4
func (h *Map) BackBucket() (bCur *bucket)
func (*Map) DumpBucket ¶
func (*Map) DumpBucketPerLevel ¶
func (*Map) FindBucket ¶ added in v0.5.1
func (*Map) LoadItem ¶
LoadItem ... return key/value item with embedded-linked-list. if not found, ok is false
func (*Map) LoadItemByHash ¶ added in v0.2.1
func (*Map) Range ¶ added in v0.1.2
Range ... calls f sequentially for each key and value present in the map. order is reverse key order
func (*Map) RangeItem ¶ added in v0.1.2
RangeItem ... calls f sequentially for each key and value present in the map. called ordre is reverse key order
type MapHead ¶
type MapHead struct { elist_head.ListHead // contains filtered or unexported fields }
func (*MapHead) ConflictInHamp ¶
func (*MapHead) FromListHead ¶
func (c *MapHead) FromListHead(l *elist_head.ListHead) elist_head.List
func (*MapHead) NextWithNil ¶ added in v0.1.3
func (*MapHead) PrevtWithNil ¶ added in v0.1.3
func (*MapHead) PtrListHead ¶
func (mh *MapHead) PtrListHead() *elist_head.ListHead
type MapItem ¶
type OptHMap ¶
func BucketMode ¶
func BucketMode(mode SearchMode) OptHMap
func MaxPefBucket ¶
func UseEmbeddedPool ¶ added in v0.5.1
type SampleItem ¶
var EmptySampleHMapEntry *SampleItem = (*SampleItem)(unsafe.Pointer(uintptr(0)))
var EmptySampleHMapEntry SampleItem = SampleItem{}
func NewSampleItem ¶ added in v0.6.1
func NewSampleItem(key string, value interface{}) (item *SampleItem)
func SampleItemFromListHead ¶
func SampleItemFromListHead(head *elist_head.ListHead) *SampleItem
func (*SampleItem) Delete ¶
func (s *SampleItem) Delete()
func (*SampleItem) HmapEntryFromListHead ¶
func (s *SampleItem) HmapEntryFromListHead(lhead *elist_head.ListHead) HMapEntry
func (*SampleItem) Key ¶
func (s *SampleItem) Key() interface{}
func (*SampleItem) KeyHash ¶ added in v0.3.1
func (s *SampleItem) KeyHash() (uint64, uint64)
func (*SampleItem) Next ¶
func (s *SampleItem) Next() HMapEntry
func (*SampleItem) Offset ¶
func (s *SampleItem) Offset() uintptr
func (*SampleItem) Prev ¶
func (s *SampleItem) Prev() HMapEntry
func (*SampleItem) PtrMapHead ¶
func (s *SampleItem) PtrMapHead() *MapHead
func (*SampleItem) PtrMapeHead ¶
func (s *SampleItem) PtrMapeHead() *MapHead
func (*SampleItem) SetValue ¶
func (s *SampleItem) SetValue(v interface{}) bool
func (*SampleItem) Setup ¶ added in v0.2.1
func (s *SampleItem) Setup()
func (*SampleItem) Value ¶
func (s *SampleItem) Value() interface{}
type SearchMode ¶
type SearchMode byte
const ( LenearSearchForBucket SearchMode = iota NestedSearchForBucket CombineSearch CombineSearch2 CombineSearch3 CombineSearch4 NoItemSearchForBucket = 9 // test mode FalsesSearchForBucket = 10 // test mode )