1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
10 #include "auth/Crypto.h"
12 #include "common/armor.h"
13 #include "common/ceph_json.h"
14 #include "common/config.h"
15 #include "common/ceph_argparse.h"
16 #include "common/Formatter.h"
17 #include "common/errno.h"
19 #include "global/global_init.h"
21 #include "include/utime.h"
22 #include "include/str_list.h"
25 #include "rgw_bucket.h"
27 #include "rgw_acl_s3.h"
29 #include "rgw_formats.h"
30 #include "rgw_usage.h"
31 #include "rgw_object_expirer_core.h"
33 #define dout_subsys ceph_subsys_rgw
35 static rgw::sal::RGWRadosStore
*store
= NULL
;
37 class StoreDestructor
{
38 rgw::sal::RGWRadosStore
*store
;
41 explicit StoreDestructor(rgw::sal::RGWRadosStore
*_s
) : store(_s
) {}
44 RGWStoreManager::close_storage(store
);
51 generic_server_usage();
54 int main(const int argc
, const char **argv
)
56 vector
<const char *> args
;
57 argv_to_vec(argc
, argv
, args
);
59 cerr
<< argv
[0] << ": -h or --help for usage" << std::endl
;
62 if (ceph_argparse_need_usage(args
)) {
67 auto cct
= global_init(NULL
, args
, CEPH_ENTITY_TYPE_CLIENT
,
68 CODE_ENVIRONMENT_DAEMON
,
69 CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS
);
71 for (std::vector
<const char *>::iterator i
= args
.begin(); i
!= args
.end(); ) {
72 if (ceph_argparse_double_dash(args
, i
)) {
77 if (g_conf()->daemonize
) {
78 global_init_daemonize(g_ceph_context
);
81 common_init_finish(g_ceph_context
);
83 store
= RGWStoreManager::get_storage(g_ceph_context
, false, false, false, false, false);
85 std::cerr
<< "couldn't init storage provider" << std::endl
;
89 /* Guard to not forget about closing the rados store. */
90 StoreDestructor
store_dtor(store
);
92 RGWObjectExpirer
objexp(store
);
93 objexp
.start_processor();
95 const utime_t
interval(g_ceph_context
->_conf
->rgw_objexp_gc_interval
, 0);