2021-08-12 04:31:44 +02:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-08-19 02:04:36 +02:00
|
|
|
#include <memory>
|
2021-08-12 04:31:44 +02:00
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "rocksdb/db.h"
|
|
|
|
#include "rocksdb/options.h"
|
|
|
|
#include "rocksdb/status.h"
|
2021-08-19 02:04:36 +02:00
|
|
|
#include "rocksdb/system_clock.h"
|
2021-08-12 04:31:44 +02:00
|
|
|
#include "rocksdb/trace_record.h"
|
|
|
|
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
|
|
|
|
// Handler to execute TraceRecord.
|
|
|
|
class TraceExecutionHandler : public TraceRecord::Handler {
|
|
|
|
public:
|
|
|
|
TraceExecutionHandler(DB* db,
|
|
|
|
const std::vector<ColumnFamilyHandle*>& handles);
|
|
|
|
virtual ~TraceExecutionHandler() override;
|
|
|
|
|
2021-08-19 02:04:36 +02:00
|
|
|
virtual Status Handle(const WriteQueryTraceRecord& record,
|
|
|
|
std::unique_ptr<TraceRecordResult>* result) override;
|
|
|
|
virtual Status Handle(const GetQueryTraceRecord& record,
|
|
|
|
std::unique_ptr<TraceRecordResult>* result) override;
|
|
|
|
virtual Status Handle(const IteratorSeekQueryTraceRecord& record,
|
|
|
|
std::unique_ptr<TraceRecordResult>* result) override;
|
|
|
|
virtual Status Handle(const MultiGetQueryTraceRecord& record,
|
|
|
|
std::unique_ptr<TraceRecordResult>* result) override;
|
2021-08-12 04:31:44 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
DB* db_;
|
|
|
|
std::unordered_map<uint32_t, ColumnFamilyHandle*> cf_map_;
|
|
|
|
WriteOptions write_opts_;
|
|
|
|
ReadOptions read_opts_;
|
2021-08-31 19:56:08 +02:00
|
|
|
SystemClock* clock_;
|
2021-08-12 04:31:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// To do: Handler for trace_analyzer.
|
|
|
|
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|