move assignment operators for folly::Synchronized
[folly.git] / folly / io / IOBufQueue.h
index a9065a486842d9e964252743dcd89b94c54863fb..71966f49cb1819f5cc332cf9b4e8a4253bfa4c27 100644 (file)
@@ -204,6 +204,13 @@ class IOBufQueue {
     return head_.get();
   }
 
+  /**
+   * returns the first IOBuf in the chain and removes it from the chain
+   *
+   * @return first IOBuf in the chain or nullptr if none.
+   */
+  std::unique_ptr<folly::IOBuf> pop_front();
+
   /**
    * Total chain length, only valid if cacheLength was specified in the
    * constructor.
@@ -215,10 +222,24 @@ class IOBufQueue {
     return chainLength_;
   }
 
+  /**
+   * Returns true iff the IOBuf chain length is 0.
+   */
+  bool empty() const {
+    return !head_ || head_->empty();
+  }
+
   const Options& options() const {
     return options_;
   }
 
+  /**
+   * Clear the queue.  Note that this does not release the buffers, it
+   * just sets their length to zero; useful if you want to reuse the
+   * same queue without reallocating.
+   */
+  void clear();
+
   /** Movable */
   IOBufQueue(IOBufQueue&&);
   IOBufQueue& operator=(IOBufQueue&&);