156 bool operator<<(
const Bytes& bytes)
noexcept;
168 bool operator>>(Bytes& bytes)
const noexcept;
175 [[nodiscard]] uint32_t control_id()
const noexcept;
182 [[nodiscard]] uint32_t mode()
const noexcept;
189 [[nodiscard]] int64_t timestamp()
const noexcept;
196 [[nodiscard]] int64_t seq()
const noexcept;
203 [[nodiscard]] uint32_t schema()
const noexcept;
214 [[nodiscard]] Bytes raw()
const noexcept;
224 [[nodiscard]] std::string_view url()
const noexcept;
235 [[nodiscard]] std::string_view ser()
const noexcept;
246 [[nodiscard]] std::string_view hostname()
const noexcept;
253 void set_control_id(uint32_t control_id)
noexcept;
260 void set_mode(uint32_t mode)
noexcept;
267 void set_timestamp(int64_t timestamp)
noexcept;
274 void set_seq(int64_t seq)
noexcept;
281 void set_schema(uint32_t schema)
noexcept;
292 [[nodiscard]]
static bool check_valid(
const Bytes& bytes)
noexcept;
302 [[nodiscard]]
size_t get_serialized_size()
const noexcept;
314 [[nodiscard]]
bool is_valid()
const noexcept;
326 bool shallow_copy(
const ProxyData& target)
noexcept;
338 bool deep_copy(
const ProxyData& target)
noexcept;
349 bool move_copy(
ProxyData& target)
noexcept;
364 void create(
const Bytes& raw, std::string_view url, std::string_view ser, uint32_t schema = 0,
365 std::string_view hostname = {})
noexcept;
370 void clear()
noexcept;
381 [[nodiscard]]
size_t size()
const noexcept;
392 [[nodiscard]]
bool is_owner()
const noexcept;
394 static constexpr bool kZerocopyTypes{
true};
397 uint8_t* data_{
nullptr};
399 uint32_t control_id_{0};
401 int64_t timestamp_{0};
403 uint32_t data_pos_{0};
404 uint32_t data_size_{0};
405 uint32_t url_pos_{0};
406 uint32_t url_size_{0};
407 uint32_t ser_pos_{0};
408 uint32_t ser_size_{0};
409 uint32_t hostname_pos_{0};
410 uint32_t hostname_size_{0};
412 bool is_owner_{
false};
414 static constexpr uint32_t kMagicNumberBegin{0x98B7F12A};
415 static constexpr uint32_t kMagicNumberEnd{0x98B7F12F};
Versatile byte buffer with small-buffer optimisation, ownership semantics and compression.
#define VLINK_EXPORT_AND_ALIGNED(align_num)
Marks a class or variable as both exported and aligned to the given byte boundary.
定义 macros.h:103
Proxy routing envelope: raw payload bundled with URL, serialisation type, and hostname.