Documentation ¶
Index ¶
- Variables
- type ConcurrentMap
- func (m ConcurrentMap) Count() int
- func (m ConcurrentMap) Get(key string) (*mgo.Session, bool)
- func (m ConcurrentMap) GetShard(key string) *ConcurrentMapShared
- func (m *ConcurrentMap) Has(key string) bool
- func (m *ConcurrentMap) IsEmpty() bool
- func (m ConcurrentMap) Iter() <-chan Tuple
- func (m ConcurrentMap) IterBuffered() <-chan Tuple
- func (m ConcurrentMap) MarshalJSON() ([]byte, error)
- func (m *ConcurrentMap) Remove(key string)
- func (m *ConcurrentMap) Set(key string, value *mgo.Session)
- func (m *ConcurrentMap) UnmarshalJSON(b []byte) (err error)
- type ConcurrentMapShared
- type Tuple
Constants ¶
This section is empty.
Variables ¶
View Source
var SHARD_COUNT = 32
Functions ¶
This section is empty.
Types ¶
type ConcurrentMap ¶
type ConcurrentMap []*ConcurrentMapShared
A "thread" safe map of type string:*mgo.Session. To avoid lock bottlenecks this map is dived to several (SHARD_COUNT) map shards.
func (ConcurrentMap) Count ¶
func (m ConcurrentMap) Count() int
Returns the number of elements within the map.
func (ConcurrentMap) Get ¶
func (m ConcurrentMap) Get(key string) (*mgo.Session, bool)
Retrieves an element from map under given key.
func (ConcurrentMap) GetShard ¶
func (m ConcurrentMap) GetShard(key string) *ConcurrentMapShared
Returns shard under given key
func (*ConcurrentMap) Has ¶
func (m *ConcurrentMap) Has(key string) bool
Looks up an item under specified key
func (ConcurrentMap) Iter ¶
func (m ConcurrentMap) Iter() <-chan Tuple
Returns an iterator which could be used in a for range loop.
func (ConcurrentMap) IterBuffered ¶
func (m ConcurrentMap) IterBuffered() <-chan Tuple
Returns a buffered iterator which could be used in a for range loop.
func (ConcurrentMap) MarshalJSON ¶
func (m ConcurrentMap) MarshalJSON() ([]byte, error)
Reviles ConcurrentMap "private" variables to json marshal.
func (*ConcurrentMap) Remove ¶
func (m *ConcurrentMap) Remove(key string)
Removes an element from the map.
func (*ConcurrentMap) Set ¶
func (m *ConcurrentMap) Set(key string, value *mgo.Session)
Sets the given value under the specified key.
func (*ConcurrentMap) UnmarshalJSON ¶
func (m *ConcurrentMap) UnmarshalJSON(b []byte) (err error)
type ConcurrentMapShared ¶
type ConcurrentMapShared struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.