refactor: remove LimitedQueueSnapshot (#6606)
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "messages/LimitedQueueSnapshot.hpp"
|
||||
|
||||
#include <boost/circular_buffer.hpp>
|
||||
|
||||
#include <cassert>
|
||||
@@ -318,22 +316,28 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
[[nodiscard]] LimitedQueueSnapshot<T> getSnapshot() const
|
||||
[[nodiscard]] std::vector<T> getSnapshot() const
|
||||
{
|
||||
std::shared_lock lock(this->mutex_);
|
||||
return LimitedQueueSnapshot<T>(this->buffer_);
|
||||
return {this->buffer_.begin(), this->buffer_.end()};
|
||||
}
|
||||
|
||||
[[nodiscard]] LimitedQueueSnapshot<T> lastN(size_t nItems) const
|
||||
[[nodiscard]] std::vector<T> lastN(size_t nItems) const
|
||||
{
|
||||
std::shared_lock lock(this->mutex_);
|
||||
return LimitedQueueSnapshot<T>::lastN(this->buffer_, nItems);
|
||||
return {
|
||||
this->buffer_.end() - std::min(nItems, this->buffer_.size()),
|
||||
this->buffer_.end(),
|
||||
};
|
||||
}
|
||||
|
||||
[[nodiscard]] LimitedQueueSnapshot<T> firstN(size_t nItems) const
|
||||
[[nodiscard]] std::vector<T> firstN(size_t nItems) const
|
||||
{
|
||||
std::shared_lock lock(this->mutex_);
|
||||
return LimitedQueueSnapshot<T>::firstN(this->buffer_, nItems);
|
||||
return {
|
||||
this->buffer_.begin(),
|
||||
this->buffer_.begin() + std::min(nItems, this->buffer_.size()),
|
||||
};
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
||||
Reference in New Issue
Block a user