MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / insert

Method insert

src/storage/buffer_manager/buffer_manager.cpp:38–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36namespace storage {
37
38bool EvictionQueue::insert(uint32_t fileIndex, page_idx_t pageIndex) {
39 EvictionCandidate candidate{fileIndex, pageIndex};
40 while (size < capacity) {
41 // Weak is fine since spurious failure is acceptable.
42 // The slot can always be filled later.
43 auto emptyCandidate = EMPTY;
44 if (data[insertCursor.fetch_add(1, std::memory_order_relaxed) % capacity]
45 .compare_exchange_weak(emptyCandidate, candidate)) {
46 size++;
47 return true;
48 }
49 }
50 return false;
51}
52
53std::span<std::atomic<EvictionCandidate>, EvictionQueue::BATCH_SIZE> EvictionQueue::next() {
54 return std::span<std::atomic<EvictionCandidate>, BATCH_SIZE>(

Callers 2

pinMethod · 0.45
addUnusedChunkMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected