#ifndef CEPH_CLS_RGW_OPS_H #define CEPH_CLS_RGW_OPS_H #include #include "include/types.h" #include "cls/rgw/cls_rgw_types.h" struct rgw_cls_tag_timeout_op { uint64_t tag_timeout; rgw_cls_tag_timeout_op() : tag_timeout(0) {} void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); ::encode(tag_timeout, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); ::decode(tag_timeout, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(rgw_cls_tag_timeout_op) struct rgw_cls_obj_prepare_op { RGWModifyOp op; cls_rgw_obj_key key; string tag; string locator; bool log_op; rgw_cls_obj_prepare_op() : op(CLS_RGW_OP_UNKNOWN), log_op(false) {} void encode(bufferlist &bl) const { ENCODE_START(5, 5, bl); uint8_t c = (uint8_t)op; ::encode(c, bl); ::encode(tag, bl); ::encode(locator, bl); ::encode(log_op, bl); ::encode(key, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl); uint8_t c; ::decode(c, bl); op = (RGWModifyOp)c; if (struct_v < 5) { ::decode(key.name, bl); } ::decode(tag, bl); if (struct_v >= 2) { ::decode(locator, bl); } if (struct_v >= 4) { ::decode(log_op, bl); } if (struct_v >= 5) { ::decode(key, bl); } DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_obj_prepare_op) struct rgw_cls_obj_complete_op { RGWModifyOp op; cls_rgw_obj_key key; string locator; rgw_bucket_entry_ver ver; struct rgw_bucket_dir_entry_meta meta; string tag; bool log_op; list remove_objs; rgw_cls_obj_complete_op() : op(CLS_RGW_OP_ADD), log_op(false) {} void encode(bufferlist &bl) const { ENCODE_START(7, 7, bl); uint8_t c = (uint8_t)op; ::encode(c, bl); ::encode(ver.epoch, bl); ::encode(meta, bl); ::encode(tag, bl); ::encode(locator, bl); ::encode(remove_objs, bl); ::encode(ver, bl); ::encode(log_op, bl); ::encode(key, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(7, 3, 3, bl); uint8_t c; ::decode(c, bl); op = (RGWModifyOp)c; if (struct_v < 7) { ::decode(key.name, bl); } ::decode(ver.epoch, bl); ::decode(meta, bl); ::decode(tag, bl); if (struct_v >= 2) { ::decode(locator, bl); } if (struct_v >= 4 && struct_v < 7) { list old_remove_objs; ::decode(old_remove_objs, bl); for (list::iterator iter = old_remove_objs.begin(); iter != old_remove_objs.end(); ++iter) { cls_rgw_obj_key k; k.name = *iter; remove_objs.push_back(k); } } else { ::decode(remove_objs, bl); } if (struct_v >= 5) { ::decode(ver, bl); } else { ver.pool = -1; } if (struct_v >= 6) { ::decode(log_op, bl); } if (struct_v >= 7) { ::decode(key, bl); } DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_obj_complete_op) struct rgw_cls_link_olh_op { cls_rgw_obj_key key; bool delete_marker; string op_tag; rgw_cls_link_olh_op() : delete_marker(false) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(key, bl); ::encode(delete_marker, bl); ::encode(op_tag, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(key, bl); ::decode(delete_marker, bl); ::decode(op_tag, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; #warning implement me }; WRITE_CLASS_ENCODER(rgw_cls_link_olh_op) struct rgw_cls_read_olh_log_op { cls_rgw_obj_key olh; uint64_t ver_marker; rgw_cls_read_olh_log_op() : ver_marker(0) {} void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); ::encode(olh, bl); ::encode(ver_marker, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); ::decode(olh, bl); ::decode(ver_marker, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; #warning implement me }; WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_op) struct rgw_cls_read_olh_log_ret { map log; bool is_truncated; rgw_cls_read_olh_log_ret() : is_truncated(false) {} void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); ::encode(log, bl); ::encode(is_truncated, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); ::decode(log, bl); ::decode(is_truncated, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; #warning implement me }; WRITE_CLASS_ENCODER(rgw_cls_read_olh_log_ret) struct rgw_cls_trim_olh_log_op { cls_rgw_obj_key olh; uint64_t ver; rgw_cls_trim_olh_log_op() : ver(0) {} void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); ::encode(olh, bl); ::encode(ver, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); ::decode(olh, bl); ::decode(ver, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; #warning implement me }; WRITE_CLASS_ENCODER(rgw_cls_trim_olh_log_op) struct rgw_cls_list_op { cls_rgw_obj_key start_obj; uint32_t num_entries; string filter_prefix; rgw_cls_list_op() : num_entries(0) {} void encode(bufferlist &bl) const { ENCODE_START(4, 4, bl); ::encode(num_entries, bl); ::encode(filter_prefix, bl); ::encode(start_obj, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl); if (struct_v < 4) { ::decode(start_obj.name, bl); } ::decode(num_entries, bl); if (struct_v >= 3) ::decode(filter_prefix, bl); if (struct_v >= 4) ::decode(start_obj, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_list_op) struct rgw_cls_list_ret { rgw_bucket_dir dir; bool is_truncated; rgw_cls_list_ret() : is_truncated(false) {} void encode(bufferlist &bl) const { ENCODE_START(2, 2, bl); ::encode(dir, bl); ::encode(is_truncated, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); ::decode(dir, bl); ::decode(is_truncated, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_list_ret) struct rgw_cls_check_index_ret { rgw_bucket_dir_header existing_header; rgw_bucket_dir_header calculated_header; rgw_cls_check_index_ret() {} void encode(bufferlist &bl) const { ENCODE_START(1, 1, bl); ::encode(existing_header, bl); ::encode(calculated_header, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator &bl) { DECODE_START(1, bl); ::decode(existing_header, bl); ::decode(calculated_header, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_check_index_ret) struct rgw_cls_usage_log_add_op { rgw_usage_log_info info; void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(info, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(info, bl); DECODE_FINISH(bl); } }; WRITE_CLASS_ENCODER(rgw_cls_usage_log_add_op) struct rgw_cls_usage_log_read_op { uint64_t start_epoch; uint64_t end_epoch; string owner; string iter; // should be empty for the first call, non empty for subsequent calls uint32_t max_entries; void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(start_epoch, bl); ::encode(end_epoch, bl); ::encode(owner, bl); ::encode(iter, bl); ::encode(max_entries, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(start_epoch, bl); ::decode(end_epoch, bl); ::decode(owner, bl); ::decode(iter, bl); ::decode(max_entries, bl); DECODE_FINISH(bl); } }; WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_op) struct rgw_cls_usage_log_read_ret { map usage; bool truncated; string next_iter; void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(usage, bl); ::encode(truncated, bl); ::encode(next_iter, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(usage, bl); ::decode(truncated, bl); ::decode(next_iter, bl); DECODE_FINISH(bl); } }; WRITE_CLASS_ENCODER(rgw_cls_usage_log_read_ret) struct rgw_cls_usage_log_trim_op { uint64_t start_epoch; uint64_t end_epoch; string user; void encode(bufferlist& bl) const { ENCODE_START(2, 2, bl); ::encode(start_epoch, bl); ::encode(end_epoch, bl); ::encode(user, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(2, bl); ::decode(start_epoch, bl); ::decode(end_epoch, bl); ::decode(user, bl); DECODE_FINISH(bl); } }; WRITE_CLASS_ENCODER(rgw_cls_usage_log_trim_op) struct cls_rgw_gc_set_entry_op { uint32_t expiration_secs; cls_rgw_gc_obj_info info; cls_rgw_gc_set_entry_op() : expiration_secs(0) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(expiration_secs, bl); ::encode(info, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(expiration_secs, bl); ::decode(info, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_gc_set_entry_op) struct cls_rgw_gc_defer_entry_op { uint32_t expiration_secs; string tag; cls_rgw_gc_defer_entry_op() : expiration_secs(0) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(expiration_secs, bl); ::encode(tag, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(expiration_secs, bl); ::decode(tag, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_gc_defer_entry_op) struct cls_rgw_gc_list_op { string marker; uint32_t max; bool expired_only; cls_rgw_gc_list_op() : max(0), expired_only(true) {} void encode(bufferlist& bl) const { ENCODE_START(2, 1, bl); ::encode(marker, bl); ::encode(max, bl); ::encode(expired_only, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(2, bl); ::decode(marker, bl); ::decode(max, bl); if (struct_v >= 2) { ::decode(expired_only, bl); } DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_gc_list_op) struct cls_rgw_gc_list_ret { list entries; bool truncated; cls_rgw_gc_list_ret() : truncated(false) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(entries, bl); ::encode(truncated, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(entries, bl); ::decode(truncated, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_gc_list_ret) struct cls_rgw_gc_remove_op { list tags; cls_rgw_gc_remove_op() {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(tags, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(tags, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_gc_remove_op) struct cls_rgw_bi_log_list_op { string marker; uint32_t max; cls_rgw_bi_log_list_op() : max(0) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(marker, bl); ::encode(max, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(marker, bl); ::decode(max, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_op) struct cls_rgw_bi_log_trim_op { string start_marker; string end_marker; cls_rgw_bi_log_trim_op() {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(start_marker, bl); ::encode(end_marker, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(start_marker, bl); ::decode(end_marker, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_bi_log_trim_op) struct cls_rgw_bi_log_list_ret { list entries; bool truncated; cls_rgw_bi_log_list_ret() : truncated(false) {} void encode(bufferlist& bl) const { ENCODE_START(1, 1, bl); ::encode(entries, bl); ::encode(truncated, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { DECODE_START(1, bl); ::decode(entries, bl); ::decode(truncated, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; static void generate_test_instances(list& ls); }; WRITE_CLASS_ENCODER(cls_rgw_bi_log_list_ret) #endif