1/*
2 Copyright (c) 2015, Facebook, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16#pragma once
17
18#include "rocksdb/listener.h"
19
20namespace myrocks {
21
22class Rdb_ddl_manager;
23
24class Rdb_event_listener : public rocksdb::EventListener {
25public:
26 Rdb_event_listener(const Rdb_event_listener &) = delete;
27 Rdb_event_listener &operator=(const Rdb_event_listener &) = delete;
28
29 explicit Rdb_event_listener(Rdb_ddl_manager *const ddl_manager)
30 : m_ddl_manager(ddl_manager) {}
31
32 void OnCompactionCompleted(rocksdb::DB *db,
33 const rocksdb::CompactionJobInfo &ci) override;
34 void OnFlushCompleted(rocksdb::DB *db,
35 const rocksdb::FlushJobInfo &flush_job_info) override;
36 void OnExternalFileIngested(
37 rocksdb::DB *db,
38 const rocksdb::ExternalFileIngestionInfo &ingestion_info) override;
39
40 void OnBackgroundError(rocksdb::BackgroundErrorReason reason,
41 rocksdb::Status *status) override;
42
43private:
44 Rdb_ddl_manager *m_ddl_manager;
45
46 void update_index_stats(const rocksdb::TableProperties &props);
47};
48
49} // namespace myrocks
50