if(WITH_RADOSGW_RADOS)
list(APPEND librgw_common_srcs
- services/svc_finisher.cc
services/svc_bi_rados.cc
services/svc_bilog_rados.cc
services/svc_bucket.cc
#include "rgw_service.h"
-#include "services/svc_finisher.h"
#include "services/svc_bi_rados.h"
#include "services/svc_bilog_rados.h"
#include "services/svc_bucket_sobj.h"
rgw::sal::ConfigStore* cfgstore,
const rgw::SiteConfig* site)
{
- finisher = std::make_unique<RGWSI_Finisher>(cct);
bucket_sobj = std::make_unique<RGWSI_Bucket_SObj>(cct);
bucket_sync_sobj = std::make_unique<RGWSI_Bucket_Sync_SObj>(cct);
bi_rados = std::make_unique<RGWSI_BucketIndex_RADOS>(cct);
}
async_processor->start();
- finisher->init();
bi_rados->init(zone.get(), driver->getRados()->get_rados_handle(),
bilog_rados.get(), datalog_rados.get());
bilog_rados->init(bi_rados.get());
can_shutdown = true;
- int r = finisher->start(y, dpp);
- if (r < 0) {
- ldpp_dout(dpp, 0) << "ERROR: failed to start finisher service (" << cpp_strerror(-r) << dendl;
- return r;
- }
-
+ int r = 0;
if (!raw) {
r = notify->start(y, dpp);
if (r < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to start notify service (" << cpp_strerror(-r) << dendl;
return r;
}
- }
- if (!raw) {
r = zone->start(y, dpp);
if (r < 0) {
ldpp_dout(dpp, 0) << "ERROR: failed to start zone service (" << cpp_strerror(-r) << dendl;
bi_rados->shutdown();
bucket_sync_sobj->shutdown();
bucket_sobj->shutdown();
- finisher->shutdown();
sysobj->shutdown();
sysobj_core->shutdown();
return r;
}
- finisher = _svc.finisher.get();
bi_rados = _svc.bi_rados.get();
bi = bi_rados;
bilog_rados = _svc.bilog_rados.get();
}
};
-class RGWSI_Finisher;
class RGWSI_Bucket;
class RGWSI_Bucket_SObj;
class RGWSI_Bucket_Sync;
bool can_shutdown{false};
bool has_shutdown{false};
- std::unique_ptr<RGWSI_Finisher> finisher;
std::unique_ptr<RGWSI_Bucket_SObj> bucket_sobj;
std::unique_ptr<RGWSI_Bucket_Sync_SObj> bucket_sync_sobj;
std::unique_ptr<RGWSI_BucketIndex_RADOS> bi_rados;
CephContext *cct;
const rgw::SiteConfig* site{nullptr};
- RGWSI_Finisher *finisher{nullptr};
RGWSI_Bucket *bucket{nullptr};
RGWSI_Bucket_SObj *bucket_sobj{nullptr};
RGWSI_Bucket_Sync *bucket_sync{nullptr};
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
-// vim: ts=8 sw=2 sts=2 expandtab ft=cpp
-
-#include "common/Finisher.h"
-
-#include "svc_finisher.h"
-
-using namespace std;
-
-int RGWSI_Finisher::do_start(optional_yield, const DoutPrefixProvider *dpp)
-{
- finisher = new Finisher(cct);
- finisher->start();
-
- return 0;
-}
-
-void RGWSI_Finisher::shutdown()
-{
- if (finalized) {
- return;
- }
-
- if (finisher) {
- finisher->stop();
-
- map<int, ShutdownCB *> cbs;
- cbs.swap(shutdown_cbs); /* move cbs out, in case caller unregisters */
- for (auto& iter : cbs) {
- iter.second->call();
- }
- delete finisher;
- }
-
- finalized = true;
-}
-
-RGWSI_Finisher::~RGWSI_Finisher()
-{
- shutdown();
-}
-
-void RGWSI_Finisher::register_caller(ShutdownCB *cb, int *phandle)
-{
- *phandle = ++handles_counter;
- shutdown_cbs[*phandle] = cb;
-}
-
-void RGWSI_Finisher::unregister_caller(int handle)
-{
- shutdown_cbs.erase(handle);
-}
-
-void RGWSI_Finisher::schedule_context(Context *c)
-{
- finisher->queue(c);
-}
-
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
-// vim: ts=8 sw=2 sts=2 expandtab ft=cpp
-
-#pragma once
-
-#include "rgw_service.h"
-
-class Context;
-class Finisher;
-
-class RGWSI_Finisher : public RGWServiceInstance
-{
- friend struct RGWServices_Def;
-public:
- class ShutdownCB;
-
-private:
- Finisher *finisher{nullptr};
- bool finalized{false};
-
- void shutdown() override;
-
- std::map<int, ShutdownCB *> shutdown_cbs;
- std::atomic<int> handles_counter{0};
-
-protected:
- void init() {}
- int do_start(optional_yield y, const DoutPrefixProvider *dpp) override;
-
-public:
- RGWSI_Finisher(CephContext *cct): RGWServiceInstance(cct) {}
- ~RGWSI_Finisher();
-
- class ShutdownCB {
- public:
- virtual ~ShutdownCB() {}
- virtual void call() = 0;
- };
-
- void register_caller(ShutdownCB *cb, int *phandle);
- void unregister_caller(int handle);
-
- void schedule_context(Context *c);
-};