/* */ #include "RequestSlot.h" #include "Util.h" RequestSlot::RequestSlot(int32_t index, int32_t begin, uint32_t length, int32_t blockIndex) :index(index), begin(begin), length(length), blockIndex(blockIndex) {} RequestSlot::RequestSlot(const RequestSlot& requestSlot) { copy(requestSlot); } void RequestSlot::copy(const RequestSlot& requestSlot) { index = requestSlot.index; begin = requestSlot.begin; length = requestSlot.length; blockIndex = requestSlot.blockIndex; dispatchedTime = requestSlot.dispatchedTime; } RequestSlot RequestSlot::nullSlot(0, 0, 0, 0); void RequestSlot::setDispatchedTime() { dispatchedTime.reset(); } void RequestSlot::setDispatchedTime(time_t secFromEpoch) { dispatchedTime.setTimeInSec(secFromEpoch); } bool RequestSlot::isTimeout(time_t timeoutSec) const { return dispatchedTime.elapsed(timeoutSec); } int RequestSlot::getLatencyInMillis() const { return dispatchedTime.differenceInMillis(); } bool RequestSlot::isNull(const RequestSlot& requestSlot) { return requestSlot.index == 0 && requestSlot.begin == 0&& requestSlot.length == 0; }