1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
14 #include "common/ceph_json.h"
15 #include "common/strtol.h"
18 #include "rgw_rest_s3.h"
19 #include "rgw_rest_log.h"
20 #include "rgw_client_io.h"
22 #include "rgw_data_sync.h"
23 #include "rgw_common.h"
24 #include "common/errno.h"
25 #include "include/assert.h"
27 #define dout_context g_ceph_context
28 #define LOG_CLASS_LIST_MAX_ENTRIES (1000)
29 #define dout_subsys ceph_subsys_rgw
31 static int parse_date_str(string
& in
, real_time
& out
) {
36 if (utime_t::parse_date(in
, &epoch
, &nsec
) < 0) {
37 dout(5) << "Error parsing date " << in
<< dendl
;
41 out
= utime_t(epoch
, nsec
).to_real_time();
45 void RGWOp_MDLog_List::execute() {
46 string period
= s
->info
.args
.get("period");
47 string shard
= s
->info
.args
.get("id");
48 string max_entries_str
= s
->info
.args
.get("max-entries");
49 string st
= s
->info
.args
.get("start-time"),
50 et
= s
->info
.args
.get("end-time"),
51 marker
= s
->info
.args
.get("marker"),
56 unsigned shard_id
, max_entries
= LOG_CLASS_LIST_MAX_ENTRIES
;
58 shard_id
= (unsigned)strict_strtol(shard
.c_str(), 10, &err
);
60 dout(5) << "Error parsing shard_id " << shard
<< dendl
;
65 if (parse_date_str(st
, ut_st
) < 0) {
70 if (parse_date_str(et
, ut_et
) < 0) {
75 if (!max_entries_str
.empty()) {
76 max_entries
= (unsigned)strict_strtol(max_entries_str
.c_str(), 10, &err
);
78 dout(5) << "Error parsing max-entries " << max_entries_str
<< dendl
;
85 ldout(s
->cct
, 5) << "Missing period id trying to use current" << dendl
;
86 period
= store
->get_current_period_id();
88 ldout(s
->cct
, 5) << "Missing period id" << dendl
;
94 RGWMetadataLog meta_log
{s
->cct
, store
, period
};
96 meta_log
.init_list_entries(shard_id
, ut_st
, ut_et
, marker
, &handle
);
99 http_ret
= meta_log
.list_entries(handle
, max_entries
, entries
,
100 &last_marker
, &truncated
);
104 if (!max_entries_str
.empty())
105 max_entries
-= entries
.size();
106 } while (truncated
&& (max_entries
> 0));
108 meta_log
.complete_list_entries(handle
);
111 void RGWOp_MDLog_List::send_response() {
112 set_req_state_err(s
, http_ret
);
119 s
->formatter
->open_object_section("log_entries");
120 s
->formatter
->dump_string("marker", last_marker
);
121 s
->formatter
->dump_bool("truncated", truncated
);
123 s
->formatter
->open_array_section("entries");
124 for (list
<cls_log_entry
>::iterator iter
= entries
.begin();
125 iter
!= entries
.end(); ++iter
) {
126 cls_log_entry
& entry
= *iter
;
127 store
->meta_mgr
->dump_log_entry(entry
, s
->formatter
);
130 s
->formatter
->close_section();
132 s
->formatter
->close_section();
136 void RGWOp_MDLog_Info::execute() {
137 num_objects
= s
->cct
->_conf
->rgw_md_log_max_shards
;
138 period
= store
->meta_mgr
->read_oldest_log_period();
139 http_ret
= period
.get_error();
142 void RGWOp_MDLog_Info::send_response() {
143 set_req_state_err(s
, http_ret
);
147 s
->formatter
->open_object_section("mdlog");
148 s
->formatter
->dump_unsigned("num_objects", num_objects
);
150 s
->formatter
->dump_string("period", period
.get_period().get_id());
151 s
->formatter
->dump_unsigned("realm_epoch", period
.get_epoch());
153 s
->formatter
->close_section();
157 void RGWOp_MDLog_ShardInfo::execute() {
158 string period
= s
->info
.args
.get("period");
159 string shard
= s
->info
.args
.get("id");
162 unsigned shard_id
= (unsigned)strict_strtol(shard
.c_str(), 10, &err
);
164 dout(5) << "Error parsing shard_id " << shard
<< dendl
;
169 if (period
.empty()) {
170 ldout(s
->cct
, 5) << "Missing period id trying to use current" << dendl
;
171 period
= store
->get_current_period_id();
173 if (period
.empty()) {
174 ldout(s
->cct
, 5) << "Missing period id" << dendl
;
179 RGWMetadataLog meta_log
{s
->cct
, store
, period
};
181 http_ret
= meta_log
.get_info(shard_id
, &info
);
184 void RGWOp_MDLog_ShardInfo::send_response() {
185 set_req_state_err(s
, http_ret
);
189 encode_json("info", info
, s
->formatter
);
193 void RGWOp_MDLog_Delete::execute() {
194 string st
= s
->info
.args
.get("start-time"),
195 et
= s
->info
.args
.get("end-time"),
196 start_marker
= s
->info
.args
.get("start-marker"),
197 end_marker
= s
->info
.args
.get("end-marker"),
198 period
= s
->info
.args
.get("period"),
199 shard
= s
->info
.args
.get("id"),
207 shard_id
= (unsigned)strict_strtol(shard
.c_str(), 10, &err
);
209 dout(5) << "Error parsing shard_id " << shard
<< dendl
;
213 if (et
.empty() && end_marker
.empty()) { /* bounding end */
218 if (parse_date_str(st
, ut_st
) < 0) {
223 if (parse_date_str(et
, ut_et
) < 0) {
228 if (period
.empty()) {
229 ldout(s
->cct
, 5) << "Missing period id trying to use current" << dendl
;
230 period
= store
->get_current_period_id();
232 if (period
.empty()) {
233 ldout(s
->cct
, 5) << "Missing period id" << dendl
;
238 RGWMetadataLog meta_log
{s
->cct
, store
, period
};
240 http_ret
= meta_log
.trim(shard_id
, ut_st
, ut_et
, start_marker
, end_marker
);
243 void RGWOp_MDLog_Lock::execute() {
244 string period
, shard_id_str
, duration_str
, locker_id
, zone_id
;
249 period
= s
->info
.args
.get("period");
250 shard_id_str
= s
->info
.args
.get("id");
251 duration_str
= s
->info
.args
.get("length");
252 locker_id
= s
->info
.args
.get("locker-id");
253 zone_id
= s
->info
.args
.get("zone-id");
255 if (period
.empty()) {
256 ldout(s
->cct
, 5) << "Missing period id trying to use current" << dendl
;
257 period
= store
->get_current_period_id();
260 if (period
.empty() ||
261 shard_id_str
.empty() ||
262 (duration_str
.empty()) ||
265 dout(5) << "Error invalid parameter list" << dendl
;
271 shard_id
= (unsigned)strict_strtol(shard_id_str
.c_str(), 10, &err
);
273 dout(5) << "Error parsing shard_id param " << shard_id_str
<< dendl
;
278 RGWMetadataLog meta_log
{s
->cct
, store
, period
};
280 dur
= (unsigned)strict_strtol(duration_str
.c_str(), 10, &err
);
281 if (!err
.empty() || dur
<= 0) {
282 dout(5) << "invalid length param " << duration_str
<< dendl
;
286 http_ret
= meta_log
.lock_exclusive(shard_id
, make_timespan(dur
), zone_id
,
288 if (http_ret
== -EBUSY
)
289 http_ret
= -ERR_LOCKED
;
292 void RGWOp_MDLog_Unlock::execute() {
293 string period
, shard_id_str
, locker_id
, zone_id
;
298 period
= s
->info
.args
.get("period");
299 shard_id_str
= s
->info
.args
.get("id");
300 locker_id
= s
->info
.args
.get("locker-id");
301 zone_id
= s
->info
.args
.get("zone-id");
303 if (period
.empty()) {
304 ldout(s
->cct
, 5) << "Missing period id trying to use current" << dendl
;
305 period
= store
->get_current_period_id();
308 if (period
.empty() ||
309 shard_id_str
.empty() ||
312 dout(5) << "Error invalid parameter list" << dendl
;
318 shard_id
= (unsigned)strict_strtol(shard_id_str
.c_str(), 10, &err
);
320 dout(5) << "Error parsing shard_id param " << shard_id_str
<< dendl
;
325 RGWMetadataLog meta_log
{s
->cct
, store
, period
};
326 http_ret
= meta_log
.unlock(shard_id
, zone_id
, locker_id
);
329 void RGWOp_MDLog_Notify::execute() {
332 #define LARGE_ENOUGH_BUF (128 * 1024)
333 int r
= rgw_rest_read_all_input(s
, &data
, &len
, LARGE_ENOUGH_BUF
);
339 ldout(s
->cct
, 20) << __func__
<< "(): read data: " << string(data
, len
) << dendl
;
342 r
= p
.parse(data
, len
);
345 ldout(s
->cct
, 0) << "ERROR: failed to parse JSON" << dendl
;
350 set
<int> updated_shards
;
352 decode_json_obj(updated_shards
, &p
);
353 } catch (JSONDecoder::err
& err
) {
354 ldout(s
->cct
, 0) << "ERROR: failed to decode JSON" << dendl
;
359 if (store
->ctx()->_conf
->subsys
.should_gather(ceph_subsys_rgw
, 20)) {
360 for (set
<int>::iterator iter
= updated_shards
.begin(); iter
!= updated_shards
.end(); ++iter
) {
361 ldout(s
->cct
, 20) << __func__
<< "(): updated shard=" << *iter
<< dendl
;
365 store
->wakeup_meta_sync_shards(updated_shards
);
370 void RGWOp_BILog_List::execute() {
371 string tenant_name
= s
->info
.args
.get("tenant"),
372 bucket_name
= s
->info
.args
.get("bucket"),
373 marker
= s
->info
.args
.get("marker"),
374 max_entries_str
= s
->info
.args
.get("max-entries"),
375 bucket_instance
= s
->info
.args
.get("bucket-instance");
376 RGWBucketInfo bucket_info
;
377 unsigned max_entries
;
379 RGWObjectCtx
& obj_ctx
= *static_cast<RGWObjectCtx
*>(s
->obj_ctx
);
381 if (bucket_name
.empty() && bucket_instance
.empty()) {
382 dout(5) << "ERROR: neither bucket nor bucket instance specified" << dendl
;
388 http_ret
= rgw_bucket_parse_bucket_instance(bucket_instance
, &bucket_instance
, &shard_id
);
393 if (!bucket_instance
.empty()) {
394 http_ret
= store
->get_bucket_instance_info(obj_ctx
, bucket_instance
, bucket_info
, NULL
, NULL
);
396 dout(5) << "could not get bucket instance info for bucket instance id=" << bucket_instance
<< dendl
;
399 } else { /* !bucket_name.empty() */
400 http_ret
= store
->get_bucket_info(obj_ctx
, tenant_name
, bucket_name
, bucket_info
, NULL
, NULL
);
402 dout(5) << "could not get bucket info for bucket=" << bucket_name
<< dendl
;
411 max_entries
= (unsigned)strict_strtol(max_entries_str
.c_str(), 10, &err
);
413 max_entries
= LOG_CLASS_LIST_MAX_ENTRIES
;
417 list
<rgw_bi_log_entry
> entries
;
418 int ret
= store
->list_bi_log_entries(bucket_info
, shard_id
,
419 marker
, max_entries
- count
,
420 entries
, &truncated
);
422 dout(5) << "ERROR: list_bi_log_entries()" << dendl
;
426 count
+= entries
.size();
428 send_response(entries
, marker
);
429 } while (truncated
&& count
< max_entries
);
434 void RGWOp_BILog_List::send_response() {
438 set_req_state_err(s
, http_ret
);
447 s
->formatter
->open_array_section("entries");
450 void RGWOp_BILog_List::send_response(list
<rgw_bi_log_entry
>& entries
, string
& marker
)
452 for (list
<rgw_bi_log_entry
>::iterator iter
= entries
.begin(); iter
!= entries
.end(); ++iter
) {
453 rgw_bi_log_entry
& entry
= *iter
;
454 encode_json("entry", entry
, s
->formatter
);
461 void RGWOp_BILog_List::send_response_end() {
462 s
->formatter
->close_section();
466 void RGWOp_BILog_Info::execute() {
467 string tenant_name
= s
->info
.args
.get("tenant"),
468 bucket_name
= s
->info
.args
.get("bucket"),
469 bucket_instance
= s
->info
.args
.get("bucket-instance");
470 RGWBucketInfo bucket_info
;
472 RGWObjectCtx
& obj_ctx
= *static_cast<RGWObjectCtx
*>(s
->obj_ctx
);
474 if (bucket_name
.empty() && bucket_instance
.empty()) {
475 dout(5) << "ERROR: neither bucket nor bucket instance specified" << dendl
;
481 http_ret
= rgw_bucket_parse_bucket_instance(bucket_instance
, &bucket_instance
, &shard_id
);
486 if (!bucket_instance
.empty()) {
487 http_ret
= store
->get_bucket_instance_info(obj_ctx
, bucket_instance
, bucket_info
, NULL
, NULL
);
489 dout(5) << "could not get bucket instance info for bucket instance id=" << bucket_instance
<< dendl
;
492 } else { /* !bucket_name.empty() */
493 http_ret
= store
->get_bucket_info(obj_ctx
, tenant_name
, bucket_name
, bucket_info
, NULL
, NULL
);
495 dout(5) << "could not get bucket info for bucket=" << bucket_name
<< dendl
;
499 map
<RGWObjCategory
, RGWStorageStats
> stats
;
500 int ret
= store
->get_bucket_stats(bucket_info
, shard_id
, &bucket_ver
, &master_ver
, stats
, &max_marker
);
501 if (ret
< 0 && ret
!= -ENOENT
) {
507 void RGWOp_BILog_Info::send_response() {
508 set_req_state_err(s
, http_ret
);
515 s
->formatter
->open_object_section("info");
516 encode_json("bucket_ver", bucket_ver
, s
->formatter
);
517 encode_json("master_ver", master_ver
, s
->formatter
);
518 encode_json("max_marker", max_marker
, s
->formatter
);
519 s
->formatter
->close_section();
524 void RGWOp_BILog_Delete::execute() {
525 string tenant_name
= s
->info
.args
.get("tenant"),
526 bucket_name
= s
->info
.args
.get("bucket"),
527 start_marker
= s
->info
.args
.get("start-marker"),
528 end_marker
= s
->info
.args
.get("end-marker"),
529 bucket_instance
= s
->info
.args
.get("bucket-instance");
531 RGWBucketInfo bucket_info
;
533 RGWObjectCtx
& obj_ctx
= *static_cast<RGWObjectCtx
*>(s
->obj_ctx
);
536 if ((bucket_name
.empty() && bucket_instance
.empty()) ||
537 end_marker
.empty()) {
538 dout(5) << "ERROR: one of bucket and bucket instance, and also end-marker is mandatory" << dendl
;
544 http_ret
= rgw_bucket_parse_bucket_instance(bucket_instance
, &bucket_instance
, &shard_id
);
549 if (!bucket_instance
.empty()) {
550 http_ret
= store
->get_bucket_instance_info(obj_ctx
, bucket_instance
, bucket_info
, NULL
, NULL
);
552 dout(5) << "could not get bucket instance info for bucket instance id=" << bucket_instance
<< dendl
;
555 } else { /* !bucket_name.empty() */
556 http_ret
= store
->get_bucket_info(obj_ctx
, tenant_name
, bucket_name
, bucket_info
, NULL
, NULL
);
558 dout(5) << "could not get bucket info for bucket=" << bucket_name
<< dendl
;
562 http_ret
= store
->trim_bi_log_entries(bucket_info
, shard_id
, start_marker
, end_marker
);
564 dout(5) << "ERROR: trim_bi_log_entries() " << dendl
;
569 void RGWOp_DATALog_List::execute() {
570 string shard
= s
->info
.args
.get("id");
572 string st
= s
->info
.args
.get("start-time"),
573 et
= s
->info
.args
.get("end-time"),
574 max_entries_str
= s
->info
.args
.get("max-entries"),
575 marker
= s
->info
.args
.get("marker"),
579 unsigned shard_id
, max_entries
= LOG_CLASS_LIST_MAX_ENTRIES
;
581 s
->info
.args
.get_bool("extra-info", &extra_info
, false);
583 shard_id
= (unsigned)strict_strtol(shard
.c_str(), 10, &err
);
585 dout(5) << "Error parsing shard_id " << shard
<< dendl
;
590 if (parse_date_str(st
, ut_st
) < 0) {
595 if (parse_date_str(et
, ut_et
) < 0) {
600 if (!max_entries_str
.empty()) {
601 max_entries
= (unsigned)strict_strtol(max_entries_str
.c_str(), 10, &err
);
603 dout(5) << "Error parsing max-entries " << max_entries_str
<< dendl
;
610 // Note that last_marker is updated to be the marker of the last
612 http_ret
= store
->data_log
->list_entries(shard_id
, ut_st
, ut_et
,
613 max_entries
, entries
, marker
,
614 &last_marker
, &truncated
);
618 if (!max_entries_str
.empty())
619 max_entries
-= entries
.size();
620 } while (truncated
&& (max_entries
> 0));
623 void RGWOp_DATALog_List::send_response() {
624 set_req_state_err(s
, http_ret
);
631 s
->formatter
->open_object_section("log_entries");
632 s
->formatter
->dump_string("marker", last_marker
);
633 s
->formatter
->dump_bool("truncated", truncated
);
635 s
->formatter
->open_array_section("entries");
636 for (list
<rgw_data_change_log_entry
>::iterator iter
= entries
.begin();
637 iter
!= entries
.end(); ++iter
) {
638 rgw_data_change_log_entry
& entry
= *iter
;
640 encode_json("entry", entry
.entry
, s
->formatter
);
642 encode_json("entry", entry
, s
->formatter
);
646 s
->formatter
->close_section();
648 s
->formatter
->close_section();
653 void RGWOp_DATALog_Info::execute() {
654 num_objects
= s
->cct
->_conf
->rgw_data_log_num_shards
;
658 void RGWOp_DATALog_Info::send_response() {
659 set_req_state_err(s
, http_ret
);
663 s
->formatter
->open_object_section("num_objects");
664 s
->formatter
->dump_unsigned("num_objects", num_objects
);
665 s
->formatter
->close_section();
669 void RGWOp_DATALog_ShardInfo::execute() {
670 string shard
= s
->info
.args
.get("id");
673 unsigned shard_id
= (unsigned)strict_strtol(shard
.c_str(), 10, &err
);
675 dout(5) << "Error parsing shard_id " << shard
<< dendl
;
680 http_ret
= store
->data_log
->get_info(shard_id
, &info
);
683 void RGWOp_DATALog_ShardInfo::send_response() {
684 set_req_state_err(s
, http_ret
);
688 encode_json("info", info
, s
->formatter
);
692 void RGWOp_DATALog_Lock::execute() {
693 string shard_id_str
, duration_str
, locker_id
, zone_id
;
698 shard_id_str
= s
->info
.args
.get("id");
699 duration_str
= s
->info
.args
.get("length");
700 locker_id
= s
->info
.args
.get("locker-id");
701 zone_id
= s
->info
.args
.get("zone-id");
703 if (shard_id_str
.empty() ||
704 (duration_str
.empty()) ||
707 dout(5) << "Error invalid parameter list" << dendl
;
713 shard_id
= (unsigned)strict_strtol(shard_id_str
.c_str(), 10, &err
);
715 dout(5) << "Error parsing shard_id param " << shard_id_str
<< dendl
;
721 dur
= (unsigned)strict_strtol(duration_str
.c_str(), 10, &err
);
722 if (!err
.empty() || dur
<= 0) {
723 dout(5) << "invalid length param " << duration_str
<< dendl
;
727 http_ret
= store
->data_log
->lock_exclusive(shard_id
, make_timespan(dur
), zone_id
, locker_id
);
728 if (http_ret
== -EBUSY
)
729 http_ret
= -ERR_LOCKED
;
732 void RGWOp_DATALog_Unlock::execute() {
733 string shard_id_str
, locker_id
, zone_id
;
738 shard_id_str
= s
->info
.args
.get("id");
739 locker_id
= s
->info
.args
.get("locker-id");
740 zone_id
= s
->info
.args
.get("zone-id");
742 if (shard_id_str
.empty() ||
745 dout(5) << "Error invalid parameter list" << dendl
;
751 shard_id
= (unsigned)strict_strtol(shard_id_str
.c_str(), 10, &err
);
753 dout(5) << "Error parsing shard_id param " << shard_id_str
<< dendl
;
758 http_ret
= store
->data_log
->unlock(shard_id
, zone_id
, locker_id
);
761 void RGWOp_DATALog_Notify::execute() {
762 string source_zone
= s
->info
.args
.get("source-zone");
765 #define LARGE_ENOUGH_BUF (128 * 1024)
766 int r
= rgw_rest_read_all_input(s
, &data
, &len
, LARGE_ENOUGH_BUF
);
772 ldout(s
->cct
, 20) << __func__
<< "(): read data: " << string(data
, len
) << dendl
;
775 r
= p
.parse(data
, len
);
778 ldout(s
->cct
, 0) << "ERROR: failed to parse JSON" << dendl
;
783 map
<int, set
<string
> > updated_shards
;
785 decode_json_obj(updated_shards
, &p
);
786 } catch (JSONDecoder::err
& err
) {
787 ldout(s
->cct
, 0) << "ERROR: failed to decode JSON" << dendl
;
792 if (store
->ctx()->_conf
->subsys
.should_gather(ceph_subsys_rgw
, 20)) {
793 for (map
<int, set
<string
> >::iterator iter
= updated_shards
.begin(); iter
!= updated_shards
.end(); ++iter
) {
794 ldout(s
->cct
, 20) << __func__
<< "(): updated shard=" << iter
->first
<< dendl
;
795 set
<string
>& keys
= iter
->second
;
796 for (set
<string
>::iterator kiter
= keys
.begin(); kiter
!= keys
.end(); ++kiter
) {
797 ldout(s
->cct
, 20) << __func__
<< "(): modified key=" << *kiter
<< dendl
;
802 store
->wakeup_data_sync_shards(source_zone
, updated_shards
);
807 void RGWOp_DATALog_Delete::execute() {
808 string st
= s
->info
.args
.get("start-time"),
809 et
= s
->info
.args
.get("end-time"),
810 start_marker
= s
->info
.args
.get("start-marker"),
811 end_marker
= s
->info
.args
.get("end-marker"),
812 shard
= s
->info
.args
.get("id"),
820 shard_id
= (unsigned)strict_strtol(shard
.c_str(), 10, &err
);
822 dout(5) << "Error parsing shard_id " << shard
<< dendl
;
826 if (et
.empty() && end_marker
.empty()) { /* bounding end */
831 if (parse_date_str(st
, ut_st
) < 0) {
836 if (parse_date_str(et
, ut_et
) < 0) {
841 http_ret
= store
->data_log
->trim_entries(shard_id
, ut_st
, ut_et
, start_marker
, end_marker
);
844 // not in header to avoid pulling in rgw_sync.h
845 class RGWOp_MDLog_Status
: public RGWRESTOp
{
846 rgw_meta_sync_status status
;
848 int check_caps(RGWUserCaps
& caps
) override
{
849 return caps
.check_cap("mdlog", RGW_CAP_READ
);
851 int verify_permission() override
{
852 return check_caps(s
->user
->caps
);
854 void execute() override
;
855 void send_response() override
;
856 const string
name() override
{ return "get_metadata_log_status"; }
859 void RGWOp_MDLog_Status::execute()
861 auto sync
= store
->get_meta_sync_manager();
862 if (sync
== nullptr) {
863 ldout(s
->cct
, 1) << "no sync manager" << dendl
;
867 http_ret
= sync
->read_sync_status(&status
);
870 void RGWOp_MDLog_Status::send_response()
872 set_req_state_err(s
, http_ret
);
877 encode_json("status", status
, s
->formatter
);
882 // not in header to avoid pulling in rgw_data_sync.h
883 class RGWOp_DATALog_Status
: public RGWRESTOp
{
884 rgw_data_sync_status status
;
886 int check_caps(RGWUserCaps
& caps
) override
{
887 return caps
.check_cap("datalog", RGW_CAP_READ
);
889 int verify_permission() override
{
890 return check_caps(s
->user
->caps
);
892 void execute() override
;
893 void send_response() override
;
894 const string
name() override
{ return "get_data_changes_log_status"; }
897 void RGWOp_DATALog_Status::execute()
899 const auto source_zone
= s
->info
.args
.get("source-zone");
900 auto sync
= store
->get_data_sync_manager(source_zone
);
901 if (sync
== nullptr) {
902 ldout(s
->cct
, 1) << "no sync manager for source-zone " << source_zone
<< dendl
;
906 http_ret
= sync
->read_sync_status(&status
);
909 void RGWOp_DATALog_Status::send_response()
911 set_req_state_err(s
, http_ret
);
916 encode_json("status", status
, s
->formatter
);
922 RGWOp
*RGWHandler_Log::op_get() {
924 string type
= s
->info
.args
.get("type", &exists
);
930 if (type
.compare("metadata") == 0) {
931 if (s
->info
.args
.exists("id")) {
932 if (s
->info
.args
.exists("info")) {
933 return new RGWOp_MDLog_ShardInfo
;
935 return new RGWOp_MDLog_List
;
937 } else if (s
->info
.args
.exists("status")) {
938 return new RGWOp_MDLog_Status
;
940 return new RGWOp_MDLog_Info
;
942 } else if (type
.compare("bucket-index") == 0) {
943 if (s
->info
.args
.exists("info")) {
944 return new RGWOp_BILog_Info
;
946 return new RGWOp_BILog_List
;
948 } else if (type
.compare("data") == 0) {
949 if (s
->info
.args
.exists("id")) {
950 if (s
->info
.args
.exists("info")) {
951 return new RGWOp_DATALog_ShardInfo
;
953 return new RGWOp_DATALog_List
;
955 } else if (s
->info
.args
.exists("status")) {
956 return new RGWOp_DATALog_Status
;
958 return new RGWOp_DATALog_Info
;
964 RGWOp
*RGWHandler_Log::op_delete() {
966 string type
= s
->info
.args
.get("type", &exists
);
972 if (type
.compare("metadata") == 0)
973 return new RGWOp_MDLog_Delete
;
974 else if (type
.compare("bucket-index") == 0)
975 return new RGWOp_BILog_Delete
;
976 else if (type
.compare("data") == 0)
977 return new RGWOp_DATALog_Delete
;
981 RGWOp
*RGWHandler_Log::op_post() {
983 string type
= s
->info
.args
.get("type", &exists
);
989 if (type
.compare("metadata") == 0) {
990 if (s
->info
.args
.exists("lock"))
991 return new RGWOp_MDLog_Lock
;
992 else if (s
->info
.args
.exists("unlock"))
993 return new RGWOp_MDLog_Unlock
;
994 else if (s
->info
.args
.exists("notify"))
995 return new RGWOp_MDLog_Notify
;
996 } else if (type
.compare("data") == 0) {
997 if (s
->info
.args
.exists("lock"))
998 return new RGWOp_DATALog_Lock
;
999 else if (s
->info
.args
.exists("unlock"))
1000 return new RGWOp_DATALog_Unlock
;
1001 else if (s
->info
.args
.exists("notify"))
1002 return new RGWOp_DATALog_Notify
;