1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
11 #include "auth/Crypto.h"
13 #include "common/armor.h"
14 #include "common/ceph_json.h"
15 #include "common/config.h"
16 #include "common/ceph_argparse.h"
17 #include "common/Formatter.h"
18 #include "common/errno.h"
20 #include "global/global_init.h"
22 #include "include/utime.h"
23 #include "include/str_list.h"
26 #include "rgw_bucket.h"
27 #include "rgw_rados.h"
29 #include "rgw_acl_s3.h"
31 #include "rgw_formats.h"
32 #include "rgw_usage.h"
33 #include "rgw_replica_log.h"
34 #include "rgw_object_expirer_core.h"
36 #define dout_subsys ceph_subsys_rgw
38 static RGWRados *store = NULL;
40 class StoreDestructor {
44 explicit StoreDestructor(RGWRados *_s) : store(_s) {}
47 RGWStoreManager::close_storage(store);
54 generic_server_usage();
57 int main(const int argc, const char **argv)
59 vector<const char *> args;
60 argv_to_vec(argc, argv, args);
63 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
64 CODE_ENVIRONMENT_DAEMON,
65 CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS, "rgw_data");
67 for (std::vector<const char *>::iterator i = args.begin(); i != args.end(); ) {
68 if (ceph_argparse_double_dash(args, i)) {
70 } else if (ceph_argparse_flag(args, i, "-h", "--help", (char*)NULL)) {
76 if (g_conf->daemonize) {
77 global_init_daemonize(g_ceph_context);
80 common_init_finish(g_ceph_context);
82 store = RGWStoreManager::get_storage(g_ceph_context, false, false, false, false, false);
84 std::cerr << "couldn't init storage provider" << std::endl;
89 rgw_bucket_init(store->meta_mgr);
91 /* Guard to not forget about closing the rados store. */
92 StoreDestructor store_dtor(store);
94 RGWObjectExpirer objexp(store);
95 objexp.start_processor();
97 const utime_t interval(g_ceph_context->_conf->rgw_objexp_gc_interval, 0);