YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/tserver/remote_bootstrap_snapshots.h
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
#ifndef YB_TSERVER_REMOTE_BOOTSTRAP_SNAPSHOTS_H
15
#define YB_TSERVER_REMOTE_BOOTSTRAP_SNAPSHOTS_H
16
17
#include "yb/tablet/tablet_fwd.h"
18
19
#include "yb/tserver/remote_bootstrap_client.h"
20
#include "yb/tserver/remote_bootstrap_session.h"
21
22
namespace yb {
23
namespace tserver {
24
25
class RemoteBootstrapSnapshotsComponent : public RemoteBootstrapComponent {
26
 public:
27
  RemoteBootstrapSnapshotsComponent(RemoteBootstrapFileDownloader* downloader,
28
                                    tablet::RaftGroupReplicaSuperBlockPB* new_superblock);
29
30
  CHECKED_STATUS CreateDirectories(const string& db_dir, FsManager* fs) override;
31
  CHECKED_STATUS Download() override;
32
33
 private:
34
2.07k
  FsManager& fs_manager() const {
35
2.07k
    return downloader_.fs_manager();
36
2.07k
  }
37
38
  RemoteBootstrapFileDownloader& downloader_;
39
  tablet::RaftGroupReplicaSuperBlockPB& new_superblock_;
40
};
41
42
class RemoteBootstrapSnapshotsSource : public RemoteBootstrapSource {
43
 public:
44
  RemoteBootstrapSnapshotsSource(
45
      tablet::TabletPeerPtr tablet_peer, tablet::RaftGroupReplicaSuperBlockPB* tablet_superblock) :
46
2.03k
      tablet_peer_(std::move(tablet_peer)), tablet_superblock_(*tablet_superblock) {}
47
48
2.03k
  static DataIdPB::IdType id_type() {
49
2.03k
    return DataIdPB::SNAPSHOT_FILE;
50
2.03k
  }
51
52
  CHECKED_STATUS Init() override;
53
54
  CHECKED_STATUS ValidateDataId(const DataIdPB& data_id) override;
55
56
  CHECKED_STATUS GetDataPiece(const DataIdPB& data_id, GetDataPieceInfo* info) override;
57
58
 private:
59
  tablet::TabletPeerPtr tablet_peer_;
60
  tablet::RaftGroupReplicaSuperBlockPB& tablet_superblock_;
61
};
62
63
} // namespace tserver
64
} // namespace yb
65
66
#endif // YB_TSERVER_REMOTE_BOOTSTRAP_SNAPSHOTS_H