38 # include <dsn/service_api_c.h> 39 # include <dsn/cpp/blob.h> 40 # include <dsn/cpp/auto_codes.h> 48 class rpc_read_stream;
49 class rpc_write_stream;
50 typedef ::dsn::ref_ptr<rpc_read_stream> rpc_read_stream_ptr;
51 typedef ::dsn::ref_ptr<rpc_write_stream> rpc_write_stream_ptr;
67 void set_read_msg(dsn_message_t msg)
74 dassert(r,
"read msg must have one segment of buffer ready");
76 blob bb((
const char*)ptr, 0, (
int)size);
98 _last_write_next_committed =
true;
99 _last_write_next_total_size = 0;
106 _last_write_next_committed =
true;
107 _last_write_next_total_size = 0;
118 if (!_last_write_next_committed)
121 _last_write_next_committed =
true;
131 virtual void create_new_buffer(
size_t size, blob& bb)
override 138 dbg_dassert(sz >= size,
"allocated buffer size must be not less than the required size");
139 bb.assign((
const char*)ptr, 0, (
int)sz);
141 _last_write_next_total_size = total_size();
142 _last_write_next_committed =
false;
146 bool _last_write_next_committed;
147 int _last_write_next_total_size;
DSN_API bool dsn_msg_read_next(dsn_message_t msg, void **ptr, size_t *size)
get message read buffer
Definition: auto_codes.h:55
Definition: auto_codes.h:174
Definition: rpc_stream.h:89
DSN_API void dsn_msg_write_commit(dsn_message_t msg, size_t size)
commit the write buffer after the message content is written with the real written size ...
DSN_API void dsn_msg_read_commit(dsn_message_t msg, size_t size)
commit the read buffer after the message content is read with the real read size, it is possible to u...
DSN_API dsn_message_t dsn_msg_create_request(dsn_task_code_t rpc_code, int timeout_milliseconds DEFAULT(0), uint64_t hash DEFAULT(0))
create a rpc request message
Definition: rpc_stream.h:53
DSN_API void dsn_msg_write_next(dsn_message_t msg, void **ptr, size_t *size, size_t min_size)
get message write buffer