]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/db/event_helpers.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / db / event_helpers.h
CommitLineData
7c673cae 1// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
11fdf7f2
TL
2// This source code is licensed under both the GPLv2 (found in the
3// COPYING file in the root directory) and Apache 2.0 License
4// (found in the LICENSE.Apache file in the root directory).
7c673cae
FG
5#pragma once
6
7#include <memory>
8#include <string>
9#include <vector>
10
11#include "db/column_family.h"
12#include "db/version_edit.h"
f67539c2 13#include "logging/event_logger.h"
7c673cae
FG
14#include "rocksdb/listener.h"
15#include "rocksdb/table_properties.h"
7c673cae 16
f67539c2 17namespace ROCKSDB_NAMESPACE {
7c673cae
FG
18
19class EventHelpers {
20 public:
21 static void AppendCurrentTime(JSONWriter* json_writer);
22#ifndef ROCKSDB_LITE
23 static void NotifyTableFileCreationStarted(
24 const std::vector<std::shared_ptr<EventListener>>& listeners,
25 const std::string& db_name, const std::string& cf_name,
26 const std::string& file_path, int job_id, TableFileCreationReason reason);
27#endif // !ROCKSDB_LITE
11fdf7f2
TL
28 static void NotifyOnBackgroundError(
29 const std::vector<std::shared_ptr<EventListener>>& listeners,
30 BackgroundErrorReason reason, Status* bg_error,
31 InstrumentedMutex* db_mutex, bool* auto_recovery);
7c673cae
FG
32 static void LogAndNotifyTableFileCreationFinished(
33 EventLogger* event_logger,
34 const std::vector<std::shared_ptr<EventListener>>& listeners,
35 const std::string& db_name, const std::string& cf_name,
36 const std::string& file_path, int job_id, const FileDescriptor& fd,
f67539c2 37 uint64_t oldest_blob_file_number, const TableProperties& table_properties,
20effc67
TL
38 TableFileCreationReason reason, const Status& s,
39 const std::string& file_checksum,
40 const std::string& file_checksum_func_name);
7c673cae 41 static void LogAndNotifyTableFileDeletion(
1e59de90
TL
42 EventLogger* event_logger, int job_id, uint64_t file_number,
43 const std::string& file_path, const Status& status,
44 const std::string& db_name,
7c673cae 45 const std::vector<std::shared_ptr<EventListener>>& listeners);
1e59de90 46 static void NotifyOnErrorRecoveryEnd(
11fdf7f2 47 const std::vector<std::shared_ptr<EventListener>>& listeners,
1e59de90
TL
48 const Status& old_bg_error, const Status& new_bg_error,
49 InstrumentedMutex* db_mutex);
50
51#ifndef ROCKSDB_LITE
52 static void NotifyBlobFileCreationStarted(
53 const std::vector<std::shared_ptr<EventListener>>& listeners,
54 const std::string& db_name, const std::string& cf_name,
55 const std::string& file_path, int job_id,
56 BlobFileCreationReason creation_reason);
57#endif // !ROCKSDB_LITE
58
59 static void LogAndNotifyBlobFileCreationFinished(
60 EventLogger* event_logger,
61 const std::vector<std::shared_ptr<EventListener>>& listeners,
62 const std::string& db_name, const std::string& cf_name,
63 const std::string& file_path, int job_id, uint64_t file_number,
64 BlobFileCreationReason creation_reason, const Status& s,
65 const std::string& file_checksum,
66 const std::string& file_checksum_func_name, uint64_t total_blob_count,
67 uint64_t total_blob_bytes);
68
69 static void LogAndNotifyBlobFileDeletion(
70 EventLogger* event_logger,
71 const std::vector<std::shared_ptr<EventListener>>& listeners, int job_id,
72 uint64_t file_number, const std::string& file_path, const Status& status,
73 const std::string& db_name);
7c673cae
FG
74
75 private:
76 static void LogAndNotifyTableFileCreation(
77 EventLogger* event_logger,
78 const std::vector<std::shared_ptr<EventListener>>& listeners,
79 const FileDescriptor& fd, const TableFileCreationInfo& info);
80};
81
f67539c2 82} // namespace ROCKSDB_NAMESPACE