MCPcopy Create free account
hub / github.com/apache/brpc / PackUbrpcRequest

Function PackUbrpcRequest

src/brpc/policy/ubrpc2pb_protocol.cpp:539–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537}
538
539void PackUbrpcRequest(butil::IOBuf* buf,
540 SocketMessage**,
541 uint64_t correlation_id,
542 const google::protobuf::MethodDescriptor*,
543 Controller* controller,
544 const butil::IOBuf& request,
545 const Authenticator* /*not supported*/) {
546 ControllerPrivateAccessor accessor(controller);
547 if (controller->connection_type() == CONNECTION_TYPE_SINGLE) {
548 return controller->SetFailed(
549 EINVAL, "ubrpc protocol can't work with CONNECTION_TYPE_SINGLE");
550 }
551 // Store `correlation_id' into Socket since ubrpc protocol doesn't
552 // contain this field
553 accessor.get_sending_socket()->set_correlation_id(correlation_id);
554
555 nshead_t nshead;
556 memset(&nshead, 0, sizeof(nshead_t));
557 nshead.log_id = controller->log_id();
558 nshead.magic_num = NSHEAD_MAGICNUM;
559 nshead.body_len = request.size();
560 nshead.version = UBRPC_NSHEAD_VERSION;
561 buf->append(&nshead, sizeof(nshead));
562
563 // Span* span = accessor.span();
564 // if (span) {
565 // request_meta->set_trace_id(span->trace_id());
566 // request_meta->set_span_id(span->span_id());
567 // request_meta->set_parent_span_id(span->parent_span_id());
568 // }
569 buf->append(request);
570}
571
572} // namespace policy
573} // namespace brpc

Callers

nothing calls this directly

Calls 7

connection_typeMethod · 0.80
set_correlation_idMethod · 0.80
get_sending_socketMethod · 0.80
SetFailedMethod · 0.45
log_idMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected