1 //  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
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).
5 //
6 // This file implements the callback "bridge" between Java and C++ for
7 // ROCKSDB_NAMESPACE::TraceWriter.
8 
9 #ifndef JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_
10 #define JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_
11 
12 #include <jni.h>
13 #include <memory>
14 
15 #include "rocksdb/trace_reader_writer.h"
16 #include "rocksjni/jnicallback.h"
17 
18 namespace ROCKSDB_NAMESPACE {
19 
20 class TraceWriterJniCallback : public JniCallback, public TraceWriter {
21  public:
22     TraceWriterJniCallback(
23         JNIEnv* env, jobject jtrace_writer);
24     virtual Status Write(const Slice& data);
25     virtual Status Close();
26     virtual uint64_t GetFileSize();
27 
28  private:
29     jmethodID m_jwrite_proxy_methodid;
30     jmethodID m_jclose_writer_proxy_methodid;
31     jmethodID m_jget_file_size_methodid;
32 };
33 
34 }  // namespace ROCKSDB_NAMESPACE
35 
36 #endif  // JAVA_ROCKSJNI_TRACE_WRITER_JNICALLBACK_H_
37