From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/cls/2pc_queue/cls_2pc_queue_ops.h | 117 ++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 src/cls/2pc_queue/cls_2pc_queue_ops.h (limited to 'src/cls/2pc_queue/cls_2pc_queue_ops.h') diff --git a/src/cls/2pc_queue/cls_2pc_queue_ops.h b/src/cls/2pc_queue/cls_2pc_queue_ops.h new file mode 100644 index 000000000..d0b84193d --- /dev/null +++ b/src/cls/2pc_queue/cls_2pc_queue_ops.h @@ -0,0 +1,117 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#pragma once + +#include "include/types.h" +#include "cls_2pc_queue_types.h" + +struct cls_2pc_queue_reserve_op { + uint64_t size; + uint32_t entries; + + void encode(ceph::buffer::list& bl) const { + ENCODE_START(1, 1, bl); + encode(size, bl); + encode(entries, bl); + ENCODE_FINISH(bl); + } + + void decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(1, bl); + decode(size, bl); + decode(entries, bl); + DECODE_FINISH(bl); + } +}; +WRITE_CLASS_ENCODER(cls_2pc_queue_reserve_op) + +struct cls_2pc_queue_reserve_ret { + cls_2pc_reservation::id_t id; // allocated reservation id + + void encode(ceph::buffer::list& bl) const { + ENCODE_START(1, 1, bl); + encode(id, bl); + ENCODE_FINISH(bl); + } + + void decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(1, bl); + decode(id, bl); + DECODE_FINISH(bl); + } +}; +WRITE_CLASS_ENCODER(cls_2pc_queue_reserve_ret) + +struct cls_2pc_queue_commit_op { + cls_2pc_reservation::id_t id; // reservation to commit + std::vector bl_data_vec; // the data to enqueue + + void encode(ceph::buffer::list& bl) const { + ENCODE_START(1, 1, bl); + encode(id, bl); + encode(bl_data_vec, bl); + ENCODE_FINISH(bl); + } + + void decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(1, bl); + decode(id, bl); + decode(bl_data_vec, bl); + DECODE_FINISH(bl); + } + +}; +WRITE_CLASS_ENCODER(cls_2pc_queue_commit_op) + +struct cls_2pc_queue_abort_op { + cls_2pc_reservation::id_t id; // reservation to abort + + void encode(ceph::buffer::list& bl) const { + ENCODE_START(1, 1, bl); + encode(id, bl); + ENCODE_FINISH(bl); + } + + void decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(1, bl); + decode(id, bl); + DECODE_FINISH(bl); + } +}; +WRITE_CLASS_ENCODER(cls_2pc_queue_abort_op) + +struct cls_2pc_queue_expire_op { + // any reservation older than this time should expire + ceph::coarse_real_time stale_time; + + void encode(ceph::buffer::list& bl) const { + ENCODE_START(1, 1, bl); + encode(stale_time, bl); + ENCODE_FINISH(bl); + } + + void decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(1, bl); + decode(stale_time, bl); + DECODE_FINISH(bl); + } +}; +WRITE_CLASS_ENCODER(cls_2pc_queue_expire_op) + +struct cls_2pc_queue_reservations_ret { + cls_2pc_reservations reservations; // reservation list (keyed by id) + + void encode(ceph::buffer::list& bl) const { + ENCODE_START(1, 1, bl); + encode(reservations, bl); + ENCODE_FINISH(bl); + } + + void decode(ceph::buffer::list::const_iterator& bl) { + DECODE_START(1, bl); + decode(reservations, bl); + DECODE_FINISH(bl); + } +}; +WRITE_CLASS_ENCODER(cls_2pc_queue_reservations_ret) -- cgit v1.2.3