cont

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SHARD_COUNT = 32

Functions

This section is empty.

Types

type BeeMap

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

func NewBeeMap

func NewBeeMap() *BeeMap

NewBeeMap return new safemap

func (*BeeMap) Check

func (m *BeeMap) Check(k interface{}) bool

Check Returns true if k is exist in the map.

func (*BeeMap) Delete

func (m *BeeMap) Delete(k interface{})

Delete the given key and value.

func (*BeeMap) DeleteAll

func (m *BeeMap) DeleteAll()

func (*BeeMap) Get

func (m *BeeMap) Get(k interface{}) interface{}

Get from maps return the k's value

func (*BeeMap) Items

func (m *BeeMap) Items() map[interface{}]interface{}

Items returns all items in safemap.

func (*BeeMap) Set

func (m *BeeMap) Set(k interface{}, v interface{}) bool

Set Maps the given key and value. Returns false if the key is already in the map and changes nothing.

type ConcurrentMap

type ConcurrentMap []*ConcurrentMapShared

func NewConcurrentMap

func NewConcurrentMap() ConcurrentMap

func (ConcurrentMap) Count

func (m ConcurrentMap) Count() int

func (ConcurrentMap) Get

func (m ConcurrentMap) Get(key string) (interface{}, bool)

func (ConcurrentMap) GetShard

func (m ConcurrentMap) GetShard(key string) *ConcurrentMapShared

func (ConcurrentMap) Has

func (m ConcurrentMap) Has(key string) bool

func (ConcurrentMap) IsEmpty

func (m ConcurrentMap) IsEmpty() bool

func (ConcurrentMap) Items

func (m ConcurrentMap) Items() map[string]interface{}

func (ConcurrentMap) Iter

func (m ConcurrentMap) Iter() <-chan Tuple

func (ConcurrentMap) IterBuffered

func (m ConcurrentMap) IterBuffered() <-chan Tuple

func (ConcurrentMap) IterCb

func (m ConcurrentMap) IterCb(fn IterCb)

func (ConcurrentMap) Keys

func (m ConcurrentMap) Keys() []string

func (ConcurrentMap) MSet

func (m ConcurrentMap) MSet(data map[string]interface{})

func (ConcurrentMap) MarshalJSON

func (m ConcurrentMap) MarshalJSON() ([]byte, error)

func (ConcurrentMap) Pop

func (m ConcurrentMap) Pop(key string) (v interface{}, exists bool)

func (ConcurrentMap) Remove

func (m ConcurrentMap) Remove(key string)

func (ConcurrentMap) RemoveCb

func (m ConcurrentMap) RemoveCb(key string, cb RemoveCb) bool

func (ConcurrentMap) Set

func (m ConcurrentMap) Set(key string, value interface{})

func (ConcurrentMap) SetIfAbsent

func (m ConcurrentMap) SetIfAbsent(key string, value interface{}) bool

func (ConcurrentMap) Upsert

func (m ConcurrentMap) Upsert(key string, value interface{}, cb UpsertCb) (res interface{})

type ConcurrentMapShared

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

type Deque

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

Deque represents a single instance of the deque data structure.

func (*Deque) At

func (q *Deque) At(i int) interface{}

At returns the element at index i in the queue without removing the element from the queue. This method accepts only non-negative index values. At(0) refers to the first element and is the same as Front(). At(Len()-1) refers to the last element and is the same as Back(). If the index is invalid, the call panics.

The purpose of At is to allow Deque to serve as a more general purpose circular buffer, where items are only added to and removed from the ends of the deque, but may be read from any place within the deque. Consider the case of a fixed-size circular log buffer: A new entry is pushed onto one end and when full the oldest is popped from the other end. All the log entries in the buffer must be readable without altering the buffer contents.

func (*Deque) Back

func (q *Deque) Back() interface{}

Back returns the element at the back of the queue. This is the element that would be returned by PopBack(). This call panics if the queue is empty.

func (*Deque) Clear

func (q *Deque) Clear()

Clear removes all elements from the queue, but retains the current capacity. This is useful when repeatedly reusing the queue at high frequency to avoid GC during reuse. The queue will not be resized smaller as long as items are only added. Only when items are removed is the queue subject to getting resized smaller.

func (*Deque) Front

func (q *Deque) Front() interface{}

Front returns the element at the front of the queue. This is the element that would be returned by PopFront(). This call panics if the queue is empty.

func (*Deque) Len

func (q *Deque) Len() int

Len returns the number of elements currently stored in the queue.

func (*Deque) PopBack

func (q *Deque) PopBack() interface{}

PopBack removes and returns the element from the back of the queue. Implements LIFO when used with PushBack(). If the queue is empty, the call panics.

func (*Deque) PopFront

func (q *Deque) PopFront() interface{}

PopFront removes and returns the element from the front of the queue. Implements FIFO when used with PushBack(). If the queue is empty, the call panics.

func (*Deque) PushBack

func (q *Deque) PushBack(elem interface{})

PushBack appends an element to the back of the queue. Implements FIFO when elements are removed with PopFront(), and LIFO when elements are removed with PopBack().

func (*Deque) PushFront

func (q *Deque) PushFront(elem interface{})

PushFront prepends an element to the front of the queue.

func (*Deque) Rotate

func (q *Deque) Rotate(n int)

Rotate rotates the deque n steps front-to-back. If n is negative, rotates back-to-front. Having Deque provide Rotate() avoids resizing that could happen if implementing rotation using only Pop and Push methods.

func (*Deque) SetMinCapacity

func (q *Deque) SetMinCapacity(minCapacityExp uint)

SetMinCapacity sets a minimum capacity of 2^minCapacityExp. If the value of the minimum capacity is less than or equal to the minimum allowed, then capacity is set to the minimum allowed. This may be called at anytime to set a new minimum capacity.

Setting a larger minimum capacity may be used to prevent resizing when the number of stored items changes frequently across a wide range.

type IterCb

type IterCb func(key string, v interface{})

type Queue

type Queue struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue() *Queue

func (*Queue) Dump

func (q *Queue) Dump()

func (*Queue) Pop

func (q *Queue) Pop() interface{}

func (*Queue) Push

func (q *Queue) Push(v interface{})

type RemoveCb

type RemoveCb func(key string, v interface{}, exists bool) bool

type Tuple

type Tuple struct {
	Key string
	Val interface{}
}

type UpsertCb

type UpsertCb func(exist bool, valueInMap interface{}, newValue interface{}) interface{}

Jump to

Keyboard shortcuts

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