]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/services/svc_bucket_sync_sobj.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rgw / services / svc_bucket_sync_sobj.h
CommitLineData
9f95a23c
TL
1
2// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
3// vim: ts=8 sw=2 smarttab
4
5/*
6 * Ceph - scalable distributed file system
7 *
8 * Copyright (C) 2019 Red Hat, Inc.
9 *
10 * This is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License version 2.1, as published by the Free Software
13 * Foundation. See file COPYING.
14 *
15 */
16
17
18#pragma once
19
1e59de90 20#include "rgw_service.h"
9f95a23c
TL
21
22#include "svc_meta_be.h"
23#include "svc_bucket_sync.h"
24
25class RGWSI_Zone;
26class RGWSI_SysObj_Cache;
27class RGWSI_Bucket_SObj;
28
29template <class T>
30class RGWChainedCacheImpl;
31
32class RGWSI_Bucket_Sync_SObj_HintIndexManager;
33
34struct rgw_sync_bucket_entity;
35
36class RGWSI_Bucket_Sync_SObj : public RGWSI_Bucket_Sync
37{
38 struct bucket_sync_policy_cache_entry {
39 std::shared_ptr<RGWBucketSyncPolicyHandler> handler;
40 };
41
20effc67 42 std::unique_ptr<RGWChainedCacheImpl<bucket_sync_policy_cache_entry> > sync_policy_cache;
9f95a23c
TL
43
44 std::unique_ptr<RGWSI_Bucket_Sync_SObj_HintIndexManager> hint_index_mgr;
45
b3b6e05e 46 int do_start(optional_yield, const DoutPrefixProvider *dpp) override;
9f95a23c
TL
47
48 struct optional_zone_bucket {
20effc67
TL
49 std::optional<rgw_zone_id> zone;
50 std::optional<rgw_bucket> bucket;
9f95a23c 51
20effc67
TL
52 optional_zone_bucket(const std::optional<rgw_zone_id>& _zone,
53 const std::optional<rgw_bucket>& _bucket) : zone(_zone), bucket(_bucket) {}
9f95a23c
TL
54
55 bool operator<(const optional_zone_bucket& ozb) const {
56 if (zone < ozb.zone) {
57 return true;
58 }
59 if (zone > ozb.zone) {
60 return false;
61 }
62 return bucket < ozb.bucket;
63 }
64 };
65
66 void get_hint_entities(RGWSI_Bucket_X_Ctx& ctx,
67 const std::set<rgw_zone_id>& zone_names,
68 const std::set<rgw_bucket>& buckets,
69 std::set<rgw_sync_bucket_entity> *hint_entities,
b3b6e05e 70 optional_yield y, const DoutPrefixProvider *);
9f95a23c
TL
71 int resolve_policy_hints(RGWSI_Bucket_X_Ctx& ctx,
72 rgw_sync_bucket_entity& self_entity,
73 RGWBucketSyncPolicyHandlerRef& handler,
74 RGWBucketSyncPolicyHandlerRef& zone_policy_handler,
75 std::map<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef>& temp_map,
b3b6e05e
TL
76 optional_yield y,
77 const DoutPrefixProvider *dpp);
9f95a23c
TL
78 int do_get_policy_handler(RGWSI_Bucket_X_Ctx& ctx,
79 std::optional<rgw_zone_id> zone,
80 std::optional<rgw_bucket> _bucket,
81 std::map<optional_zone_bucket, RGWBucketSyncPolicyHandlerRef>& temp_map,
82 RGWBucketSyncPolicyHandlerRef *handler,
b3b6e05e
TL
83 optional_yield y,
84 const DoutPrefixProvider *dpp);
9f95a23c
TL
85public:
86 struct Svc {
87 RGWSI_Zone *zone{nullptr};
88 RGWSI_SysObj *sysobj{nullptr};
89 RGWSI_SysObj_Cache *cache{nullptr};
90 RGWSI_Bucket_SObj *bucket_sobj{nullptr};
91 } svc;
92
93 RGWSI_Bucket_Sync_SObj(CephContext *cct);
94 ~RGWSI_Bucket_Sync_SObj();
95
96 void init(RGWSI_Zone *_zone_svc,
97 RGWSI_SysObj *_sysobj_svc,
98 RGWSI_SysObj_Cache *_cache_svc,
99 RGWSI_Bucket_SObj *_bucket_sobj_svc);
100
101
102 int get_policy_handler(RGWSI_Bucket_X_Ctx& ctx,
103 std::optional<rgw_zone_id> zone,
104 std::optional<rgw_bucket> bucket,
105 RGWBucketSyncPolicyHandlerRef *handler,
b3b6e05e
TL
106 optional_yield y,
107 const DoutPrefixProvider *dpp);
9f95a23c 108
b3b6e05e
TL
109 int handle_bi_update(const DoutPrefixProvider *dpp,
110 RGWBucketInfo& bucket_info,
9f95a23c
TL
111 RGWBucketInfo *orig_bucket_info,
112 optional_yield y) override;
b3b6e05e
TL
113 int handle_bi_removal(const DoutPrefixProvider *dpp,
114 const RGWBucketInfo& bucket_info,
9f95a23c
TL
115 optional_yield y) override;
116
b3b6e05e
TL
117 int get_bucket_sync_hints(const DoutPrefixProvider *dpp,
118 const rgw_bucket& bucket,
9f95a23c
TL
119 std::set<rgw_bucket> *sources,
120 std::set<rgw_bucket> *dests,
121 optional_yield y) override;
122};
123