<
classValue>
51 template<
classOther>
71 classComparator = less<Key>,
108 typedef typenameAllocator::template rebind<SNode>::other
TNodeAlloc;
109 typedef typenameAllocator::template rebind<SLeafNode>::other
TLeafAlloc;
176ret_value =
x_Value(node, key_index);
298 if(key_ref && key_ref->
ref_cnt.
Add(-1) == 0)
309 if(!to_ref || to_ref->
ref_cnt.
Add(-1) != 0)
321 if(left_ref ==
NULL)
327 if(right_ref ==
NULL)
333 if(right_ref ==
NULL)
335 else if(left_ref ==
NULL)
346 return reinterpret_cast<SLeafNode*
>(node)->values[index];
357 while(low_bound != high_bound) {
358 unsigned intmid = (low_bound + high_bound) / 2;
368 if(key_ref !=
NULL)
372 while(index > 0 && node->
keys[index - 1] ==
NULL) {
383 while(index < kCntChildsInNode && node->status[index] ==
eValueDeleted);
405 size_tsz_ptrs = (right_index - ins_index) *
sizeof(
void*);
406 size_tsz_statuses = (right_index - ins_index) *
sizeof(
EValueStatus);
407 memmove(&node->
keys[ins_index + 1], &node->
keys[ins_index], sz_ptrs);
409node->
keys[ins_index] = key_ref;
412 for(
int i= right_index;
i> ins_index; --
i)
421ins_index = index - 1;
422 unsigned intleft_index = ins_index - 1;
428 size_tsz_ptrs = (ins_index - left_index) *
sizeof(
void*);
429 size_tsz_statuses = (ins_index - left_index) *
sizeof(
EValueStatus);
430 memmove(&node->
keys[left_index], &node->
keys[left_index + 1], sz_ptrs);
432node->
keys[ins_index] = key_ref;
435 for(
int i= left_index;
i< ins_index; ++
i)
448ins_index = index - 1;
466node->
keys[
i] = max_key;
509 for(
intnode_ind = 0; node_ind + 1 > 0; ) {
510 SNode* node = node_stack[node_ind];
522ind_in_node[node_ind] = ++child_ind;
524node_stack [node_ind] = child;
525ind_in_node[node_ind] = 0;
651 SNode* wait_child_value)
660|| node->
keys[index] != wait_key_ref
661|| node->
childs[index] != wait_child_value)
708value_ptr = &
x_Value(node, index);
742 boolsuccess =
false;
807 SNode* last_node = add_node;
810last_node->
childs[0] = next_node;
813last_node = next_node;
855ins_index = key_index;
861node->
childs[ins_index] = value_node;
872 const size_tsz_right_ptrs = (
kCntChildsInNode- left_cnt) *
sizeof(
void*);
874memcpy(&right_node->
keys[left_cnt], &node->
keys[left_cnt], sz_right_ptrs);
875memcpy(&right_node->
status[left_cnt], &node->
status[left_cnt], sz_right_stats);
883memcpy(&right_node->
childs[left_cnt], &node->
childs[left_cnt], sz_right_ptrs);
885memcpy(&node->
keys[left_cnt], &right_node->
keys[0], left_cnt *
sizeof(
void*));
890memset(&node->
childs[left_cnt],
NULL, sz_right_ptrs);
936&& node->
childs[right_index] == left_node);
937node->
childs[right_index] = right_node;
955call_ctx.
tree_path[new_height] = new_root;
956 while(call_ctx.
cur_level!= old_height + 1) {
965 "Concurrent map is too deep");
970call_ctx.
tree_path[new_height] = new_root;
void Delete(SNode *node) const
CFinalNodeDeleter(TTree *tree)
void x_ExchangeNodeLocks(SCallContext &call_ctx, SNode *node_to_lock) const
void x_FinalizeCallContext(SCallContext &call_ctx) const
CConcurrentMap & operator=(const CConcurrentMap &)
Allocator::template rebind< SLeafNode >::other TLeafAlloc
void x_UnlockCurNode(SCallContext &call_ctx) const
TNodeIndex x_GetNextIndex(SNode *node, TNodeIndex index) const
void x_AddRegularSplit(SCallContext &call_ctx)
CAtomicCounter m_CntNodes
bool x_IsKeyLess(const TKey &left_key, const TKey &right_key) const
bool x_EraseIf(const TKey &key, EValueStatus status)
bool PassivateKey(const TKey &key)
TValue & x_Value(SNode *node, TNodeIndex index) const
TTreeHeight GetTreeHeight(void) const
bool x_CreatePathToLeaf(SCallContext &call_ctx)
void x_GetRootAndHeight(SNode *&node, TTreeHeight &height, bool add_ref) const
CConcurrentMap(const CConcurrentMap &)
bool x_IsNodeToBeDeleted(SNode *node) const
SNode * x_LockCurNode(SCallContext &call_ctx, ERWLockType lock_type) const
TDeferredDeleter m_NodesDeleter
CAtomicCounter m_CntLeafNodes
TNodeIndex x_LockNodeAndWaitKey(SCallContext &call_ctx, SRefedKey *wait_key_ref, SNode *wait_child_value)
void x_AssignKeyRef(SRefedKey *&to_ref, SRefedKey *from_ref)
bool x_IsKeyLess(const SRefedKey *left_ref, const SRefedKey *right_ref) const
bool x_LockLeafNode(SCallContext &call_ctx, ERWLockType lock_type) const
bool x_IsKeyLess(const SRefedKey *left_ref, const TKey &right_key) const
bool x_DiveAndFindKey(SCallContext &call_ctx, ERWLockType leaf_lock_type, TNodeIndex &key_index) const
CAtomicCounter m_CntRootRefs
TNodeIndex x_FindContainingIndex(SNode *node, const TKey &key) const
void x_DeleteEmptyNodes(SCallContext &call_ctx)
void x_ScanForInsertSpace(SNode *node, TNodeIndex &index, TNodeIndex &ins_index)
void x_AssignKeyRef(SRefedKey *&to_ref, const TKey &key)
void x_CheckRootSplit(SCallContext &call_ctx)
@ eValuePassive
Must be 0.
TNodeIndex x_AddNodeKey(SCallContext &call_ctx, SNode *node, SRefedKey *key_ref, SNode *value_node)
bool x_SetValueStatus(const TKey &key, EValueStatus status)
void x_MoveOneLevelUp(SCallContext &call_ctx) const
friend class CFinalNodeDeleter
bool x_DiveAndCreateValue(SCallContext &call_ctx, const TValue &value, TNodeIndex &key_index, TValue *&value_ptr)
TNodeIndex x_FindKeyIndex(SNode *node, const SRefedKey *key_ref) const
bool ActivateKey(const TKey &key)
bool x_DiveToNextLevel(SCallContext &call_ctx) const
void x_DeleteNode(SNode *node)
void x_FindInsertSpace(SNode *node, TNodeIndex &index, TNodeIndex &ins_index)
Allocator::template rebind< SRefedKey >::other TRefedKeyAlloc
void Put(const TKey &key, const TValue &value)
void x_AddNewRoot(SCallContext &call_ctx)
void x_FinalDeleteNode(SNode *node)
Uint4 GetCntNodes(void) const
bool x_IsKeyLess(const TKey &left_key, const SRefedKey *right_ref) const
bool PutOrGet(const TKey &key, const TValue &value, EGetValueType get_type, TValue &ret_value)
void x_DeleteKey(SCallContext &call_ctx, TNodeIndex key_index)
Delete key from the tree.
Uint4 GetCntValues(void) const
Uint4 GetCntLeafNodes(void) const
TRefedKeyAlloc m_RefedKeyAlloc
bool x_CanShrinkTree(void) const
bool EraseIfPassive(const TKey &key)
void x_SplitNode(SCallContext &call_ctx, SNode *node)
bool x_DiveToLeafLevel(SCallContext &call_ctx) const
void x_InitializeCallContext(SCallContext &call_ctx) const
SNode * x_CreateNode(SRefedKey *max_key, TTreeHeight tree_level)
TNodeIndex x_FindKeyIndex(SNode *node, const TKey &key) const
void Clear(void)
Caller is responsible to not make this call concurrent with any other method call (the same as callin...
CConcurrentMap< TKey, TValue, TComparator, TKeyAlloc, kCntChildsInNode, kMaxTreeHeight, kDeletionDelay, kDelStoreCapacity > TTree
bool x_IsKeyFound(SNode *node, const TKey &key, TNodeIndex index) const
void x_PropagateSplit(SCallContext &call_ctx)
bool Get(const TKey &key, TValue &value) const
void x_ChangeRoot(SNode *new_root, TTreeHeight new_height)
Allocator::template rebind< SNode >::other TNodeAlloc
void x_AddKeyRef(SRefedKey *key_ref, Uint4 cnt_ref=1)
CNCDeferredDeleter< SNode *, CFinalNodeDeleter, kDeletionDelay, kDelStoreCapacity > TDeferredDeleter
void x_DerefKey(SRefedKey *key_ref)
map< TKey, TValue, TComparator > TMap
void x_MoveOneLevelDown(SCallContext &call_ctx, TNodeIndex index) const
CAtomicCounter m_CntValues
TValue * x_InsertLeafValue(SCallContext &call_ctx, SNode *node, TNodeIndex key_index, const TValue &value)
bool Erase(const TKey &key)
Concept for allocating, resizing and freeing memory block.
void Set(TValue new_value) THROWS_NONE
Set atomic counter value.
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
TValue Get(void) const THROWS_NONE
Get atomic counter value.
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
static void DiagTrouble(const CDiagCompileInfo &info, const char *message=NULL)
Display trouble error message.
uint8_t Uint1
1-byte (8-bit) unsigned integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define NCBI_SCHED_YIELD()
ERWLockType
Type of locking provided by CYieldingRWLock.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Multi-threading â atomic pointer exchange function.
#define NCBI_PACKED_ENUM_END()
#define NCBI_PACKED_ENUM_TYPE(type)
SNode * tree_path[kMaxTreeHeight+1]
SCallContext(const TKey &key)
TValue values[kCntChildsInNode]
SRefedKey * keys[kCntChildsInNode]
EValueStatus status[kCntChildsInNode]
SNode * childs[kCntChildsInNode]
SConstructAllocator< Other > other
static Value * allocate(void)
static void deallocate(Value *value)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4