summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2016-06-13 16:58:05 -0400
committerBenety Goh <benety@mongodb.com>2016-06-14 18:33:50 -0400
commit0f744edcde0011533bc2d88b04581199cfee9070 (patch)
tree58145f4fd77e93f5fa3c2efb3ebd1f348b367da6 /src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
parentdbbad24bfbc6d391dffe5902977431d90201db3b (diff)
downloadmongo-0f744edcde0011533bc2d88b04581199cfee9070.tar.gz
SERVER-24560 replaced references to BlockingQueue in BackgroundSync with OplogBuffer
BackgroundSync now accepts an OplogBuffer at construction
Diffstat (limited to 'src/mongo/db/repl/oplog_buffer_blocking_queue.cpp')
-rw-r--r--src/mongo/db/repl/oplog_buffer_blocking_queue.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp b/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
index ffa01bfd2c4..ff575cae145 100644
--- a/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
+++ b/src/mongo/db/repl/oplog_buffer_blocking_queue.cpp
@@ -53,6 +53,14 @@ void OplogBufferBlockingQueue::shutdown() {
clear();
}
+void OplogBufferBlockingQueue::pushEvenIfFull(const Value& value) {
+ _queue.pushEvenIfFull(value);
+}
+
+void OplogBufferBlockingQueue::push(const Value& value) {
+ _queue.push(value);
+}
+
bool OplogBufferBlockingQueue::pushAllNonBlocking(Batch::const_iterator begin,
Batch::const_iterator end) {
_queue.pushAllNonBlocking(begin, end);
@@ -63,6 +71,14 @@ void OplogBufferBlockingQueue::waitForSpace(std::size_t size) {
_queue.waitForSpace(size);
}
+bool OplogBufferBlockingQueue::isEmpty() const {
+ return _queue.empty();
+}
+
+std::size_t OplogBufferBlockingQueue::getMaxSize() const {
+ return kOplogBufferSize;
+}
+
std::size_t OplogBufferBlockingQueue::getSize() const {
return _queue.size();
}
@@ -79,9 +95,21 @@ bool OplogBufferBlockingQueue::tryPop(Value* value) {
return _queue.tryPop(*value);
}
+OplogBuffer::Value OplogBufferBlockingQueue::blockingPop() {
+ return _queue.blockingPop();
+}
+
+bool OplogBufferBlockingQueue::blockingPeek(Value* value, Seconds waitDuration) {
+ return _queue.blockingPeek(*value, static_cast<int>(durationCount<Seconds>(waitDuration)));
+}
+
bool OplogBufferBlockingQueue::peek(Value* value) {
return _queue.peek(*value);
}
+boost::optional<OplogBuffer::Value> OplogBufferBlockingQueue::lastObjectPushed() const {
+ return _queue.lastObjectPushed();
+}
+
} // namespace repl
} // namespace mongo