|
Squid Web Cache master
|
a shareable set of positive uint32_t IDs with O(1) insertion/removal ops More...
#include <PageStack.h>
Public Types | |
| using | size_type = IdSetMeasurements::size_type |
| using | Position = IdSetPosition |
| using | NavigationDirection = IdSetNavigationDirection |
Public Member Functions | |
| IdSet (size_type capacity) | |
| void | makeFullBeforeSharing () |
| bool | pop (size_type &id) |
| void | push (size_type id) |
makes id value available to future pop() callers | |
Static Public Member Functions | |
| static size_t | MemorySize (size_type capacity) |
| memory size required to store a tree with the given capacity | |
Public Attributes | |
| const IdSetMeasurements | measurements |
Private Types | |
| typedef uint64_t | Node |
| either leaf or intermediate node | |
| typedef std::atomic< Node > | StoredNode |
| a Node stored in shared memory | |
Private Member Functions | |
| void | fillAllNodes () |
| void | truncateExtras () |
| effectively removes IDs that exceed the requested capacity after makeFull() | |
| Node * | valueAddress (Position) |
| size_type | innerTruncate (Position pos, NavigationDirection dir, size_type toSubtract) |
| void | leafTruncate (Position pos, size_type idsToKeep) |
| fill the leaf node at a given position with 0s, leaving only idsToKeep IDs | |
| void | innerPush (Position, NavigationDirection) |
| accounts for an ID added to subtree in the given dir from the given position | |
| NavigationDirection | innerPop (Position) |
| void | leafPush (Position, size_type id) |
| adds the given ID to the leaf node at the given position | |
| size_type | leafPop (Position) |
| extracts and returns an ID from the leaf node at the given position | |
| Position | ascend (Position) |
| Position | descend (Position, NavigationDirection) |
| StoredNode & | nodeAt (Position) |
Private Attributes | |
| FlexibleArray< StoredNode > | nodes_ |
| the entire binary tree flattened into an array | |
Definition at line 53 of file PageStack.h.
Definition at line 58 of file PageStack.h.
|
private |
Definition at line 79 of file PageStack.h.
Definition at line 57 of file PageStack.h.
Definition at line 56 of file PageStack.h.
|
private |
Definition at line 80 of file PageStack.h.
|
explicit |
Definition at line 152 of file PageStack.cc.
References assert.
|
private |
Definition at line 336 of file PageStack.cc.
References assert, Ipc::Mem::IdSetPosition::level, and Ipc::Mem::IdSetPosition::offset.
|
private |
Definition at line 347 of file PageStack.cc.
References assert, Ipc::Mem::dirLeft, Ipc::Mem::dirRight, Ipc::Mem::IdSetPosition::level, and Ipc::Mem::IdSetPosition::offset.
|
private |
populates the entire allocated tree with available IDs may exceed the requested capacity;
Definition at line 176 of file PageStack.cc.
References Ipc::Mem::BitsPerLeaf, and Ipc::Mem::IdSetInnerNode::pack().
|
private |
accounts for future ID removal from a subtree of the given position
Definition at line 270 of file PageStack.cc.
References assert, Ipc::Mem::dirEnd, Ipc::Mem::dirLeft, Ipc::Mem::dirNone, Ipc::Mem::dirRight, Ipc::Mem::IdSetInnerNode::left, Ipc::Mem::IdSetInnerNode::pack(), Ipc::Mem::IdSetInnerNode::right, and Ipc::Mem::IdSetInnerNode::Unpack().
|
private |
Definition at line 258 of file PageStack.cc.
References assert, Ipc::Mem::dirLeft, Ipc::Mem::dirRight, and Ipc::Mem::IdSetInnerNode::pack().
|
private |
accounts for toSubtract IDs removal from a subtree in the given direction of the given position
Definition at line 235 of file PageStack.cc.
References assert, Ipc::Mem::dirLeft, Ipc::Mem::dirRight, and Ipc::Mem::IdSetInnerNode::Unpack().
|
private |
Definition at line 320 of file PageStack.cc.
References assert, Ipc::Mem::BitsPerLeaf, Ipc::Mem::IdSetPosition::offset, and trailingZeros().
Definition at line 296 of file PageStack.cc.
References assert, and Ipc::Mem::BitsPerLeaf.
Definition at line 222 of file PageStack.cc.
References assert, and Ipc::Mem::BitsPerLeaf.
| void Ipc::Mem::IdSet::makeFullBeforeSharing | ( | ) |
populates the allocated tree with the requested capacity IDs optimized to run without atomic protection
Definition at line 163 of file PageStack.cc.
References Ipc::Mem::BitsPerLeaf.
Referenced by Ipc::Mem::PageStack::PageStack().
Definition at line 419 of file PageStack.cc.
References Ipc::Mem::IdSetMeasurements::nodeCount().
Referenced by Ipc::Mem::PageStack::StackSize().
|
private |
Definition at line 363 of file PageStack.cc.
References assert, Ipc::Mem::IdSetPosition::atRoot(), Ipc::Mem::IdSetPosition::level, and Ipc::Mem::IdSetPosition::offset.
| bool Ipc::Mem::IdSet::pop | ( | size_type & | id | ) |
finds/extracts (into the given id) an ID value and returns true
| false | no IDs are left |
Definition at line 387 of file PageStack.cc.
References Ipc::Mem::dirEnd.
| void Ipc::Mem::IdSet::push | ( | size_type | id | ) |
Definition at line 405 of file PageStack.cc.
References Ipc::Mem::BitsPerLeaf.
|
private |
Definition at line 197 of file PageStack.cc.
References Ipc::Mem::BitsPerLeaf.
|
private |
Definition at line 380 of file PageStack.cc.
| const IdSetMeasurements Ipc::Mem::IdSet::measurements |
Definition at line 76 of file PageStack.h.
|
private |
Definition at line 101 of file PageStack.h.