/Users/deen/code/yugabyte-db/src/yb/master/master_encryption_service.cc
Line | Count | Source |
1 | | // Copyright (c) YugaByte, Inc. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
4 | | // in compliance with the License. You may obtain a copy of the License at |
5 | | // |
6 | | // http://www.apache.org/licenses/LICENSE-2.0 |
7 | | // |
8 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
9 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
10 | | // or implied. See the License for the specific language governing permissions and limitations |
11 | | // under the License. |
12 | | // |
13 | | |
14 | | #include "yb/master/catalog_manager.h" |
15 | | #include "yb/master/encryption_manager.h" |
16 | | #include "yb/master/master_encryption.service.h" |
17 | | #include "yb/master/master_service_base.h" |
18 | | #include "yb/master/master_service_base-internal.h" |
19 | | |
20 | | namespace yb { |
21 | | namespace master { |
22 | | |
23 | | namespace { |
24 | | |
25 | | class MasterEncryptionServiceImpl : public MasterServiceBase, public MasterEncryptionIf { |
26 | | public: |
27 | | explicit MasterEncryptionServiceImpl(Master* master) |
28 | 8.03k | : MasterServiceBase(master), MasterEncryptionIf(master->metric_entity()) {} |
29 | | |
30 | | MASTER_SERVICE_IMPL_ON_LEADER_WITH_LOCK( |
31 | | enterprise::CatalogManager, |
32 | | (ChangeEncryptionInfo) |
33 | | (IsEncryptionEnabled) |
34 | | ) |
35 | | |
36 | | MASTER_SERVICE_IMPL_ON_ALL_MASTERS( |
37 | | EncryptionManager, |
38 | | (GetUniverseKeyRegistry) |
39 | | (AddUniverseKeys) |
40 | | (HasUniverseKeyInMemory) |
41 | | ) |
42 | | }; |
43 | | |
44 | | } // namespace |
45 | | |
46 | 8.03k | std::unique_ptr<rpc::ServiceIf> MakeMasterEncryptionService(Master* master) { |
47 | 8.03k | return std::make_unique<MasterEncryptionServiceImpl>(master); |
48 | 8.03k | } |
49 | | |
50 | | } // namespace master |
51 | | } // namespace yb |