table_properties_collector_factory.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (c) Meta Platforms, Inc. and affiliates.
  2. //
  3. // This source code is licensed under both the GPLv2 (found in the
  4. // COPYING file in the root directory) and Apache 2.0 License
  5. // (found in the LICENSE.Apache file in the root directory).
  6. #include "java/rocksjni/table_properties_collector_factory.h"
  7. #include "java/include/org_rocksdb_TablePropertiesCollectorFactory.h"
  8. #include "java/rocksjni/cplusplus_to_java_convert.h"
  9. #include "rocksdb/db.h"
  10. #include "rocksdb/utilities/table_properties_collectors.h"
  11. /*
  12. * Class: org_rocksdb_TablePropertiesCollectorFactory
  13. * Method: newCompactOnDeletionCollectorFactory
  14. * Signature: (JJD)J
  15. */
  16. jlong Java_org_rocksdb_TablePropertiesCollectorFactory_newCompactOnDeletionCollectorFactory(
  17. JNIEnv *, jclass, jlong sliding_window_size, jlong deletion_trigger,
  18. jdouble deletion_ratio) {
  19. auto *wrapper = new TablePropertiesCollectorFactoriesJniWrapper();
  20. wrapper->table_properties_collector_factories =
  21. ROCKSDB_NAMESPACE::NewCompactOnDeletionCollectorFactory(
  22. sliding_window_size, deletion_trigger, deletion_ratio);
  23. return GET_CPLUSPLUS_POINTER(wrapper);
  24. }
  25. /*
  26. * Class: org_rocksdb_TablePropertiesCollectorFactory
  27. * Method: deleteCompactOnDeletionCollectorFactory
  28. * Signature: (J)J
  29. */
  30. void Java_org_rocksdb_TablePropertiesCollectorFactory_deleteCompactOnDeletionCollectorFactory(
  31. JNIEnv *, jclass, jlong jhandle) {
  32. auto instance =
  33. reinterpret_cast<TablePropertiesCollectorFactoriesJniWrapper *>(jhandle);
  34. delete instance;
  35. }