forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ydb-platform#11014 from uzhastik/24_3_merge_14
24 3 merge 14
- Loading branch information
Showing
47 changed files
with
3,399 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
#include <util/generic/queue.h> | ||
#include <util/generic/yexception.h> | ||
#include <util/system/types.h> | ||
|
||
namespace NKikimr::NGRpcService { | ||
|
||
class TRpcFlowControlState { | ||
public: | ||
TRpcFlowControlState(ui64 inflightLimitBytes) | ||
: InflightLimitBytes_(inflightLimitBytes) {} | ||
|
||
void PushResponse(ui64 responseSizeBytes) { | ||
ResponseSizeQueue_.push(responseSizeBytes); | ||
TotalResponsesSize_ += responseSizeBytes; | ||
} | ||
|
||
void PopResponse() { | ||
Y_ENSURE(!ResponseSizeQueue_.empty()); | ||
TotalResponsesSize_ -= ResponseSizeQueue_.front(); | ||
ResponseSizeQueue_.pop(); | ||
} | ||
|
||
size_t QueueSize() const { | ||
return ResponseSizeQueue_.size(); | ||
} | ||
|
||
i64 FreeSpaceBytes() const { // Negative value temporarily stops data evaluation in DQ graph | ||
return static_cast<i64>(InflightLimitBytes_) - static_cast<i64>(TotalResponsesSize_); | ||
} | ||
|
||
ui64 InflightBytes() const { | ||
return TotalResponsesSize_; | ||
} | ||
|
||
ui64 InflightLimitBytes() const { | ||
return InflightLimitBytes_; | ||
} | ||
|
||
private: | ||
const ui64 InflightLimitBytes_; | ||
|
||
TQueue<ui64> ResponseSizeQueue_; | ||
ui64 TotalResponsesSize_ = 0; | ||
}; | ||
|
||
} // namespace NKikimr::NGRpcService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.