From 4309adb36be8dff737ab2196f59743c316b12bca Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 1 Sep 2017 10:51:57 -0400 Subject: [PATCH] rgw: add skeleton for BucketTrimManager Signed-off-by: Casey Bodley --- src/rgw/CMakeLists.txt | 1 + src/rgw/rgw_sync_log_trim.cc | 44 +++++++++++++++++++++++++++++++++ src/rgw/rgw_sync_log_trim.h | 47 ++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 src/rgw/rgw_sync_log_trim.cc create mode 100644 src/rgw/rgw_sync_log_trim.h diff --git a/src/rgw/CMakeLists.txt b/src/rgw/CMakeLists.txt index 9e56be8b98f..05071c04f16 100644 --- a/src/rgw/CMakeLists.txt +++ b/src/rgw/CMakeLists.txt @@ -76,6 +76,7 @@ set(rgw_a_srcs rgw_sync_module_es.cc rgw_sync_module_es_rest.cc rgw_sync_module_log.cc + rgw_sync_log_trim.cc rgw_sync_trace.cc rgw_period_history.cc rgw_period_puller.cc diff --git a/src/rgw/rgw_sync_log_trim.cc b/src/rgw/rgw_sync_log_trim.cc new file mode 100644 index 00000000000..315288edce1 --- /dev/null +++ b/src/rgw/rgw_sync_log_trim.cc @@ -0,0 +1,44 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2017 Red Hat, Inc + * + * Author: Casey Bodley + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + */ + +#include "rgw_sync_log_trim.h" + +#define dout_subsys ceph_subsys_rgw + +#undef dout_prefix +#define dout_prefix (*_dout << "trim: ") + +using rgw::BucketTrimConfig; + +namespace rgw { + +class BucketTrimManager::Impl { + public: + RGWRados *const store; + const BucketTrimConfig config; + + Impl(RGWRados *store, const BucketTrimConfig& config) + : store(store), config(config) + {} +}; + +BucketTrimManager::BucketTrimManager(RGWRados *store, + const BucketTrimConfig& config) + : impl(new Impl(store, config)) +{ +} +BucketTrimManager::~BucketTrimManager() = default; + +} // namespace rgw diff --git a/src/rgw/rgw_sync_log_trim.h b/src/rgw/rgw_sync_log_trim.h new file mode 100644 index 00000000000..fb21ac7d9de --- /dev/null +++ b/src/rgw/rgw_sync_log_trim.h @@ -0,0 +1,47 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2017 Red Hat, Inc + * + * Author: Casey Bodley + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + */ + +#ifndef RGW_SYNC_LOG_TRIM_H +#define RGW_SYNC_LOG_TRIM_H + +#include + +class CephContext; +class RGWRados; + +namespace rgw { + +/// Configuration for BucketTrimManager +struct BucketTrimConfig { +}; + +/// fill out the BucketTrimConfig from the ceph context +void configure_bucket_trim(CephContext *cct, BucketTrimConfig& config); + +/// Determines the buckets on which to focus trim activity, using two sources of +/// input: the frequency of entries read from the data changes log, and a global +/// listing of the bucket.instance metadata. This allows us to trim active +/// buckets quickly, while also ensuring that all buckets will eventually trim +class BucketTrimManager { + class Impl; + std::unique_ptr impl; + public: + BucketTrimManager(RGWRados *store, const BucketTrimConfig& config); + ~BucketTrimManager(); +}; + +} // namespace rgw + +#endif // RGW_SYNC_LOG_TRIM_H -- 2.39.5