Spicy-cream commented on code in PR #3535:
URL: https://github.com/apache/brpc/pull/3535#discussion_r4374840914
##########
src/brpc/ubshm_transport.cpp:
##########
@@ -64,26 +72,58 @@ int UBShmTransport::Reset(int32_t expected_nref) {
}
std::shared_ptr<AppConnect> UBShmTransport::Connect() {
- if (_default_connect == nullptr) {
- return std::make_shared<ubring::UBConnect>();
- }
return _default_connect;
}
-int UBShmTransport::CutFromIOBuf(butil::IOBuf *buf) {
- if (_ub_ep && _ub_state != UB_OFF) {
- butil::IOBuf *data_arr[1] = {buf};
- return _ub_ep->CutFromIOBufList(data_arr, 1);
- } else {
- return _tcp_transport->CutFromIOBuf(buf);
+void UBShmTransport::SetHighSpeedAvailable(bool available) {
+ _ub_state = available ? UB_ON : UB_OFF;
+}
+
+int UBShmTransport::PrepareUpgradeResources(ubring::SHM *local_trx_shm,
+ const char *shm_name) {
+ return _ub_ep->AllocateClientResources(local_trx_shm, shm_name);
+}
+
+int UBShmTransport::NegotiateUpgradeResources(ubring::SHM *local_trx_shm,
+ const char *shm_name,
+ uint64_t remote_shm_len,
+ ubring::UbrDataFormat format) {
+ return _ub_ep->_ub_ring->UbrMapRemoteShm(
+ local_trx_shm, shm_name, remote_shm_len, format);
+}
+
+int UBShmTransport::PrepareServerUpgradeResources(ubring::SHM *remote_trx_shm,
+ ubring::SHM *local_trx_shm,
+ ubring::UbrDataFormat
format) {
+ return _ub_ep->AllocateServerResources(
+ remote_trx_shm, local_trx_shm, format);
+}
+
+void UBShmTransport::ActivateUpgrade() {
+ SetHighSpeedAvailable(true);
+}
+
+void UBShmTransport::DeactivateUpgrade() {
+ SetHighSpeedAvailable(false);
+ if (_ub_ep != nullptr) {
+ _ub_ep->Reset();
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]