@nxtedition/rocksdb 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1088) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/LICENSE +21 -0
  3. package/README.md +102 -0
  4. package/UPGRADING.md +91 -0
  5. package/binding.cc +1276 -0
  6. package/binding.gyp +73 -0
  7. package/binding.js +1 -0
  8. package/chained-batch.js +44 -0
  9. package/deps/rocksdb/build_version.cc +4 -0
  10. package/deps/rocksdb/rocksdb/CMakeLists.txt +1356 -0
  11. package/deps/rocksdb/rocksdb/COPYING +339 -0
  12. package/deps/rocksdb/rocksdb/LICENSE.Apache +202 -0
  13. package/deps/rocksdb/rocksdb/LICENSE.leveldb +29 -0
  14. package/deps/rocksdb/rocksdb/Makefile +2521 -0
  15. package/deps/rocksdb/rocksdb/TARGETS +2100 -0
  16. package/deps/rocksdb/rocksdb/cache/cache.cc +63 -0
  17. package/deps/rocksdb/rocksdb/cache/cache_bench.cc +381 -0
  18. package/deps/rocksdb/rocksdb/cache/cache_helpers.h +114 -0
  19. package/deps/rocksdb/rocksdb/cache/cache_test.cc +775 -0
  20. package/deps/rocksdb/rocksdb/cache/clock_cache.cc +769 -0
  21. package/deps/rocksdb/rocksdb/cache/clock_cache.h +16 -0
  22. package/deps/rocksdb/rocksdb/cache/lru_cache.cc +574 -0
  23. package/deps/rocksdb/rocksdb/cache/lru_cache.h +339 -0
  24. package/deps/rocksdb/rocksdb/cache/lru_cache_test.cc +199 -0
  25. package/deps/rocksdb/rocksdb/cache/sharded_cache.cc +162 -0
  26. package/deps/rocksdb/rocksdb/cache/sharded_cache.h +111 -0
  27. package/deps/rocksdb/rocksdb/cmake/RocksDBConfig.cmake.in +54 -0
  28. package/deps/rocksdb/rocksdb/cmake/modules/CxxFlags.cmake +7 -0
  29. package/deps/rocksdb/rocksdb/cmake/modules/FindJeMalloc.cmake +29 -0
  30. package/deps/rocksdb/rocksdb/cmake/modules/FindNUMA.cmake +29 -0
  31. package/deps/rocksdb/rocksdb/cmake/modules/FindSnappy.cmake +29 -0
  32. package/deps/rocksdb/rocksdb/cmake/modules/FindTBB.cmake +33 -0
  33. package/deps/rocksdb/rocksdb/cmake/modules/Findgflags.cmake +29 -0
  34. package/deps/rocksdb/rocksdb/cmake/modules/Findlz4.cmake +29 -0
  35. package/deps/rocksdb/rocksdb/cmake/modules/Findzstd.cmake +29 -0
  36. package/deps/rocksdb/rocksdb/cmake/modules/ReadVersion.cmake +10 -0
  37. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.cc +108 -0
  38. package/deps/rocksdb/rocksdb/db/arena_wrapped_db_iter.h +115 -0
  39. package/deps/rocksdb/rocksdb/db/blob/blob_constants.h +16 -0
  40. package/deps/rocksdb/rocksdb/db/blob/blob_file_addition.cc +154 -0
  41. package/deps/rocksdb/rocksdb/db/blob/blob_file_addition.h +67 -0
  42. package/deps/rocksdb/rocksdb/db/blob/blob_file_addition_test.cc +206 -0
  43. package/deps/rocksdb/rocksdb/db/blob/blob_file_builder.cc +316 -0
  44. package/deps/rocksdb/rocksdb/db/blob/blob_file_builder.h +91 -0
  45. package/deps/rocksdb/rocksdb/db/blob/blob_file_builder_test.cc +660 -0
  46. package/deps/rocksdb/rocksdb/db/blob/blob_file_cache.cc +99 -0
  47. package/deps/rocksdb/rocksdb/db/blob/blob_file_cache.h +49 -0
  48. package/deps/rocksdb/rocksdb/db/blob/blob_file_cache_test.cc +268 -0
  49. package/deps/rocksdb/rocksdb/db/blob/blob_file_garbage.cc +134 -0
  50. package/deps/rocksdb/rocksdb/db/blob/blob_file_garbage.h +57 -0
  51. package/deps/rocksdb/rocksdb/db/blob/blob_file_garbage_test.cc +173 -0
  52. package/deps/rocksdb/rocksdb/db/blob/blob_file_meta.cc +55 -0
  53. package/deps/rocksdb/rocksdb/db/blob/blob_file_meta.h +164 -0
  54. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader.cc +423 -0
  55. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader.h +81 -0
  56. package/deps/rocksdb/rocksdb/db/blob/blob_file_reader_test.cc +771 -0
  57. package/deps/rocksdb/rocksdb/db/blob/blob_index.h +184 -0
  58. package/deps/rocksdb/rocksdb/db/blob/blob_log_format.cc +145 -0
  59. package/deps/rocksdb/rocksdb/db/blob/blob_log_format.h +148 -0
  60. package/deps/rocksdb/rocksdb/db/blob/blob_log_sequential_reader.cc +132 -0
  61. package/deps/rocksdb/rocksdb/db/blob/blob_log_sequential_reader.h +76 -0
  62. package/deps/rocksdb/rocksdb/db/blob/blob_log_writer.cc +168 -0
  63. package/deps/rocksdb/rocksdb/db/blob/blob_log_writer.h +83 -0
  64. package/deps/rocksdb/rocksdb/db/blob/db_blob_basic_test.cc +307 -0
  65. package/deps/rocksdb/rocksdb/db/blob/db_blob_index_test.cc +464 -0
  66. package/deps/rocksdb/rocksdb/db/builder.cc +358 -0
  67. package/deps/rocksdb/rocksdb/db/builder.h +95 -0
  68. package/deps/rocksdb/rocksdb/db/c.cc +5281 -0
  69. package/deps/rocksdb/rocksdb/db/c_test.c +2883 -0
  70. package/deps/rocksdb/rocksdb/db/column_family.cc +1602 -0
  71. package/deps/rocksdb/rocksdb/db/column_family.h +787 -0
  72. package/deps/rocksdb/rocksdb/db/column_family_test.cc +3427 -0
  73. package/deps/rocksdb/rocksdb/db/compact_files_test.cc +425 -0
  74. package/deps/rocksdb/rocksdb/db/compacted_db_impl.cc +169 -0
  75. package/deps/rocksdb/rocksdb/db/compacted_db_impl.h +118 -0
  76. package/deps/rocksdb/rocksdb/db/compaction/compaction.cc +591 -0
  77. package/deps/rocksdb/rocksdb/db/compaction/compaction.h +389 -0
  78. package/deps/rocksdb/rocksdb/db/compaction/compaction_iteration_stats.h +37 -0
  79. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.cc +1023 -0
  80. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator.h +353 -0
  81. package/deps/rocksdb/rocksdb/db/compaction/compaction_iterator_test.cc +1254 -0
  82. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +1917 -0
  83. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +208 -0
  84. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_stats_test.cc +1037 -0
  85. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +1224 -0
  86. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.cc +1135 -0
  87. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker.h +318 -0
  88. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.cc +255 -0
  89. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_fifo.h +57 -0
  90. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.cc +510 -0
  91. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_level.h +33 -0
  92. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +2190 -0
  93. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.cc +1103 -0
  94. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_universal.h +32 -0
  95. package/deps/rocksdb/rocksdb/db/compaction/sst_partitioner.cc +44 -0
  96. package/deps/rocksdb/rocksdb/db/comparator_db_test.cc +660 -0
  97. package/deps/rocksdb/rocksdb/db/convenience.cc +78 -0
  98. package/deps/rocksdb/rocksdb/db/corruption_test.cc +921 -0
  99. package/deps/rocksdb/rocksdb/db/cuckoo_table_db_test.cc +359 -0
  100. package/deps/rocksdb/rocksdb/db/db_basic_test.cc +3820 -0
  101. package/deps/rocksdb/rocksdb/db/db_block_cache_test.cc +1058 -0
  102. package/deps/rocksdb/rocksdb/db/db_bloom_filter_test.cc +2128 -0
  103. package/deps/rocksdb/rocksdb/db/db_compaction_filter_test.cc +851 -0
  104. package/deps/rocksdb/rocksdb/db/db_compaction_test.cc +6292 -0
  105. package/deps/rocksdb/rocksdb/db/db_dynamic_level_test.cc +509 -0
  106. package/deps/rocksdb/rocksdb/db/db_encryption_test.cc +130 -0
  107. package/deps/rocksdb/rocksdb/db/db_filesnapshot.cc +137 -0
  108. package/deps/rocksdb/rocksdb/db/db_flush_test.cc +1119 -0
  109. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +5057 -0
  110. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +2274 -0
  111. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +3421 -0
  112. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_debug.cc +298 -0
  113. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_experimental.cc +151 -0
  114. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +967 -0
  115. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +1806 -0
  116. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +270 -0
  117. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.h +146 -0
  118. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +683 -0
  119. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.h +333 -0
  120. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_write.cc +2024 -0
  121. package/deps/rocksdb/rocksdb/db/db_impl/db_secondary_test.cc +932 -0
  122. package/deps/rocksdb/rocksdb/db/db_info_dumper.cc +137 -0
  123. package/deps/rocksdb/rocksdb/db/db_info_dumper.h +15 -0
  124. package/deps/rocksdb/rocksdb/db/db_inplace_update_test.cc +178 -0
  125. package/deps/rocksdb/rocksdb/db/db_io_failure_test.cc +592 -0
  126. package/deps/rocksdb/rocksdb/db/db_iter.cc +1493 -0
  127. package/deps/rocksdb/rocksdb/db/db_iter.h +390 -0
  128. package/deps/rocksdb/rocksdb/db/db_iter_stress_test.cc +657 -0
  129. package/deps/rocksdb/rocksdb/db/db_iter_test.cc +3268 -0
  130. package/deps/rocksdb/rocksdb/db/db_iterator_test.cc +3197 -0
  131. package/deps/rocksdb/rocksdb/db/db_log_iter_test.cc +299 -0
  132. package/deps/rocksdb/rocksdb/db/db_logical_block_size_cache_test.cc +513 -0
  133. package/deps/rocksdb/rocksdb/db/db_memtable_test.cc +329 -0
  134. package/deps/rocksdb/rocksdb/db/db_merge_operand_test.cc +241 -0
  135. package/deps/rocksdb/rocksdb/db/db_merge_operator_test.cc +671 -0
  136. package/deps/rocksdb/rocksdb/db/db_options_test.cc +1022 -0
  137. package/deps/rocksdb/rocksdb/db/db_properties_test.cc +1723 -0
  138. package/deps/rocksdb/rocksdb/db/db_range_del_test.cc +1694 -0
  139. package/deps/rocksdb/rocksdb/db/db_sst_test.cc +1261 -0
  140. package/deps/rocksdb/rocksdb/db/db_statistics_test.cc +164 -0
  141. package/deps/rocksdb/rocksdb/db/db_table_properties_test.cc +488 -0
  142. package/deps/rocksdb/rocksdb/db/db_tailing_iter_test.cc +567 -0
  143. package/deps/rocksdb/rocksdb/db/db_test.cc +6736 -0
  144. package/deps/rocksdb/rocksdb/db/db_test2.cc +5408 -0
  145. package/deps/rocksdb/rocksdb/db/db_test_util.cc +1633 -0
  146. package/deps/rocksdb/rocksdb/db/db_test_util.h +1194 -0
  147. package/deps/rocksdb/rocksdb/db/db_universal_compaction_test.cc +2235 -0
  148. package/deps/rocksdb/rocksdb/db/db_wal_test.cc +1780 -0
  149. package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +2520 -0
  150. package/deps/rocksdb/rocksdb/db/db_with_timestamp_compaction_test.cc +119 -0
  151. package/deps/rocksdb/rocksdb/db/db_write_test.cc +465 -0
  152. package/deps/rocksdb/rocksdb/db/dbformat.cc +222 -0
  153. package/deps/rocksdb/rocksdb/db/dbformat.h +786 -0
  154. package/deps/rocksdb/rocksdb/db/dbformat_test.cc +206 -0
  155. package/deps/rocksdb/rocksdb/db/deletefile_test.cc +580 -0
  156. package/deps/rocksdb/rocksdb/db/error_handler.cc +726 -0
  157. package/deps/rocksdb/rocksdb/db/error_handler.h +117 -0
  158. package/deps/rocksdb/rocksdb/db/error_handler_fs_test.cc +2598 -0
  159. package/deps/rocksdb/rocksdb/db/event_helpers.cc +233 -0
  160. package/deps/rocksdb/rocksdb/db/event_helpers.h +57 -0
  161. package/deps/rocksdb/rocksdb/db/experimental.cc +50 -0
  162. package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +1559 -0
  163. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +910 -0
  164. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +195 -0
  165. package/deps/rocksdb/rocksdb/db/external_sst_file_test.cc +2936 -0
  166. package/deps/rocksdb/rocksdb/db/fault_injection_test.cc +556 -0
  167. package/deps/rocksdb/rocksdb/db/file_indexer.cc +216 -0
  168. package/deps/rocksdb/rocksdb/db/file_indexer.h +142 -0
  169. package/deps/rocksdb/rocksdb/db/file_indexer_test.cc +350 -0
  170. package/deps/rocksdb/rocksdb/db/filename_test.cc +179 -0
  171. package/deps/rocksdb/rocksdb/db/flush_job.cc +514 -0
  172. package/deps/rocksdb/rocksdb/db/flush_job.h +169 -0
  173. package/deps/rocksdb/rocksdb/db/flush_job_test.cc +647 -0
  174. package/deps/rocksdb/rocksdb/db/flush_scheduler.cc +86 -0
  175. package/deps/rocksdb/rocksdb/db/flush_scheduler.h +54 -0
  176. package/deps/rocksdb/rocksdb/db/forward_iterator.cc +1023 -0
  177. package/deps/rocksdb/rocksdb/db/forward_iterator.h +163 -0
  178. package/deps/rocksdb/rocksdb/db/forward_iterator_bench.cc +377 -0
  179. package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +282 -0
  180. package/deps/rocksdb/rocksdb/db/import_column_family_job.h +75 -0
  181. package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +632 -0
  182. package/deps/rocksdb/rocksdb/db/internal_stats.cc +1461 -0
  183. package/deps/rocksdb/rocksdb/db/internal_stats.h +712 -0
  184. package/deps/rocksdb/rocksdb/db/job_context.h +226 -0
  185. package/deps/rocksdb/rocksdb/db/listener_test.cc +1118 -0
  186. package/deps/rocksdb/rocksdb/db/log_format.h +48 -0
  187. package/deps/rocksdb/rocksdb/db/log_reader.cc +654 -0
  188. package/deps/rocksdb/rocksdb/db/log_reader.h +192 -0
  189. package/deps/rocksdb/rocksdb/db/log_test.cc +901 -0
  190. package/deps/rocksdb/rocksdb/db/log_writer.cc +164 -0
  191. package/deps/rocksdb/rocksdb/db/log_writer.h +115 -0
  192. package/deps/rocksdb/rocksdb/db/logs_with_prep_tracker.cc +67 -0
  193. package/deps/rocksdb/rocksdb/db/logs_with_prep_tracker.h +63 -0
  194. package/deps/rocksdb/rocksdb/db/lookup_key.h +66 -0
  195. package/deps/rocksdb/rocksdb/db/malloc_stats.cc +54 -0
  196. package/deps/rocksdb/rocksdb/db/malloc_stats.h +24 -0
  197. package/deps/rocksdb/rocksdb/db/manual_compaction_test.cc +296 -0
  198. package/deps/rocksdb/rocksdb/db/memtable.cc +1169 -0
  199. package/deps/rocksdb/rocksdb/db/memtable.h +554 -0
  200. package/deps/rocksdb/rocksdb/db/memtable_list.cc +888 -0
  201. package/deps/rocksdb/rocksdb/db/memtable_list.h +438 -0
  202. package/deps/rocksdb/rocksdb/db/memtable_list_test.cc +935 -0
  203. package/deps/rocksdb/rocksdb/db/merge_context.h +134 -0
  204. package/deps/rocksdb/rocksdb/db/merge_helper.cc +421 -0
  205. package/deps/rocksdb/rocksdb/db/merge_helper.h +197 -0
  206. package/deps/rocksdb/rocksdb/db/merge_helper_test.cc +290 -0
  207. package/deps/rocksdb/rocksdb/db/merge_operator.cc +86 -0
  208. package/deps/rocksdb/rocksdb/db/merge_test.cc +608 -0
  209. package/deps/rocksdb/rocksdb/db/obsolete_files_test.cc +338 -0
  210. package/deps/rocksdb/rocksdb/db/options_file_test.cc +119 -0
  211. package/deps/rocksdb/rocksdb/db/output_validator.cc +30 -0
  212. package/deps/rocksdb/rocksdb/db/output_validator.h +47 -0
  213. package/deps/rocksdb/rocksdb/db/perf_context_test.cc +993 -0
  214. package/deps/rocksdb/rocksdb/db/periodic_work_scheduler.cc +113 -0
  215. package/deps/rocksdb/rocksdb/db/periodic_work_scheduler.h +76 -0
  216. package/deps/rocksdb/rocksdb/db/periodic_work_scheduler_test.cc +231 -0
  217. package/deps/rocksdb/rocksdb/db/pinned_iterators_manager.h +87 -0
  218. package/deps/rocksdb/rocksdb/db/plain_table_db_test.cc +1374 -0
  219. package/deps/rocksdb/rocksdb/db/pre_release_callback.h +38 -0
  220. package/deps/rocksdb/rocksdb/db/prefix_test.cc +910 -0
  221. package/deps/rocksdb/rocksdb/db/range_del_aggregator.cc +489 -0
  222. package/deps/rocksdb/rocksdb/db/range_del_aggregator.h +446 -0
  223. package/deps/rocksdb/rocksdb/db/range_del_aggregator_bench.cc +260 -0
  224. package/deps/rocksdb/rocksdb/db/range_del_aggregator_test.cc +709 -0
  225. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.cc +439 -0
  226. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter.h +256 -0
  227. package/deps/rocksdb/rocksdb/db/range_tombstone_fragmenter_test.cc +552 -0
  228. package/deps/rocksdb/rocksdb/db/read_callback.h +53 -0
  229. package/deps/rocksdb/rocksdb/db/repair.cc +722 -0
  230. package/deps/rocksdb/rocksdb/db/repair_test.cc +390 -0
  231. package/deps/rocksdb/rocksdb/db/snapshot_checker.h +61 -0
  232. package/deps/rocksdb/rocksdb/db/snapshot_impl.cc +26 -0
  233. package/deps/rocksdb/rocksdb/db/snapshot_impl.h +167 -0
  234. package/deps/rocksdb/rocksdb/db/table_cache.cc +704 -0
  235. package/deps/rocksdb/rocksdb/db/table_cache.h +233 -0
  236. package/deps/rocksdb/rocksdb/db/table_properties_collector.cc +75 -0
  237. package/deps/rocksdb/rocksdb/db/table_properties_collector.h +107 -0
  238. package/deps/rocksdb/rocksdb/db/table_properties_collector_test.cc +517 -0
  239. package/deps/rocksdb/rocksdb/db/transaction_log_impl.cc +318 -0
  240. package/deps/rocksdb/rocksdb/db/transaction_log_impl.h +128 -0
  241. package/deps/rocksdb/rocksdb/db/trim_history_scheduler.cc +54 -0
  242. package/deps/rocksdb/rocksdb/db/trim_history_scheduler.h +44 -0
  243. package/deps/rocksdb/rocksdb/db/version_builder.cc +1078 -0
  244. package/deps/rocksdb/rocksdb/db/version_builder.h +69 -0
  245. package/deps/rocksdb/rocksdb/db/version_builder_test.cc +1551 -0
  246. package/deps/rocksdb/rocksdb/db/version_edit.cc +955 -0
  247. package/deps/rocksdb/rocksdb/db/version_edit.h +609 -0
  248. package/deps/rocksdb/rocksdb/db/version_edit_handler.cc +699 -0
  249. package/deps/rocksdb/rocksdb/db/version_edit_handler.h +252 -0
  250. package/deps/rocksdb/rocksdb/db/version_edit_test.cc +597 -0
  251. package/deps/rocksdb/rocksdb/db/version_set.cc +6333 -0
  252. package/deps/rocksdb/rocksdb/db/version_set.h +1485 -0
  253. package/deps/rocksdb/rocksdb/db/version_set_test.cc +3035 -0
  254. package/deps/rocksdb/rocksdb/db/wal_edit.cc +204 -0
  255. package/deps/rocksdb/rocksdb/db/wal_edit.h +166 -0
  256. package/deps/rocksdb/rocksdb/db/wal_edit_test.cc +214 -0
  257. package/deps/rocksdb/rocksdb/db/wal_manager.cc +517 -0
  258. package/deps/rocksdb/rocksdb/db/wal_manager.h +119 -0
  259. package/deps/rocksdb/rocksdb/db/wal_manager_test.cc +340 -0
  260. package/deps/rocksdb/rocksdb/db/write_batch.cc +2174 -0
  261. package/deps/rocksdb/rocksdb/db/write_batch_base.cc +94 -0
  262. package/deps/rocksdb/rocksdb/db/write_batch_internal.h +250 -0
  263. package/deps/rocksdb/rocksdb/db/write_batch_test.cc +907 -0
  264. package/deps/rocksdb/rocksdb/db/write_callback.h +27 -0
  265. package/deps/rocksdb/rocksdb/db/write_callback_test.cc +457 -0
  266. package/deps/rocksdb/rocksdb/db/write_controller.cc +128 -0
  267. package/deps/rocksdb/rocksdb/db/write_controller.h +144 -0
  268. package/deps/rocksdb/rocksdb/db/write_controller_test.cc +135 -0
  269. package/deps/rocksdb/rocksdb/db/write_thread.cc +796 -0
  270. package/deps/rocksdb/rocksdb/db/write_thread.h +433 -0
  271. package/deps/rocksdb/rocksdb/db_stress_tool/CMakeLists.txt +14 -0
  272. package/deps/rocksdb/rocksdb/db_stress_tool/batched_ops_stress.cc +341 -0
  273. package/deps/rocksdb/rocksdb/db_stress_tool/cf_consistency_stress.cc +520 -0
  274. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress.cc +23 -0
  275. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.cc +337 -0
  276. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +554 -0
  277. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_compaction_filter.h +79 -0
  278. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.cc +173 -0
  279. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_driver.h +17 -0
  280. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_env_wrapper.h +38 -0
  281. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +763 -0
  282. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_listener.h +222 -0
  283. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.cc +27 -0
  284. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_shared_state.h +428 -0
  285. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_stat.h +218 -0
  286. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_table_properties_collector.h +64 -0
  287. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +2430 -0
  288. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.h +237 -0
  289. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_tool.cc +343 -0
  290. package/deps/rocksdb/rocksdb/db_stress_tool/no_batched_ops_stress.cc +800 -0
  291. package/deps/rocksdb/rocksdb/env/composite_env_wrapper.h +920 -0
  292. package/deps/rocksdb/rocksdb/env/env.cc +733 -0
  293. package/deps/rocksdb/rocksdb/env/env_basic_test.cc +352 -0
  294. package/deps/rocksdb/rocksdb/env/env_chroot.cc +346 -0
  295. package/deps/rocksdb/rocksdb/env/env_chroot.h +22 -0
  296. package/deps/rocksdb/rocksdb/env/env_encryption.cc +1148 -0
  297. package/deps/rocksdb/rocksdb/env/env_encryption_ctr.h +137 -0
  298. package/deps/rocksdb/rocksdb/env/env_hdfs.cc +648 -0
  299. package/deps/rocksdb/rocksdb/env/env_posix.cc +514 -0
  300. package/deps/rocksdb/rocksdb/env/env_test.cc +2230 -0
  301. package/deps/rocksdb/rocksdb/env/file_system.cc +132 -0
  302. package/deps/rocksdb/rocksdb/env/file_system_tracer.cc +448 -0
  303. package/deps/rocksdb/rocksdb/env/file_system_tracer.h +415 -0
  304. package/deps/rocksdb/rocksdb/env/fs_posix.cc +1086 -0
  305. package/deps/rocksdb/rocksdb/env/io_posix.cc +1499 -0
  306. package/deps/rocksdb/rocksdb/env/io_posix.h +402 -0
  307. package/deps/rocksdb/rocksdb/env/io_posix_test.cc +140 -0
  308. package/deps/rocksdb/rocksdb/env/mock_env.cc +1066 -0
  309. package/deps/rocksdb/rocksdb/env/mock_env.h +41 -0
  310. package/deps/rocksdb/rocksdb/env/mock_env_test.cc +85 -0
  311. package/deps/rocksdb/rocksdb/file/delete_scheduler.cc +402 -0
  312. package/deps/rocksdb/rocksdb/file/delete_scheduler.h +150 -0
  313. package/deps/rocksdb/rocksdb/file/delete_scheduler_test.cc +717 -0
  314. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +156 -0
  315. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +99 -0
  316. package/deps/rocksdb/rocksdb/file/file_util.cc +268 -0
  317. package/deps/rocksdb/rocksdb/file/file_util.h +96 -0
  318. package/deps/rocksdb/rocksdb/file/filename.cc +473 -0
  319. package/deps/rocksdb/rocksdb/file/filename.h +182 -0
  320. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +188 -0
  321. package/deps/rocksdb/rocksdb/file/random_access_file_reader.cc +315 -0
  322. package/deps/rocksdb/rocksdb/file/random_access_file_reader.h +142 -0
  323. package/deps/rocksdb/rocksdb/file/random_access_file_reader_test.cc +482 -0
  324. package/deps/rocksdb/rocksdb/file/read_write_util.cc +67 -0
  325. package/deps/rocksdb/rocksdb/file/read_write_util.h +34 -0
  326. package/deps/rocksdb/rocksdb/file/readahead_raf.cc +169 -0
  327. package/deps/rocksdb/rocksdb/file/readahead_raf.h +29 -0
  328. package/deps/rocksdb/rocksdb/file/sequence_file_reader.cc +237 -0
  329. package/deps/rocksdb/rocksdb/file/sequence_file_reader.h +63 -0
  330. package/deps/rocksdb/rocksdb/file/sst_file_manager_impl.cc +552 -0
  331. package/deps/rocksdb/rocksdb/file/sst_file_manager_impl.h +203 -0
  332. package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +523 -0
  333. package/deps/rocksdb/rocksdb/file/writable_file_writer.h +251 -0
  334. package/deps/rocksdb/rocksdb/hdfs/env_hdfs.h +386 -0
  335. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +839 -0
  336. package/deps/rocksdb/rocksdb/include/rocksdb/c.h +2218 -0
  337. package/deps/rocksdb/rocksdb/include/rocksdb/cache.h +294 -0
  338. package/deps/rocksdb/rocksdb/include/rocksdb/cleanable.h +71 -0
  339. package/deps/rocksdb/rocksdb/include/rocksdb/compaction_filter.h +214 -0
  340. package/deps/rocksdb/rocksdb/include/rocksdb/compaction_job_stats.h +98 -0
  341. package/deps/rocksdb/rocksdb/include/rocksdb/comparator.h +137 -0
  342. package/deps/rocksdb/rocksdb/include/rocksdb/compression_type.h +40 -0
  343. package/deps/rocksdb/rocksdb/include/rocksdb/concurrent_task_limiter.h +46 -0
  344. package/deps/rocksdb/rocksdb/include/rocksdb/configurable.h +359 -0
  345. package/deps/rocksdb/rocksdb/include/rocksdb/convenience.h +499 -0
  346. package/deps/rocksdb/rocksdb/include/rocksdb/customizable.h +138 -0
  347. package/deps/rocksdb/rocksdb/include/rocksdb/db.h +1697 -0
  348. package/deps/rocksdb/rocksdb/include/rocksdb/db_bench_tool.h +11 -0
  349. package/deps/rocksdb/rocksdb/include/rocksdb/db_dump_tool.h +45 -0
  350. package/deps/rocksdb/rocksdb/include/rocksdb/db_stress_tool.h +11 -0
  351. package/deps/rocksdb/rocksdb/include/rocksdb/env.h +1671 -0
  352. package/deps/rocksdb/rocksdb/include/rocksdb/env_encryption.h +405 -0
  353. package/deps/rocksdb/rocksdb/include/rocksdb/experimental.h +29 -0
  354. package/deps/rocksdb/rocksdb/include/rocksdb/file_checksum.h +129 -0
  355. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +1472 -0
  356. package/deps/rocksdb/rocksdb/include/rocksdb/filter_policy.h +238 -0
  357. package/deps/rocksdb/rocksdb/include/rocksdb/flush_block_policy.h +61 -0
  358. package/deps/rocksdb/rocksdb/include/rocksdb/io_status.h +269 -0
  359. package/deps/rocksdb/rocksdb/include/rocksdb/iostats_context.h +56 -0
  360. package/deps/rocksdb/rocksdb/include/rocksdb/iterator.h +128 -0
  361. package/deps/rocksdb/rocksdb/include/rocksdb/ldb_tool.h +43 -0
  362. package/deps/rocksdb/rocksdb/include/rocksdb/listener.h +556 -0
  363. package/deps/rocksdb/rocksdb/include/rocksdb/memory_allocator.h +77 -0
  364. package/deps/rocksdb/rocksdb/include/rocksdb/memtablerep.h +385 -0
  365. package/deps/rocksdb/rocksdb/include/rocksdb/merge_operator.h +257 -0
  366. package/deps/rocksdb/rocksdb/include/rocksdb/metadata.h +155 -0
  367. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +1702 -0
  368. package/deps/rocksdb/rocksdb/include/rocksdb/perf_context.h +237 -0
  369. package/deps/rocksdb/rocksdb/include/rocksdb/perf_level.h +35 -0
  370. package/deps/rocksdb/rocksdb/include/rocksdb/persistent_cache.h +73 -0
  371. package/deps/rocksdb/rocksdb/include/rocksdb/rate_limiter.h +139 -0
  372. package/deps/rocksdb/rocksdb/include/rocksdb/rocksdb_namespace.h +10 -0
  373. package/deps/rocksdb/rocksdb/include/rocksdb/slice.h +269 -0
  374. package/deps/rocksdb/rocksdb/include/rocksdb/slice_transform.h +103 -0
  375. package/deps/rocksdb/rocksdb/include/rocksdb/snapshot.h +48 -0
  376. package/deps/rocksdb/rocksdb/include/rocksdb/sst_dump_tool.h +19 -0
  377. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_manager.h +136 -0
  378. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_reader.h +47 -0
  379. package/deps/rocksdb/rocksdb/include/rocksdb/sst_file_writer.h +145 -0
  380. package/deps/rocksdb/rocksdb/include/rocksdb/sst_partitioner.h +135 -0
  381. package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +592 -0
  382. package/deps/rocksdb/rocksdb/include/rocksdb/stats_history.h +69 -0
  383. package/deps/rocksdb/rocksdb/include/rocksdb/status.h +608 -0
  384. package/deps/rocksdb/rocksdb/include/rocksdb/table.h +711 -0
  385. package/deps/rocksdb/rocksdb/include/rocksdb/table_properties.h +280 -0
  386. package/deps/rocksdb/rocksdb/include/rocksdb/thread_status.h +188 -0
  387. package/deps/rocksdb/rocksdb/include/rocksdb/threadpool.h +58 -0
  388. package/deps/rocksdb/rocksdb/include/rocksdb/trace_reader_writer.h +48 -0
  389. package/deps/rocksdb/rocksdb/include/rocksdb/transaction_log.h +121 -0
  390. package/deps/rocksdb/rocksdb/include/rocksdb/types.h +74 -0
  391. package/deps/rocksdb/rocksdb/include/rocksdb/universal_compaction.h +86 -0
  392. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/backupable_db.h +535 -0
  393. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/checkpoint.h +61 -0
  394. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/convenience.h +10 -0
  395. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/db_ttl.h +72 -0
  396. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/debug.h +49 -0
  397. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/env_librados.h +175 -0
  398. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/env_mirror.h +180 -0
  399. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/info_log_finder.h +19 -0
  400. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/ldb_cmd.h +288 -0
  401. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/ldb_cmd_execute_result.h +71 -0
  402. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/leveldb_options.h +145 -0
  403. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/lua/rocks_lua_custom_library.h +43 -0
  404. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/lua/rocks_lua_util.h +55 -0
  405. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/memory_util.h +50 -0
  406. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/object_registry.h +205 -0
  407. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/optimistic_transaction_db.h +100 -0
  408. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/option_change_migration.h +19 -0
  409. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +876 -0
  410. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_util.h +128 -0
  411. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/sim_cache.h +94 -0
  412. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/stackable_db.h +504 -0
  413. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/table_properties_collectors.h +95 -0
  414. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction.h +626 -0
  415. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction_db.h +432 -0
  416. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/transaction_db_mutex.h +92 -0
  417. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/utility_db.h +34 -0
  418. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/write_batch_with_index.h +279 -0
  419. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +16 -0
  420. package/deps/rocksdb/rocksdb/include/rocksdb/wal_filter.h +102 -0
  421. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch.h +377 -0
  422. package/deps/rocksdb/rocksdb/include/rocksdb/write_batch_base.h +127 -0
  423. package/deps/rocksdb/rocksdb/include/rocksdb/write_buffer_manager.h +106 -0
  424. package/deps/rocksdb/rocksdb/logging/auto_roll_logger.cc +300 -0
  425. package/deps/rocksdb/rocksdb/logging/auto_roll_logger.h +165 -0
  426. package/deps/rocksdb/rocksdb/logging/auto_roll_logger_test.cc +684 -0
  427. package/deps/rocksdb/rocksdb/logging/env_logger.h +165 -0
  428. package/deps/rocksdb/rocksdb/logging/env_logger_test.cc +162 -0
  429. package/deps/rocksdb/rocksdb/logging/event_logger.cc +70 -0
  430. package/deps/rocksdb/rocksdb/logging/event_logger.h +203 -0
  431. package/deps/rocksdb/rocksdb/logging/event_logger_test.cc +43 -0
  432. package/deps/rocksdb/rocksdb/logging/log_buffer.cc +92 -0
  433. package/deps/rocksdb/rocksdb/logging/log_buffer.h +56 -0
  434. package/deps/rocksdb/rocksdb/logging/logging.h +68 -0
  435. package/deps/rocksdb/rocksdb/logging/posix_logger.h +185 -0
  436. package/deps/rocksdb/rocksdb/memory/allocator.h +57 -0
  437. package/deps/rocksdb/rocksdb/memory/arena.cc +233 -0
  438. package/deps/rocksdb/rocksdb/memory/arena.h +141 -0
  439. package/deps/rocksdb/rocksdb/memory/arena_test.cc +204 -0
  440. package/deps/rocksdb/rocksdb/memory/concurrent_arena.cc +47 -0
  441. package/deps/rocksdb/rocksdb/memory/concurrent_arena.h +218 -0
  442. package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.cc +206 -0
  443. package/deps/rocksdb/rocksdb/memory/jemalloc_nodump_allocator.h +78 -0
  444. package/deps/rocksdb/rocksdb/memory/memkind_kmem_allocator.cc +33 -0
  445. package/deps/rocksdb/rocksdb/memory/memkind_kmem_allocator.h +27 -0
  446. package/deps/rocksdb/rocksdb/memory/memkind_kmem_allocator_test.cc +102 -0
  447. package/deps/rocksdb/rocksdb/memory/memory_allocator.h +38 -0
  448. package/deps/rocksdb/rocksdb/memory/memory_usage.h +25 -0
  449. package/deps/rocksdb/rocksdb/memtable/alloc_tracker.cc +62 -0
  450. package/deps/rocksdb/rocksdb/memtable/hash_linklist_rep.cc +844 -0
  451. package/deps/rocksdb/rocksdb/memtable/hash_linklist_rep.h +49 -0
  452. package/deps/rocksdb/rocksdb/memtable/hash_skiplist_rep.cc +349 -0
  453. package/deps/rocksdb/rocksdb/memtable/hash_skiplist_rep.h +44 -0
  454. package/deps/rocksdb/rocksdb/memtable/inlineskiplist.h +997 -0
  455. package/deps/rocksdb/rocksdb/memtable/inlineskiplist_test.cc +663 -0
  456. package/deps/rocksdb/rocksdb/memtable/memtablerep_bench.cc +677 -0
  457. package/deps/rocksdb/rocksdb/memtable/skiplist.h +496 -0
  458. package/deps/rocksdb/rocksdb/memtable/skiplist_test.cc +388 -0
  459. package/deps/rocksdb/rocksdb/memtable/skiplistrep.cc +280 -0
  460. package/deps/rocksdb/rocksdb/memtable/stl_wrappers.h +33 -0
  461. package/deps/rocksdb/rocksdb/memtable/vectorrep.cc +301 -0
  462. package/deps/rocksdb/rocksdb/memtable/write_buffer_manager.cc +148 -0
  463. package/deps/rocksdb/rocksdb/memtable/write_buffer_manager_test.cc +203 -0
  464. package/deps/rocksdb/rocksdb/monitoring/file_read_sample.h +23 -0
  465. package/deps/rocksdb/rocksdb/monitoring/histogram.cc +287 -0
  466. package/deps/rocksdb/rocksdb/monitoring/histogram.h +149 -0
  467. package/deps/rocksdb/rocksdb/monitoring/histogram_test.cc +231 -0
  468. package/deps/rocksdb/rocksdb/monitoring/histogram_windowing.cc +200 -0
  469. package/deps/rocksdb/rocksdb/monitoring/histogram_windowing.h +84 -0
  470. package/deps/rocksdb/rocksdb/monitoring/in_memory_stats_history.cc +49 -0
  471. package/deps/rocksdb/rocksdb/monitoring/in_memory_stats_history.h +74 -0
  472. package/deps/rocksdb/rocksdb/monitoring/instrumented_mutex.cc +71 -0
  473. package/deps/rocksdb/rocksdb/monitoring/instrumented_mutex.h +98 -0
  474. package/deps/rocksdb/rocksdb/monitoring/iostats_context.cc +62 -0
  475. package/deps/rocksdb/rocksdb/monitoring/iostats_context_imp.h +60 -0
  476. package/deps/rocksdb/rocksdb/monitoring/iostats_context_test.cc +29 -0
  477. package/deps/rocksdb/rocksdb/monitoring/perf_context.cc +566 -0
  478. package/deps/rocksdb/rocksdb/monitoring/perf_context_imp.h +97 -0
  479. package/deps/rocksdb/rocksdb/monitoring/perf_level.cc +28 -0
  480. package/deps/rocksdb/rocksdb/monitoring/perf_level_imp.h +18 -0
  481. package/deps/rocksdb/rocksdb/monitoring/perf_step_timer.h +79 -0
  482. package/deps/rocksdb/rocksdb/monitoring/persistent_stats_history.cc +169 -0
  483. package/deps/rocksdb/rocksdb/monitoring/persistent_stats_history.h +83 -0
  484. package/deps/rocksdb/rocksdb/monitoring/statistics.cc +431 -0
  485. package/deps/rocksdb/rocksdb/monitoring/statistics.h +138 -0
  486. package/deps/rocksdb/rocksdb/monitoring/statistics_test.cc +47 -0
  487. package/deps/rocksdb/rocksdb/monitoring/stats_history_test.cc +652 -0
  488. package/deps/rocksdb/rocksdb/monitoring/thread_status_impl.cc +163 -0
  489. package/deps/rocksdb/rocksdb/monitoring/thread_status_updater.cc +314 -0
  490. package/deps/rocksdb/rocksdb/monitoring/thread_status_updater.h +233 -0
  491. package/deps/rocksdb/rocksdb/monitoring/thread_status_updater_debug.cc +43 -0
  492. package/deps/rocksdb/rocksdb/monitoring/thread_status_util.cc +206 -0
  493. package/deps/rocksdb/rocksdb/monitoring/thread_status_util.h +134 -0
  494. package/deps/rocksdb/rocksdb/monitoring/thread_status_util_debug.cc +32 -0
  495. package/deps/rocksdb/rocksdb/options/cf_options.cc +1026 -0
  496. package/deps/rocksdb/rocksdb/options/cf_options.h +308 -0
  497. package/deps/rocksdb/rocksdb/options/configurable.cc +681 -0
  498. package/deps/rocksdb/rocksdb/options/configurable_helper.h +251 -0
  499. package/deps/rocksdb/rocksdb/options/configurable_test.cc +757 -0
  500. package/deps/rocksdb/rocksdb/options/configurable_test.h +127 -0
  501. package/deps/rocksdb/rocksdb/options/customizable.cc +77 -0
  502. package/deps/rocksdb/rocksdb/options/customizable_helper.h +216 -0
  503. package/deps/rocksdb/rocksdb/options/customizable_test.cc +625 -0
  504. package/deps/rocksdb/rocksdb/options/db_options.cc +835 -0
  505. package/deps/rocksdb/rocksdb/options/db_options.h +126 -0
  506. package/deps/rocksdb/rocksdb/options/options.cc +664 -0
  507. package/deps/rocksdb/rocksdb/options/options_helper.cc +1391 -0
  508. package/deps/rocksdb/rocksdb/options/options_helper.h +118 -0
  509. package/deps/rocksdb/rocksdb/options/options_parser.cc +721 -0
  510. package/deps/rocksdb/rocksdb/options/options_parser.h +151 -0
  511. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +583 -0
  512. package/deps/rocksdb/rocksdb/options/options_test.cc +3794 -0
  513. package/deps/rocksdb/rocksdb/port/jemalloc_helper.h +106 -0
  514. package/deps/rocksdb/rocksdb/port/lang.h +16 -0
  515. package/deps/rocksdb/rocksdb/port/likely.h +18 -0
  516. package/deps/rocksdb/rocksdb/port/malloc.h +17 -0
  517. package/deps/rocksdb/rocksdb/port/port.h +21 -0
  518. package/deps/rocksdb/rocksdb/port/port_dirent.h +44 -0
  519. package/deps/rocksdb/rocksdb/port/port_example.h +101 -0
  520. package/deps/rocksdb/rocksdb/port/port_posix.cc +266 -0
  521. package/deps/rocksdb/rocksdb/port/port_posix.h +223 -0
  522. package/deps/rocksdb/rocksdb/port/stack_trace.cc +179 -0
  523. package/deps/rocksdb/rocksdb/port/stack_trace.h +28 -0
  524. package/deps/rocksdb/rocksdb/port/sys_time.h +47 -0
  525. package/deps/rocksdb/rocksdb/port/util_logger.h +20 -0
  526. package/deps/rocksdb/rocksdb/port/win/env_default.cc +45 -0
  527. package/deps/rocksdb/rocksdb/port/win/env_win.cc +1449 -0
  528. package/deps/rocksdb/rocksdb/port/win/env_win.h +294 -0
  529. package/deps/rocksdb/rocksdb/port/win/io_win.cc +1084 -0
  530. package/deps/rocksdb/rocksdb/port/win/io_win.h +494 -0
  531. package/deps/rocksdb/rocksdb/port/win/port_win.cc +283 -0
  532. package/deps/rocksdb/rocksdb/port/win/port_win.h +411 -0
  533. package/deps/rocksdb/rocksdb/port/win/win_jemalloc.cc +79 -0
  534. package/deps/rocksdb/rocksdb/port/win/win_logger.cc +194 -0
  535. package/deps/rocksdb/rocksdb/port/win/win_logger.h +67 -0
  536. package/deps/rocksdb/rocksdb/port/win/win_thread.cc +183 -0
  537. package/deps/rocksdb/rocksdb/port/win/win_thread.h +122 -0
  538. package/deps/rocksdb/rocksdb/port/win/xpress_win.cc +221 -0
  539. package/deps/rocksdb/rocksdb/port/win/xpress_win.h +26 -0
  540. package/deps/rocksdb/rocksdb/port/xpress.h +17 -0
  541. package/deps/rocksdb/rocksdb/src.mk +631 -0
  542. package/deps/rocksdb/rocksdb/table/adaptive/adaptive_table_factory.cc +126 -0
  543. package/deps/rocksdb/rocksdb/table/adaptive/adaptive_table_factory.h +57 -0
  544. package/deps/rocksdb/rocksdb/table/block_based/binary_search_index_reader.cc +73 -0
  545. package/deps/rocksdb/rocksdb/table/block_based/binary_search_index_reader.h +48 -0
  546. package/deps/rocksdb/rocksdb/table/block_based/block.cc +1049 -0
  547. package/deps/rocksdb/rocksdb/table/block_based/block.h +720 -0
  548. package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block.cc +348 -0
  549. package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block.h +119 -0
  550. package/deps/rocksdb/rocksdb/table/block_based/block_based_filter_block_test.cc +434 -0
  551. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +1835 -0
  552. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.h +193 -0
  553. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.cc +839 -0
  554. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_factory.h +95 -0
  555. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +383 -0
  556. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +251 -0
  557. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +3563 -0
  558. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +681 -0
  559. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +190 -0
  560. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +347 -0
  561. package/deps/rocksdb/rocksdb/table/block_based/block_builder.cc +201 -0
  562. package/deps/rocksdb/rocksdb/table/block_based/block_builder.h +78 -0
  563. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +66 -0
  564. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.h +32 -0
  565. package/deps/rocksdb/rocksdb/table/block_based/block_prefix_index.cc +232 -0
  566. package/deps/rocksdb/rocksdb/table/block_based/block_prefix_index.h +66 -0
  567. package/deps/rocksdb/rocksdb/table/block_based/block_test.cc +623 -0
  568. package/deps/rocksdb/rocksdb/table/block_based/block_type.h +30 -0
  569. package/deps/rocksdb/rocksdb/table/block_based/cachable_entry.h +220 -0
  570. package/deps/rocksdb/rocksdb/table/block_based/data_block_footer.cc +59 -0
  571. package/deps/rocksdb/rocksdb/table/block_based/data_block_footer.h +25 -0
  572. package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index.cc +93 -0
  573. package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index.h +136 -0
  574. package/deps/rocksdb/rocksdb/table/block_based/data_block_hash_index_test.cc +717 -0
  575. package/deps/rocksdb/rocksdb/table/block_based/filter_block.h +180 -0
  576. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +102 -0
  577. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.h +55 -0
  578. package/deps/rocksdb/rocksdb/table/block_based/filter_policy.cc +1407 -0
  579. package/deps/rocksdb/rocksdb/table/block_based/filter_policy_internal.h +168 -0
  580. package/deps/rocksdb/rocksdb/table/block_based/flush_block_policy.cc +88 -0
  581. package/deps/rocksdb/rocksdb/table/block_based/flush_block_policy.h +41 -0
  582. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.cc +344 -0
  583. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.h +139 -0
  584. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block_test.cc +333 -0
  585. package/deps/rocksdb/rocksdb/table/block_based/hash_index_reader.cc +147 -0
  586. package/deps/rocksdb/rocksdb/table/block_based/hash_index_reader.h +49 -0
  587. package/deps/rocksdb/rocksdb/table/block_based/index_builder.cc +248 -0
  588. package/deps/rocksdb/rocksdb/table/block_based/index_builder.h +444 -0
  589. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +54 -0
  590. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.h +85 -0
  591. package/deps/rocksdb/rocksdb/table/block_based/mock_block_based_table.h +56 -0
  592. package/deps/rocksdb/rocksdb/table/block_based/parsed_full_filter_block.cc +22 -0
  593. package/deps/rocksdb/rocksdb/table/block_based/parsed_full_filter_block.h +40 -0
  594. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +521 -0
  595. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.h +144 -0
  596. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block_test.cc +424 -0
  597. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.cc +163 -0
  598. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.h +142 -0
  599. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +186 -0
  600. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.h +51 -0
  601. package/deps/rocksdb/rocksdb/table/block_based/reader_common.cc +64 -0
  602. package/deps/rocksdb/rocksdb/table/block_based/reader_common.h +38 -0
  603. package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.cc +120 -0
  604. package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.h +59 -0
  605. package/deps/rocksdb/rocksdb/table/block_fetcher.cc +324 -0
  606. package/deps/rocksdb/rocksdb/table/block_fetcher.h +129 -0
  607. package/deps/rocksdb/rocksdb/table/block_fetcher_test.cc +534 -0
  608. package/deps/rocksdb/rocksdb/table/cleanable_test.cc +277 -0
  609. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder.cc +543 -0
  610. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder.h +136 -0
  611. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_builder_test.cc +663 -0
  612. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_factory.cc +107 -0
  613. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_factory.h +81 -0
  614. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_reader.cc +404 -0
  615. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_reader.h +101 -0
  616. package/deps/rocksdb/rocksdb/table/cuckoo/cuckoo_table_reader_test.cc +585 -0
  617. package/deps/rocksdb/rocksdb/table/format.cc +422 -0
  618. package/deps/rocksdb/rocksdb/table/format.h +348 -0
  619. package/deps/rocksdb/rocksdb/table/get_context.cc +408 -0
  620. package/deps/rocksdb/rocksdb/table/get_context.h +212 -0
  621. package/deps/rocksdb/rocksdb/table/internal_iterator.h +205 -0
  622. package/deps/rocksdb/rocksdb/table/iter_heap.h +42 -0
  623. package/deps/rocksdb/rocksdb/table/iterator.cc +210 -0
  624. package/deps/rocksdb/rocksdb/table/iterator_wrapper.h +180 -0
  625. package/deps/rocksdb/rocksdb/table/merger_test.cc +180 -0
  626. package/deps/rocksdb/rocksdb/table/merging_iterator.cc +481 -0
  627. package/deps/rocksdb/rocksdb/table/merging_iterator.h +64 -0
  628. package/deps/rocksdb/rocksdb/table/meta_blocks.cc +541 -0
  629. package/deps/rocksdb/rocksdb/table/meta_blocks.h +154 -0
  630. package/deps/rocksdb/rocksdb/table/mock_table.cc +328 -0
  631. package/deps/rocksdb/rocksdb/table/mock_table.h +89 -0
  632. package/deps/rocksdb/rocksdb/table/multiget_context.h +282 -0
  633. package/deps/rocksdb/rocksdb/table/persistent_cache_helper.cc +116 -0
  634. package/deps/rocksdb/rocksdb/table/persistent_cache_helper.h +44 -0
  635. package/deps/rocksdb/rocksdb/table/persistent_cache_options.h +34 -0
  636. package/deps/rocksdb/rocksdb/table/plain/plain_table_bloom.cc +78 -0
  637. package/deps/rocksdb/rocksdb/table/plain/plain_table_bloom.h +135 -0
  638. package/deps/rocksdb/rocksdb/table/plain/plain_table_builder.cc +332 -0
  639. package/deps/rocksdb/rocksdb/table/plain/plain_table_builder.h +153 -0
  640. package/deps/rocksdb/rocksdb/table/plain/plain_table_factory.cc +263 -0
  641. package/deps/rocksdb/rocksdb/table/plain/plain_table_factory.h +182 -0
  642. package/deps/rocksdb/rocksdb/table/plain/plain_table_index.cc +211 -0
  643. package/deps/rocksdb/rocksdb/table/plain/plain_table_index.h +249 -0
  644. package/deps/rocksdb/rocksdb/table/plain/plain_table_key_coding.cc +506 -0
  645. package/deps/rocksdb/rocksdb/table/plain/plain_table_key_coding.h +201 -0
  646. package/deps/rocksdb/rocksdb/table/plain/plain_table_reader.cc +781 -0
  647. package/deps/rocksdb/rocksdb/table/plain/plain_table_reader.h +247 -0
  648. package/deps/rocksdb/rocksdb/table/scoped_arena_iterator.h +61 -0
  649. package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +502 -0
  650. package/deps/rocksdb/rocksdb/table/sst_file_dumper.h +96 -0
  651. package/deps/rocksdb/rocksdb/table/sst_file_reader.cc +98 -0
  652. package/deps/rocksdb/rocksdb/table/sst_file_reader_test.cc +228 -0
  653. package/deps/rocksdb/rocksdb/table/sst_file_writer.cc +340 -0
  654. package/deps/rocksdb/rocksdb/table/sst_file_writer_collectors.h +94 -0
  655. package/deps/rocksdb/rocksdb/table/table_builder.h +203 -0
  656. package/deps/rocksdb/rocksdb/table/table_factory.cc +38 -0
  657. package/deps/rocksdb/rocksdb/table/table_properties.cc +300 -0
  658. package/deps/rocksdb/rocksdb/table/table_properties_internal.h +30 -0
  659. package/deps/rocksdb/rocksdb/table/table_reader.h +147 -0
  660. package/deps/rocksdb/rocksdb/table/table_reader_bench.cc +347 -0
  661. package/deps/rocksdb/rocksdb/table/table_reader_caller.h +39 -0
  662. package/deps/rocksdb/rocksdb/table/table_test.cc +4769 -0
  663. package/deps/rocksdb/rocksdb/table/two_level_iterator.cc +215 -0
  664. package/deps/rocksdb/rocksdb/table/two_level_iterator.h +43 -0
  665. package/deps/rocksdb/rocksdb/test_util/mock_time_env.cc +38 -0
  666. package/deps/rocksdb/rocksdb/test_util/mock_time_env.h +74 -0
  667. package/deps/rocksdb/rocksdb/test_util/sync_point.cc +93 -0
  668. package/deps/rocksdb/rocksdb/test_util/sync_point.h +161 -0
  669. package/deps/rocksdb/rocksdb/test_util/sync_point_impl.cc +129 -0
  670. package/deps/rocksdb/rocksdb/test_util/sync_point_impl.h +74 -0
  671. package/deps/rocksdb/rocksdb/test_util/testharness.cc +56 -0
  672. package/deps/rocksdb/rocksdb/test_util/testharness.h +53 -0
  673. package/deps/rocksdb/rocksdb/test_util/testutil.cc +566 -0
  674. package/deps/rocksdb/rocksdb/test_util/testutil.h +887 -0
  675. package/deps/rocksdb/rocksdb/test_util/testutil_test.cc +43 -0
  676. package/deps/rocksdb/rocksdb/test_util/transaction_test_util.cc +388 -0
  677. package/deps/rocksdb/rocksdb/test_util/transaction_test_util.h +132 -0
  678. package/deps/rocksdb/rocksdb/third-party/folly/folly/CPortability.h +27 -0
  679. package/deps/rocksdb/rocksdb/third-party/folly/folly/ConstexprMath.h +45 -0
  680. package/deps/rocksdb/rocksdb/third-party/folly/folly/Indestructible.h +166 -0
  681. package/deps/rocksdb/rocksdb/third-party/folly/folly/Optional.h +570 -0
  682. package/deps/rocksdb/rocksdb/third-party/folly/folly/Portability.h +92 -0
  683. package/deps/rocksdb/rocksdb/third-party/folly/folly/ScopeGuard.h +54 -0
  684. package/deps/rocksdb/rocksdb/third-party/folly/folly/Traits.h +152 -0
  685. package/deps/rocksdb/rocksdb/third-party/folly/folly/Unit.h +59 -0
  686. package/deps/rocksdb/rocksdb/third-party/folly/folly/Utility.h +141 -0
  687. package/deps/rocksdb/rocksdb/third-party/folly/folly/chrono/Hardware.h +33 -0
  688. package/deps/rocksdb/rocksdb/third-party/folly/folly/container/Array.h +74 -0
  689. package/deps/rocksdb/rocksdb/third-party/folly/folly/detail/Futex-inl.h +117 -0
  690. package/deps/rocksdb/rocksdb/third-party/folly/folly/detail/Futex.cpp +263 -0
  691. package/deps/rocksdb/rocksdb/third-party/folly/folly/detail/Futex.h +96 -0
  692. package/deps/rocksdb/rocksdb/third-party/folly/folly/functional/Invoke.h +40 -0
  693. package/deps/rocksdb/rocksdb/third-party/folly/folly/hash/Hash.h +29 -0
  694. package/deps/rocksdb/rocksdb/third-party/folly/folly/lang/Align.h +144 -0
  695. package/deps/rocksdb/rocksdb/third-party/folly/folly/lang/Bits.h +30 -0
  696. package/deps/rocksdb/rocksdb/third-party/folly/folly/lang/Launder.h +51 -0
  697. package/deps/rocksdb/rocksdb/third-party/folly/folly/portability/Asm.h +28 -0
  698. package/deps/rocksdb/rocksdb/third-party/folly/folly/portability/SysSyscall.h +10 -0
  699. package/deps/rocksdb/rocksdb/third-party/folly/folly/portability/SysTypes.h +26 -0
  700. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/AtomicNotification-inl.h +138 -0
  701. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/AtomicNotification.cpp +23 -0
  702. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/AtomicNotification.h +57 -0
  703. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/AtomicUtil-inl.h +260 -0
  704. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/AtomicUtil.h +52 -0
  705. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/Baton.h +328 -0
  706. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/DistributedMutex-inl.h +1703 -0
  707. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/DistributedMutex.cpp +16 -0
  708. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/DistributedMutex.h +304 -0
  709. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/DistributedMutexSpecializations.h +39 -0
  710. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/ParkingLot.cpp +26 -0
  711. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/ParkingLot.h +318 -0
  712. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/WaitOptions.cpp +12 -0
  713. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/WaitOptions.h +57 -0
  714. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/detail/InlineFunctionRef.h +219 -0
  715. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/detail/ProxyLockable-inl.h +207 -0
  716. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/detail/ProxyLockable.h +164 -0
  717. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/detail/Sleeper.h +57 -0
  718. package/deps/rocksdb/rocksdb/third-party/folly/folly/synchronization/detail/Spin.h +77 -0
  719. package/deps/rocksdb/rocksdb/third-party/gcc/ppc-asm.h +390 -0
  720. package/deps/rocksdb/rocksdb/thirdparty.inc +268 -0
  721. package/deps/rocksdb/rocksdb/tools/CMakeLists.txt +30 -0
  722. package/deps/rocksdb/rocksdb/tools/blob_dump.cc +110 -0
  723. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/__init__.py +2 -0
  724. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim.py +2000 -0
  725. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim.sh +156 -0
  726. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_pysim_test.py +734 -0
  727. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer.cc +2307 -0
  728. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer.h +395 -0
  729. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_plot.py +721 -0
  730. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_test.cc +719 -0
  731. package/deps/rocksdb/rocksdb/tools/block_cache_analyzer/block_cache_trace_analyzer_tool.cc +25 -0
  732. package/deps/rocksdb/rocksdb/tools/db_bench.cc +21 -0
  733. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +7416 -0
  734. package/deps/rocksdb/rocksdb/tools/db_bench_tool_test.cc +328 -0
  735. package/deps/rocksdb/rocksdb/tools/db_repl_stress.cc +130 -0
  736. package/deps/rocksdb/rocksdb/tools/db_sanity_test.cc +297 -0
  737. package/deps/rocksdb/rocksdb/tools/dump/db_dump_tool.cc +259 -0
  738. package/deps/rocksdb/rocksdb/tools/dump/rocksdb_dump.cc +63 -0
  739. package/deps/rocksdb/rocksdb/tools/dump/rocksdb_undump.cc +62 -0
  740. package/deps/rocksdb/rocksdb/tools/io_tracer_parser.cc +25 -0
  741. package/deps/rocksdb/rocksdb/tools/io_tracer_parser_test.cc +187 -0
  742. package/deps/rocksdb/rocksdb/tools/io_tracer_parser_tool.cc +120 -0
  743. package/deps/rocksdb/rocksdb/tools/io_tracer_parser_tool.h +40 -0
  744. package/deps/rocksdb/rocksdb/tools/ldb.cc +21 -0
  745. package/deps/rocksdb/rocksdb/tools/ldb_cmd.cc +3609 -0
  746. package/deps/rocksdb/rocksdb/tools/ldb_cmd_impl.h +665 -0
  747. package/deps/rocksdb/rocksdb/tools/ldb_cmd_test.cc +746 -0
  748. package/deps/rocksdb/rocksdb/tools/ldb_tool.cc +159 -0
  749. package/deps/rocksdb/rocksdb/tools/reduce_levels_test.cc +221 -0
  750. package/deps/rocksdb/rocksdb/tools/sst_dump.cc +20 -0
  751. package/deps/rocksdb/rocksdb/tools/sst_dump_test.cc +427 -0
  752. package/deps/rocksdb/rocksdb/tools/sst_dump_tool.cc +541 -0
  753. package/deps/rocksdb/rocksdb/tools/trace_analyzer.cc +25 -0
  754. package/deps/rocksdb/rocksdb/tools/trace_analyzer_test.cc +752 -0
  755. package/deps/rocksdb/rocksdb/tools/trace_analyzer_tool.cc +2001 -0
  756. package/deps/rocksdb/rocksdb/tools/trace_analyzer_tool.h +292 -0
  757. package/deps/rocksdb/rocksdb/tools/write_stress.cc +305 -0
  758. package/deps/rocksdb/rocksdb/trace_replay/block_cache_tracer.cc +496 -0
  759. package/deps/rocksdb/rocksdb/trace_replay/block_cache_tracer.h +294 -0
  760. package/deps/rocksdb/rocksdb/trace_replay/block_cache_tracer_test.cc +379 -0
  761. package/deps/rocksdb/rocksdb/trace_replay/io_tracer.cc +229 -0
  762. package/deps/rocksdb/rocksdb/trace_replay/io_tracer.h +174 -0
  763. package/deps/rocksdb/rocksdb/trace_replay/io_tracer_test.cc +215 -0
  764. package/deps/rocksdb/rocksdb/trace_replay/trace_replay.cc +491 -0
  765. package/deps/rocksdb/rocksdb/trace_replay/trace_replay.h +195 -0
  766. package/deps/rocksdb/rocksdb/util/aligned_buffer.h +255 -0
  767. package/deps/rocksdb/rocksdb/util/autovector.h +367 -0
  768. package/deps/rocksdb/rocksdb/util/autovector_test.cc +330 -0
  769. package/deps/rocksdb/rocksdb/util/bloom_impl.h +485 -0
  770. package/deps/rocksdb/rocksdb/util/bloom_test.cc +1191 -0
  771. package/deps/rocksdb/rocksdb/util/build_version.cc.in +5 -0
  772. package/deps/rocksdb/rocksdb/util/build_version.h +15 -0
  773. package/deps/rocksdb/rocksdb/util/cast_util.h +20 -0
  774. package/deps/rocksdb/rocksdb/util/channel.h +67 -0
  775. package/deps/rocksdb/rocksdb/util/coding.cc +89 -0
  776. package/deps/rocksdb/rocksdb/util/coding.h +419 -0
  777. package/deps/rocksdb/rocksdb/util/coding_lean.h +101 -0
  778. package/deps/rocksdb/rocksdb/util/coding_test.cc +217 -0
  779. package/deps/rocksdb/rocksdb/util/compaction_job_stats_impl.cc +92 -0
  780. package/deps/rocksdb/rocksdb/util/comparator.cc +219 -0
  781. package/deps/rocksdb/rocksdb/util/compression.h +1529 -0
  782. package/deps/rocksdb/rocksdb/util/compression_context_cache.cc +108 -0
  783. package/deps/rocksdb/rocksdb/util/compression_context_cache.h +47 -0
  784. package/deps/rocksdb/rocksdb/util/concurrent_task_limiter_impl.cc +67 -0
  785. package/deps/rocksdb/rocksdb/util/concurrent_task_limiter_impl.h +67 -0
  786. package/deps/rocksdb/rocksdb/util/core_local.h +83 -0
  787. package/deps/rocksdb/rocksdb/util/crc32c.cc +1283 -0
  788. package/deps/rocksdb/rocksdb/util/crc32c.h +51 -0
  789. package/deps/rocksdb/rocksdb/util/crc32c_arm64.cc +169 -0
  790. package/deps/rocksdb/rocksdb/util/crc32c_arm64.h +50 -0
  791. package/deps/rocksdb/rocksdb/util/crc32c_ppc.c +94 -0
  792. package/deps/rocksdb/rocksdb/util/crc32c_ppc.h +19 -0
  793. package/deps/rocksdb/rocksdb/util/crc32c_ppc_asm.S +756 -0
  794. package/deps/rocksdb/rocksdb/util/crc32c_ppc_constants.h +900 -0
  795. package/deps/rocksdb/rocksdb/util/crc32c_test.cc +180 -0
  796. package/deps/rocksdb/rocksdb/util/defer.h +52 -0
  797. package/deps/rocksdb/rocksdb/util/defer_test.cc +39 -0
  798. package/deps/rocksdb/rocksdb/util/duplicate_detector.h +68 -0
  799. package/deps/rocksdb/rocksdb/util/dynamic_bloom.cc +70 -0
  800. package/deps/rocksdb/rocksdb/util/dynamic_bloom.h +214 -0
  801. package/deps/rocksdb/rocksdb/util/dynamic_bloom_test.cc +323 -0
  802. package/deps/rocksdb/rocksdb/util/fastrange.h +112 -0
  803. package/deps/rocksdb/rocksdb/util/file_checksum_helper.cc +136 -0
  804. package/deps/rocksdb/rocksdb/util/file_checksum_helper.h +98 -0
  805. package/deps/rocksdb/rocksdb/util/file_reader_writer_test.cc +449 -0
  806. package/deps/rocksdb/rocksdb/util/filelock_test.cc +152 -0
  807. package/deps/rocksdb/rocksdb/util/filter_bench.cc +781 -0
  808. package/deps/rocksdb/rocksdb/util/gflags_compat.h +20 -0
  809. package/deps/rocksdb/rocksdb/util/hash.cc +83 -0
  810. package/deps/rocksdb/rocksdb/util/hash.h +107 -0
  811. package/deps/rocksdb/rocksdb/util/hash_map.h +67 -0
  812. package/deps/rocksdb/rocksdb/util/hash_test.cc +593 -0
  813. package/deps/rocksdb/rocksdb/util/heap.h +166 -0
  814. package/deps/rocksdb/rocksdb/util/heap_test.cc +139 -0
  815. package/deps/rocksdb/rocksdb/util/kv_map.h +33 -0
  816. package/deps/rocksdb/rocksdb/util/log_write_bench.cc +86 -0
  817. package/deps/rocksdb/rocksdb/util/math.h +186 -0
  818. package/deps/rocksdb/rocksdb/util/math128.h +298 -0
  819. package/deps/rocksdb/rocksdb/util/murmurhash.cc +191 -0
  820. package/deps/rocksdb/rocksdb/util/murmurhash.h +42 -0
  821. package/deps/rocksdb/rocksdb/util/mutexlock.h +186 -0
  822. package/deps/rocksdb/rocksdb/util/ppc-opcode.h +27 -0
  823. package/deps/rocksdb/rocksdb/util/random.cc +56 -0
  824. package/deps/rocksdb/rocksdb/util/random.h +186 -0
  825. package/deps/rocksdb/rocksdb/util/random_test.cc +105 -0
  826. package/deps/rocksdb/rocksdb/util/rate_limiter.cc +340 -0
  827. package/deps/rocksdb/rocksdb/util/rate_limiter.h +113 -0
  828. package/deps/rocksdb/rocksdb/util/rate_limiter_test.cc +251 -0
  829. package/deps/rocksdb/rocksdb/util/repeatable_thread.h +151 -0
  830. package/deps/rocksdb/rocksdb/util/repeatable_thread_test.cc +107 -0
  831. package/deps/rocksdb/rocksdb/util/ribbon_alg.h +1201 -0
  832. package/deps/rocksdb/rocksdb/util/ribbon_impl.h +1062 -0
  833. package/deps/rocksdb/rocksdb/util/ribbon_test.cc +931 -0
  834. package/deps/rocksdb/rocksdb/util/set_comparator.h +22 -0
  835. package/deps/rocksdb/rocksdb/util/slice.cc +243 -0
  836. package/deps/rocksdb/rocksdb/util/slice_test.cc +163 -0
  837. package/deps/rocksdb/rocksdb/util/slice_transform_test.cc +153 -0
  838. package/deps/rocksdb/rocksdb/util/status.cc +149 -0
  839. package/deps/rocksdb/rocksdb/util/stderr_logger.h +31 -0
  840. package/deps/rocksdb/rocksdb/util/stop_watch.h +118 -0
  841. package/deps/rocksdb/rocksdb/util/string_util.cc +422 -0
  842. package/deps/rocksdb/rocksdb/util/string_util.h +144 -0
  843. package/deps/rocksdb/rocksdb/util/thread_list_test.cc +354 -0
  844. package/deps/rocksdb/rocksdb/util/thread_local.cc +554 -0
  845. package/deps/rocksdb/rocksdb/util/thread_local.h +101 -0
  846. package/deps/rocksdb/rocksdb/util/thread_local_test.cc +583 -0
  847. package/deps/rocksdb/rocksdb/util/thread_operation.h +121 -0
  848. package/deps/rocksdb/rocksdb/util/threadpool_imp.cc +506 -0
  849. package/deps/rocksdb/rocksdb/util/threadpool_imp.h +112 -0
  850. package/deps/rocksdb/rocksdb/util/timer.h +331 -0
  851. package/deps/rocksdb/rocksdb/util/timer_queue.h +230 -0
  852. package/deps/rocksdb/rocksdb/util/timer_queue_test.cc +72 -0
  853. package/deps/rocksdb/rocksdb/util/timer_test.cc +399 -0
  854. package/deps/rocksdb/rocksdb/util/user_comparator_wrapper.h +80 -0
  855. package/deps/rocksdb/rocksdb/util/vector_iterator.h +101 -0
  856. package/deps/rocksdb/rocksdb/util/work_queue.h +148 -0
  857. package/deps/rocksdb/rocksdb/util/work_queue_test.cc +268 -0
  858. package/deps/rocksdb/rocksdb/util/xxh3p.h +1392 -0
  859. package/deps/rocksdb/rocksdb/util/xxhash.cc +1158 -0
  860. package/deps/rocksdb/rocksdb/util/xxhash.h +598 -0
  861. package/deps/rocksdb/rocksdb/utilities/backupable/backupable_db.cc +2354 -0
  862. package/deps/rocksdb/rocksdb/utilities/backupable/backupable_db_test.cc +2955 -0
  863. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_compaction_filter.cc +488 -0
  864. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_compaction_filter.h +199 -0
  865. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db.cc +112 -0
  866. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db.h +266 -0
  867. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_gc_stats.h +52 -0
  868. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl.cc +2167 -0
  869. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl.h +500 -0
  870. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_impl_filesnapshot.cc +113 -0
  871. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_iterator.h +147 -0
  872. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_listener.h +66 -0
  873. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_db_test.cc +2386 -0
  874. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_dump_tool.cc +281 -0
  875. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_dump_tool.h +58 -0
  876. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_file.cc +314 -0
  877. package/deps/rocksdb/rocksdb/utilities/blob_db/blob_file.h +244 -0
  878. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_compaction_filter.cc +47 -0
  879. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_compaction_filter.h +42 -0
  880. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_format_test.cc +375 -0
  881. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_functional_test.cc +327 -0
  882. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_row_merge_test.cc +114 -0
  883. package/deps/rocksdb/rocksdb/utilities/cassandra/cassandra_serialize_test.cc +187 -0
  884. package/deps/rocksdb/rocksdb/utilities/cassandra/format.cc +390 -0
  885. package/deps/rocksdb/rocksdb/utilities/cassandra/format.h +184 -0
  886. package/deps/rocksdb/rocksdb/utilities/cassandra/merge_operator.cc +67 -0
  887. package/deps/rocksdb/rocksdb/utilities/cassandra/merge_operator.h +44 -0
  888. package/deps/rocksdb/rocksdb/utilities/cassandra/serialize.h +75 -0
  889. package/deps/rocksdb/rocksdb/utilities/cassandra/test_utils.cc +72 -0
  890. package/deps/rocksdb/rocksdb/utilities/cassandra/test_utils.h +43 -0
  891. package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_impl.cc +588 -0
  892. package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_impl.h +82 -0
  893. package/deps/rocksdb/rocksdb/utilities/checkpoint/checkpoint_test.cc +821 -0
  894. package/deps/rocksdb/rocksdb/utilities/compaction_filters/layered_compaction_filter_base.h +37 -0
  895. package/deps/rocksdb/rocksdb/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc +29 -0
  896. package/deps/rocksdb/rocksdb/utilities/compaction_filters/remove_emptyvalue_compactionfilter.h +27 -0
  897. package/deps/rocksdb/rocksdb/utilities/convenience/info_log_finder.cc +25 -0
  898. package/deps/rocksdb/rocksdb/utilities/debug.cc +82 -0
  899. package/deps/rocksdb/rocksdb/utilities/env_librados.cc +1497 -0
  900. package/deps/rocksdb/rocksdb/utilities/env_librados_test.cc +1146 -0
  901. package/deps/rocksdb/rocksdb/utilities/env_mirror.cc +262 -0
  902. package/deps/rocksdb/rocksdb/utilities/env_mirror_test.cc +223 -0
  903. package/deps/rocksdb/rocksdb/utilities/env_timed.cc +145 -0
  904. package/deps/rocksdb/rocksdb/utilities/env_timed_test.cc +44 -0
  905. package/deps/rocksdb/rocksdb/utilities/fault_injection_env.cc +490 -0
  906. package/deps/rocksdb/rocksdb/utilities/fault_injection_env.h +242 -0
  907. package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.cc +581 -0
  908. package/deps/rocksdb/rocksdb/utilities/fault_injection_fs.h +437 -0
  909. package/deps/rocksdb/rocksdb/utilities/leveldb_options/leveldb_options.cc +56 -0
  910. package/deps/rocksdb/rocksdb/utilities/memory/memory_test.cc +275 -0
  911. package/deps/rocksdb/rocksdb/utilities/memory/memory_util.cc +52 -0
  912. package/deps/rocksdb/rocksdb/utilities/merge_operators/bytesxor.cc +59 -0
  913. package/deps/rocksdb/rocksdb/utilities/merge_operators/bytesxor.h +39 -0
  914. package/deps/rocksdb/rocksdb/utilities/merge_operators/max.cc +77 -0
  915. package/deps/rocksdb/rocksdb/utilities/merge_operators/put.cc +83 -0
  916. package/deps/rocksdb/rocksdb/utilities/merge_operators/sortlist.cc +97 -0
  917. package/deps/rocksdb/rocksdb/utilities/merge_operators/sortlist.h +38 -0
  918. package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend.cc +59 -0
  919. package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend.h +31 -0
  920. package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend2.cc +117 -0
  921. package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend2.h +49 -0
  922. package/deps/rocksdb/rocksdb/utilities/merge_operators/string_append/stringappend_test.cc +598 -0
  923. package/deps/rocksdb/rocksdb/utilities/merge_operators/uint64add.cc +69 -0
  924. package/deps/rocksdb/rocksdb/utilities/merge_operators.h +55 -0
  925. package/deps/rocksdb/rocksdb/utilities/object_registry.cc +87 -0
  926. package/deps/rocksdb/rocksdb/utilities/object_registry_test.cc +174 -0
  927. package/deps/rocksdb/rocksdb/utilities/option_change_migration/option_change_migration.cc +168 -0
  928. package/deps/rocksdb/rocksdb/utilities/option_change_migration/option_change_migration_test.cc +431 -0
  929. package/deps/rocksdb/rocksdb/utilities/options/options_util.cc +159 -0
  930. package/deps/rocksdb/rocksdb/utilities/options/options_util_test.cc +655 -0
  931. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier.cc +425 -0
  932. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier.h +156 -0
  933. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_file.cc +609 -0
  934. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_file.h +296 -0
  935. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_file_buffer.h +127 -0
  936. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_metadata.cc +86 -0
  937. package/deps/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_metadata.h +125 -0
  938. package/deps/rocksdb/rocksdb/utilities/persistent_cache/hash_table.h +238 -0
  939. package/deps/rocksdb/rocksdb/utilities/persistent_cache/hash_table_bench.cc +308 -0
  940. package/deps/rocksdb/rocksdb/utilities/persistent_cache/hash_table_evictable.h +168 -0
  941. package/deps/rocksdb/rocksdb/utilities/persistent_cache/hash_table_test.cc +160 -0
  942. package/deps/rocksdb/rocksdb/utilities/persistent_cache/lrulist.h +174 -0
  943. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_bench.cc +360 -0
  944. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_test.cc +456 -0
  945. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_test.h +286 -0
  946. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_tier.cc +167 -0
  947. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_tier.h +339 -0
  948. package/deps/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_util.h +67 -0
  949. package/deps/rocksdb/rocksdb/utilities/persistent_cache/volatile_tier_impl.cc +140 -0
  950. package/deps/rocksdb/rocksdb/utilities/persistent_cache/volatile_tier_impl.h +142 -0
  951. package/deps/rocksdb/rocksdb/utilities/simulator_cache/cache_simulator.cc +285 -0
  952. package/deps/rocksdb/rocksdb/utilities/simulator_cache/cache_simulator.h +231 -0
  953. package/deps/rocksdb/rocksdb/utilities/simulator_cache/cache_simulator_test.cc +494 -0
  954. package/deps/rocksdb/rocksdb/utilities/simulator_cache/sim_cache.cc +356 -0
  955. package/deps/rocksdb/rocksdb/utilities/simulator_cache/sim_cache_test.cc +224 -0
  956. package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.cc +122 -0
  957. package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector.h +72 -0
  958. package/deps/rocksdb/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc +244 -0
  959. package/deps/rocksdb/rocksdb/utilities/trace/file_trace_reader_writer.cc +125 -0
  960. package/deps/rocksdb/rocksdb/utilities/trace/file_trace_reader_writer.h +48 -0
  961. package/deps/rocksdb/rocksdb/utilities/transactions/lock/lock_manager.cc +29 -0
  962. package/deps/rocksdb/rocksdb/utilities/transactions/lock/lock_manager.h +82 -0
  963. package/deps/rocksdb/rocksdb/utilities/transactions/lock/lock_tracker.h +209 -0
  964. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_manager.cc +720 -0
  965. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_manager.h +223 -0
  966. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.cc +181 -0
  967. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_manager_test.h +319 -0
  968. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_tracker.cc +270 -0
  969. package/deps/rocksdb/rocksdb/utilities/transactions/lock/point/point_lock_tracker.h +99 -0
  970. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_lock_manager.h +30 -0
  971. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_locking_test.cc +306 -0
  972. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/COPYING.AGPLv3 +661 -0
  973. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/COPYING.APACHEv2 +174 -0
  974. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/COPYING.GPLv2 +339 -0
  975. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/db.h +76 -0
  976. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/ft/comparator.h +138 -0
  977. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/ft/ft-status.h +102 -0
  978. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.cc +139 -0
  979. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/concurrent_tree.h +174 -0
  980. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.cc +222 -0
  981. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/keyrange.h +141 -0
  982. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.cc +525 -0
  983. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/lock_request.h +253 -0
  984. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/locktree.cc +1007 -0
  985. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/locktree.h +560 -0
  986. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc +527 -0
  987. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.cc +265 -0
  988. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/range_buffer.h +178 -0
  989. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/treenode.cc +520 -0
  990. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/treenode.h +302 -0
  991. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.cc +120 -0
  992. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/txnid_set.h +92 -0
  993. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/wfg.cc +213 -0
  994. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/locktree/wfg.h +124 -0
  995. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/memory.h +215 -0
  996. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_assert_subst.h +39 -0
  997. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h +130 -0
  998. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_external_pthread.h +82 -0
  999. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_instrumentation.h +286 -0
  1000. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_portability.h +87 -0
  1001. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_pthread.h +520 -0
  1002. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_race_tools.h +179 -0
  1003. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +172 -0
  1004. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/portability/txn_subst.h +27 -0
  1005. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/standalone_port.cc +132 -0
  1006. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/dbt.cc +153 -0
  1007. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/dbt.h +98 -0
  1008. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/growable_array.h +144 -0
  1009. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/memarena.cc +201 -0
  1010. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/memarena.h +141 -0
  1011. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/omt.h +794 -0
  1012. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/omt_impl.h +1295 -0
  1013. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/partitioned_counter.h +165 -0
  1014. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/util/status.h +76 -0
  1015. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.cc +479 -0
  1016. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_manager.h +130 -0
  1017. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_tracker.cc +156 -0
  1018. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/range_tree_lock_tracker.h +146 -0
  1019. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction.cc +196 -0
  1020. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction.h +101 -0
  1021. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_db_impl.cc +111 -0
  1022. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_db_impl.h +87 -0
  1023. package/deps/rocksdb/rocksdb/utilities/transactions/optimistic_transaction_test.cc +1418 -0
  1024. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.cc +752 -0
  1025. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction.h +232 -0
  1026. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction_db.cc +628 -0
  1027. package/deps/rocksdb/rocksdb/utilities/transactions/pessimistic_transaction_db.h +228 -0
  1028. package/deps/rocksdb/rocksdb/utilities/transactions/snapshot_checker.cc +49 -0
  1029. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.cc +678 -0
  1030. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_base.h +373 -0
  1031. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_db_mutex_impl.cc +135 -0
  1032. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_db_mutex_impl.h +26 -0
  1033. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.cc +6350 -0
  1034. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_test.h +522 -0
  1035. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_util.cc +188 -0
  1036. package/deps/rocksdb/rocksdb/utilities/transactions/transaction_util.h +80 -0
  1037. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_transaction_test.cc +3531 -0
  1038. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.cc +483 -0
  1039. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn.h +119 -0
  1040. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.cc +999 -0
  1041. package/deps/rocksdb/rocksdb/utilities/transactions/write_prepared_txn_db.h +1109 -0
  1042. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_transaction_test.cc +786 -0
  1043. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.cc +1039 -0
  1044. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn.h +341 -0
  1045. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.cc +470 -0
  1046. package/deps/rocksdb/rocksdb/utilities/transactions/write_unprepared_txn_db.h +108 -0
  1047. package/deps/rocksdb/rocksdb/utilities/ttl/db_ttl_impl.cc +332 -0
  1048. package/deps/rocksdb/rocksdb/utilities/ttl/db_ttl_impl.h +353 -0
  1049. package/deps/rocksdb/rocksdb/utilities/ttl/ttl_test.cc +703 -0
  1050. package/deps/rocksdb/rocksdb/utilities/util_merge_operators_test.cc +99 -0
  1051. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index.cc +617 -0
  1052. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.cc +345 -0
  1053. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_internal.h +569 -0
  1054. package/deps/rocksdb/rocksdb/utilities/write_batch_with_index/write_batch_with_index_test.cc +1867 -0
  1055. package/deps/rocksdb/rocksdb.gyp +475 -0
  1056. package/deps/snappy/freebsd/config.h +135 -0
  1057. package/deps/snappy/freebsd/snappy-stubs-public.h +100 -0
  1058. package/deps/snappy/linux/config.h +135 -0
  1059. package/deps/snappy/linux/snappy-stubs-public.h +100 -0
  1060. package/deps/snappy/mac/config.h +137 -0
  1061. package/deps/snappy/mac/snappy-stubs-public.h +100 -0
  1062. package/deps/snappy/openbsd/config.h +135 -0
  1063. package/deps/snappy/openbsd/snappy-stubs-public.h +100 -0
  1064. package/deps/snappy/snappy-1.1.7/COPYING +54 -0
  1065. package/deps/snappy/snappy-1.1.7/cmake/SnappyConfig.cmake +1 -0
  1066. package/deps/snappy/snappy-1.1.7/cmake/config.h.in +62 -0
  1067. package/deps/snappy/snappy-1.1.7/snappy-c.cc +90 -0
  1068. package/deps/snappy/snappy-1.1.7/snappy-c.h +138 -0
  1069. package/deps/snappy/snappy-1.1.7/snappy-internal.h +224 -0
  1070. package/deps/snappy/snappy-1.1.7/snappy-sinksource.cc +104 -0
  1071. package/deps/snappy/snappy-1.1.7/snappy-sinksource.h +182 -0
  1072. package/deps/snappy/snappy-1.1.7/snappy-stubs-internal.cc +42 -0
  1073. package/deps/snappy/snappy-1.1.7/snappy-stubs-internal.h +561 -0
  1074. package/deps/snappy/snappy-1.1.7/snappy-stubs-public.h.in +94 -0
  1075. package/deps/snappy/snappy-1.1.7/snappy-test.cc +612 -0
  1076. package/deps/snappy/snappy-1.1.7/snappy-test.h +573 -0
  1077. package/deps/snappy/snappy-1.1.7/snappy.cc +1515 -0
  1078. package/deps/snappy/snappy-1.1.7/snappy.h +203 -0
  1079. package/deps/snappy/snappy-1.1.7/snappy_unittest.cc +1410 -0
  1080. package/deps/snappy/snappy.gyp +90 -0
  1081. package/deps/snappy/solaris/config.h +135 -0
  1082. package/deps/snappy/solaris/snappy-stubs-public.h +100 -0
  1083. package/deps/snappy/win32/config.h +29 -0
  1084. package/deps/snappy/win32/snappy-stubs-public.h +100 -0
  1085. package/iterator.js +55 -0
  1086. package/leveldown.js +113 -0
  1087. package/package-lock.json +23687 -0
  1088. package/package.json +70 -0
@@ -0,0 +1,1671 @@
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
+ // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
6
+ // Use of this source code is governed by a BSD-style license that can be
7
+ // found in the LICENSE file. See the AUTHORS file for names of contributors.
8
+ //
9
+ // An Env is an interface used by the rocksdb implementation to access
10
+ // operating system functionality like the filesystem etc. Callers
11
+ // may wish to provide a custom Env object when opening a database to
12
+ // get fine gain control; e.g., to rate limit file system operations.
13
+ //
14
+ // All Env implementations are safe for concurrent access from
15
+ // multiple threads without any external synchronization.
16
+
17
+ #pragma once
18
+
19
+ #include <stdint.h>
20
+ #include <cstdarg>
21
+ #include <functional>
22
+ #include <limits>
23
+ #include <memory>
24
+ #include <string>
25
+ #include <vector>
26
+ #include "rocksdb/status.h"
27
+ #include "rocksdb/thread_status.h"
28
+
29
+ #ifdef _WIN32
30
+ // Windows API macro interference
31
+ #undef DeleteFile
32
+ #undef GetCurrentTime
33
+ #undef LoadLibrary
34
+ #endif
35
+
36
+ #if defined(__GNUC__) || defined(__clang__)
37
+ #define ROCKSDB_PRINTF_FORMAT_ATTR(format_param, dots_param) \
38
+ __attribute__((__format__(__printf__, format_param, dots_param)))
39
+ #else
40
+ #define ROCKSDB_PRINTF_FORMAT_ATTR(format_param, dots_param)
41
+ #endif
42
+
43
+ namespace ROCKSDB_NAMESPACE {
44
+
45
+ class DynamicLibrary;
46
+ class FileLock;
47
+ class Logger;
48
+ class RandomAccessFile;
49
+ class SequentialFile;
50
+ class Slice;
51
+ class WritableFile;
52
+ class RandomRWFile;
53
+ class MemoryMappedFileBuffer;
54
+ class Directory;
55
+ struct DBOptions;
56
+ struct ImmutableDBOptions;
57
+ struct MutableDBOptions;
58
+ class RateLimiter;
59
+ class ThreadStatusUpdater;
60
+ struct ThreadStatus;
61
+ class FileSystem;
62
+
63
+ const size_t kDefaultPageSize = 4 * 1024;
64
+
65
+ enum class CpuPriority {
66
+ kIdle = 0,
67
+ kLow = 1,
68
+ kNormal = 2,
69
+ kHigh = 3,
70
+ };
71
+
72
+ // Options while opening a file to read/write
73
+ struct EnvOptions {
74
+ // Construct with default Options
75
+ EnvOptions();
76
+
77
+ // Construct from Options
78
+ explicit EnvOptions(const DBOptions& options);
79
+
80
+ // If true, then use mmap to read data
81
+ bool use_mmap_reads = false;
82
+
83
+ // If true, then use mmap to write data
84
+ bool use_mmap_writes = true;
85
+
86
+ // If true, then use O_DIRECT for reading data
87
+ bool use_direct_reads = false;
88
+
89
+ // If true, then use O_DIRECT for writing data
90
+ bool use_direct_writes = false;
91
+
92
+ // If false, fallocate() calls are bypassed
93
+ bool allow_fallocate = true;
94
+
95
+ // If true, set the FD_CLOEXEC on open fd.
96
+ bool set_fd_cloexec = true;
97
+
98
+ // Allows OS to incrementally sync files to disk while they are being
99
+ // written, in the background. Issue one request for every bytes_per_sync
100
+ // written. 0 turns it off.
101
+ // Default: 0
102
+ uint64_t bytes_per_sync = 0;
103
+
104
+ // When true, guarantees the file has at most `bytes_per_sync` bytes submitted
105
+ // for writeback at any given time.
106
+ //
107
+ // - If `sync_file_range` is supported it achieves this by waiting for any
108
+ // prior `sync_file_range`s to finish before proceeding. In this way,
109
+ // processing (compression, etc.) can proceed uninhibited in the gap
110
+ // between `sync_file_range`s, and we block only when I/O falls behind.
111
+ // - Otherwise the `WritableFile::Sync` method is used. Note this mechanism
112
+ // always blocks, thus preventing the interleaving of I/O and processing.
113
+ //
114
+ // Note: Enabling this option does not provide any additional persistence
115
+ // guarantees, as it may use `sync_file_range`, which does not write out
116
+ // metadata.
117
+ //
118
+ // Default: false
119
+ bool strict_bytes_per_sync = false;
120
+
121
+ // If true, we will preallocate the file with FALLOC_FL_KEEP_SIZE flag, which
122
+ // means that file size won't change as part of preallocation.
123
+ // If false, preallocation will also change the file size. This option will
124
+ // improve the performance in workloads where you sync the data on every
125
+ // write. By default, we set it to true for MANIFEST writes and false for
126
+ // WAL writes
127
+ bool fallocate_with_keep_size = true;
128
+
129
+ // See DBOptions doc
130
+ size_t compaction_readahead_size = 0;
131
+
132
+ // See DBOptions doc
133
+ size_t random_access_max_buffer_size = 0;
134
+
135
+ // See DBOptions doc
136
+ size_t writable_file_max_buffer_size = 1024 * 1024;
137
+
138
+ // If not nullptr, write rate limiting is enabled for flush and compaction
139
+ RateLimiter* rate_limiter = nullptr;
140
+ };
141
+
142
+ class Env {
143
+ public:
144
+ struct FileAttributes {
145
+ // File name
146
+ std::string name;
147
+
148
+ // Size of file in bytes
149
+ uint64_t size_bytes;
150
+ };
151
+
152
+ Env();
153
+ // Construct an Env with a separate FileSystem implementation
154
+ Env(std::shared_ptr<FileSystem> fs);
155
+ // No copying allowed
156
+ Env(const Env&) = delete;
157
+ void operator=(const Env&) = delete;
158
+
159
+ virtual ~Env();
160
+
161
+ static const char* Type() { return "Environment"; }
162
+
163
+ // Loads the environment specified by the input value into the result
164
+ static Status LoadEnv(const std::string& value, Env** result);
165
+
166
+ // Loads the environment specified by the input value into the result
167
+ static Status LoadEnv(const std::string& value, Env** result,
168
+ std::shared_ptr<Env>* guard);
169
+
170
+ // Return a default environment suitable for the current operating
171
+ // system. Sophisticated users may wish to provide their own Env
172
+ // implementation instead of relying on this default environment.
173
+ //
174
+ // The result of Default() belongs to rocksdb and must never be deleted.
175
+ static Env* Default();
176
+
177
+ // See FileSystem::RegisterDbPaths.
178
+ virtual Status RegisterDbPaths(const std::vector<std::string>& /*paths*/) {
179
+ return Status::OK();
180
+ }
181
+ // See FileSystem::UnregisterDbPaths.
182
+ virtual Status UnregisterDbPaths(const std::vector<std::string>& /*paths*/) {
183
+ return Status::OK();
184
+ }
185
+
186
+ // Create a brand new sequentially-readable file with the specified name.
187
+ // On success, stores a pointer to the new file in *result and returns OK.
188
+ // On failure stores nullptr in *result and returns non-OK. If the file does
189
+ // not exist, returns a non-OK status.
190
+ //
191
+ // The returned file will only be accessed by one thread at a time.
192
+ virtual Status NewSequentialFile(const std::string& fname,
193
+ std::unique_ptr<SequentialFile>* result,
194
+ const EnvOptions& options) = 0;
195
+
196
+ // Create a brand new random access read-only file with the
197
+ // specified name. On success, stores a pointer to the new file in
198
+ // *result and returns OK. On failure stores nullptr in *result and
199
+ // returns non-OK. If the file does not exist, returns a non-OK
200
+ // status.
201
+ //
202
+ // The returned file may be concurrently accessed by multiple threads.
203
+ virtual Status NewRandomAccessFile(const std::string& fname,
204
+ std::unique_ptr<RandomAccessFile>* result,
205
+ const EnvOptions& options) = 0;
206
+ // These values match Linux definition
207
+ // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fcntl.h#n56
208
+ enum WriteLifeTimeHint {
209
+ WLTH_NOT_SET = 0, // No hint information set
210
+ WLTH_NONE, // No hints about write life time
211
+ WLTH_SHORT, // Data written has a short life time
212
+ WLTH_MEDIUM, // Data written has a medium life time
213
+ WLTH_LONG, // Data written has a long life time
214
+ WLTH_EXTREME, // Data written has an extremely long life time
215
+ };
216
+
217
+ // Create an object that writes to a new file with the specified
218
+ // name. Deletes any existing file with the same name and creates a
219
+ // new file. On success, stores a pointer to the new file in
220
+ // *result and returns OK. On failure stores nullptr in *result and
221
+ // returns non-OK.
222
+ //
223
+ // The returned file will only be accessed by one thread at a time.
224
+ virtual Status NewWritableFile(const std::string& fname,
225
+ std::unique_ptr<WritableFile>* result,
226
+ const EnvOptions& options) = 0;
227
+
228
+ // Create an object that writes to a new file with the specified
229
+ // name. Deletes any existing file with the same name and creates a
230
+ // new file. On success, stores a pointer to the new file in
231
+ // *result and returns OK. On failure stores nullptr in *result and
232
+ // returns non-OK.
233
+ //
234
+ // The returned file will only be accessed by one thread at a time.
235
+ virtual Status ReopenWritableFile(const std::string& /*fname*/,
236
+ std::unique_ptr<WritableFile>* /*result*/,
237
+ const EnvOptions& /*options*/) {
238
+ return Status::NotSupported("Env::ReopenWritableFile() not supported.");
239
+ }
240
+
241
+ // Reuse an existing file by renaming it and opening it as writable.
242
+ virtual Status ReuseWritableFile(const std::string& fname,
243
+ const std::string& old_fname,
244
+ std::unique_ptr<WritableFile>* result,
245
+ const EnvOptions& options);
246
+
247
+ // Open `fname` for random read and write, if file doesn't exist the file
248
+ // will be created. On success, stores a pointer to the new file in
249
+ // *result and returns OK. On failure returns non-OK.
250
+ //
251
+ // The returned file will only be accessed by one thread at a time.
252
+ virtual Status NewRandomRWFile(const std::string& /*fname*/,
253
+ std::unique_ptr<RandomRWFile>* /*result*/,
254
+ const EnvOptions& /*options*/) {
255
+ return Status::NotSupported("RandomRWFile is not implemented in this Env");
256
+ }
257
+
258
+ // Opens `fname` as a memory-mapped file for read and write (in-place updates
259
+ // only, i.e., no appends). On success, stores a raw buffer covering the whole
260
+ // file in `*result`. The file must exist prior to this call.
261
+ virtual Status NewMemoryMappedFileBuffer(
262
+ const std::string& /*fname*/,
263
+ std::unique_ptr<MemoryMappedFileBuffer>* /*result*/) {
264
+ return Status::NotSupported(
265
+ "MemoryMappedFileBuffer is not implemented in this Env");
266
+ }
267
+
268
+ // Create an object that represents a directory. Will fail if directory
269
+ // doesn't exist. If the directory exists, it will open the directory
270
+ // and create a new Directory object.
271
+ //
272
+ // On success, stores a pointer to the new Directory in
273
+ // *result and returns OK. On failure stores nullptr in *result and
274
+ // returns non-OK.
275
+ virtual Status NewDirectory(const std::string& name,
276
+ std::unique_ptr<Directory>* result) = 0;
277
+
278
+ // Returns OK if the named file exists.
279
+ // NotFound if the named file does not exist,
280
+ // the calling process does not have permission to determine
281
+ // whether this file exists, or if the path is invalid.
282
+ // IOError if an IO Error was encountered
283
+ virtual Status FileExists(const std::string& fname) = 0;
284
+
285
+ // Store in *result the names of the children of the specified directory.
286
+ // The names are relative to "dir", and shall never include the
287
+ // names `.` or `..`.
288
+ // Original contents of *results are dropped.
289
+ // Returns OK if "dir" exists and "*result" contains its children.
290
+ // NotFound if "dir" does not exist, the calling process does not have
291
+ // permission to access "dir", or if "dir" is invalid.
292
+ // IOError if an IO Error was encountered
293
+ virtual Status GetChildren(const std::string& dir,
294
+ std::vector<std::string>* result) = 0;
295
+
296
+ // Store in *result the attributes of the children of the specified directory.
297
+ // In case the implementation lists the directory prior to iterating the files
298
+ // and files are concurrently deleted, the deleted files will be omitted from
299
+ // result.
300
+ // The name attributes are relative to "dir", and shall never include the
301
+ // names `.` or `..`.
302
+ // Original contents of *results are dropped.
303
+ // Returns OK if "dir" exists and "*result" contains its children.
304
+ // NotFound if "dir" does not exist, the calling process does not have
305
+ // permission to access "dir", or if "dir" is invalid.
306
+ // IOError if an IO Error was encountered
307
+ virtual Status GetChildrenFileAttributes(const std::string& dir,
308
+ std::vector<FileAttributes>* result);
309
+
310
+ // Delete the named file.
311
+ virtual Status DeleteFile(const std::string& fname) = 0;
312
+
313
+ // Truncate the named file to the specified size.
314
+ virtual Status Truncate(const std::string& /*fname*/, size_t /*size*/) {
315
+ return Status::NotSupported("Truncate is not supported for this Env");
316
+ }
317
+
318
+ // Create the specified directory. Returns error if directory exists.
319
+ virtual Status CreateDir(const std::string& dirname) = 0;
320
+
321
+ // Creates directory if missing. Return Ok if it exists, or successful in
322
+ // Creating.
323
+ virtual Status CreateDirIfMissing(const std::string& dirname) = 0;
324
+
325
+ // Delete the specified directory.
326
+ // Many implementations of this function will only delete a directory if it is
327
+ // empty.
328
+ virtual Status DeleteDir(const std::string& dirname) = 0;
329
+
330
+ // Store the size of fname in *file_size.
331
+ virtual Status GetFileSize(const std::string& fname, uint64_t* file_size) = 0;
332
+
333
+ // Store the last modification time of fname in *file_mtime.
334
+ virtual Status GetFileModificationTime(const std::string& fname,
335
+ uint64_t* file_mtime) = 0;
336
+ // Rename file src to target.
337
+ virtual Status RenameFile(const std::string& src,
338
+ const std::string& target) = 0;
339
+
340
+ // Hard Link file src to target.
341
+ virtual Status LinkFile(const std::string& /*src*/,
342
+ const std::string& /*target*/) {
343
+ return Status::NotSupported("LinkFile is not supported for this Env");
344
+ }
345
+
346
+ virtual Status NumFileLinks(const std::string& /*fname*/,
347
+ uint64_t* /*count*/) {
348
+ return Status::NotSupported(
349
+ "Getting number of file links is not supported for this Env");
350
+ }
351
+
352
+ virtual Status AreFilesSame(const std::string& /*first*/,
353
+ const std::string& /*second*/, bool* /*res*/) {
354
+ return Status::NotSupported("AreFilesSame is not supported for this Env");
355
+ }
356
+
357
+ // Lock the specified file. Used to prevent concurrent access to
358
+ // the same db by multiple processes. On failure, stores nullptr in
359
+ // *lock and returns non-OK.
360
+ //
361
+ // On success, stores a pointer to the object that represents the
362
+ // acquired lock in *lock and returns OK. The caller should call
363
+ // UnlockFile(*lock) to release the lock. If the process exits,
364
+ // the lock will be automatically released.
365
+ //
366
+ // If somebody else already holds the lock, finishes immediately
367
+ // with a failure. I.e., this call does not wait for existing locks
368
+ // to go away.
369
+ //
370
+ // May create the named file if it does not already exist.
371
+ virtual Status LockFile(const std::string& fname, FileLock** lock) = 0;
372
+
373
+ // Release the lock acquired by a previous successful call to LockFile.
374
+ // REQUIRES: lock was returned by a successful LockFile() call
375
+ // REQUIRES: lock has not already been unlocked.
376
+ virtual Status UnlockFile(FileLock* lock) = 0;
377
+
378
+ // Opens `lib_name` as a dynamic library.
379
+ // If the 'search_path' is specified, breaks the path into its components
380
+ // based on the appropriate platform separator (";" or ";") and looks for the
381
+ // library in those directories. If 'search path is not specified, uses the
382
+ // default library path search mechanism (such as LD_LIBRARY_PATH). On
383
+ // success, stores a dynamic library in `*result`.
384
+ virtual Status LoadLibrary(const std::string& /*lib_name*/,
385
+ const std::string& /*search_path */,
386
+ std::shared_ptr<DynamicLibrary>* /*result*/) {
387
+ return Status::NotSupported("LoadLibrary is not implemented in this Env");
388
+ }
389
+
390
+ // Priority for scheduling job in thread pool
391
+ enum Priority { BOTTOM, LOW, HIGH, USER, TOTAL };
392
+
393
+ static std::string PriorityToString(Priority priority);
394
+
395
+ // Priority for requesting bytes in rate limiter scheduler
396
+ enum IOPriority { IO_LOW = 0, IO_HIGH = 1, IO_TOTAL = 2 };
397
+
398
+ // Arrange to run "(*function)(arg)" once in a background thread, in
399
+ // the thread pool specified by pri. By default, jobs go to the 'LOW'
400
+ // priority thread pool.
401
+
402
+ // "function" may run in an unspecified thread. Multiple functions
403
+ // added to the same Env may run concurrently in different threads.
404
+ // I.e., the caller may not assume that background work items are
405
+ // serialized.
406
+ // When the UnSchedule function is called, the unschedFunction
407
+ // registered at the time of Schedule is invoked with arg as a parameter.
408
+ virtual void Schedule(void (*function)(void* arg), void* arg,
409
+ Priority pri = LOW, void* tag = nullptr,
410
+ void (*unschedFunction)(void* arg) = nullptr) = 0;
411
+
412
+ // Arrange to remove jobs for given arg from the queue_ if they are not
413
+ // already scheduled. Caller is expected to have exclusive lock on arg.
414
+ virtual int UnSchedule(void* /*arg*/, Priority /*pri*/) { return 0; }
415
+
416
+ // Start a new thread, invoking "function(arg)" within the new thread.
417
+ // When "function(arg)" returns, the thread will be destroyed.
418
+ virtual void StartThread(void (*function)(void* arg), void* arg) = 0;
419
+
420
+ // Wait for all threads started by StartThread to terminate.
421
+ virtual void WaitForJoin() {}
422
+
423
+ // Get thread pool queue length for specific thread pool.
424
+ virtual unsigned int GetThreadPoolQueueLen(Priority /*pri*/ = LOW) const {
425
+ return 0;
426
+ }
427
+
428
+ // *path is set to a temporary directory that can be used for testing. It may
429
+ // or many not have just been created. The directory may or may not differ
430
+ // between runs of the same process, but subsequent calls will return the
431
+ // same directory.
432
+ virtual Status GetTestDirectory(std::string* path) = 0;
433
+
434
+ // Create and returns a default logger (an instance of EnvLogger) for storing
435
+ // informational messages. Derived classes can overide to provide custom
436
+ // logger.
437
+ virtual Status NewLogger(const std::string& fname,
438
+ std::shared_ptr<Logger>* result);
439
+
440
+ // Returns the number of micro-seconds since some fixed point in time.
441
+ // It is often used as system time such as in GenericRateLimiter
442
+ // and other places so a port needs to return system time in order to work.
443
+ virtual uint64_t NowMicros() = 0;
444
+
445
+ // Returns the number of nano-seconds since some fixed point in time. Only
446
+ // useful for computing deltas of time in one run.
447
+ // Default implementation simply relies on NowMicros.
448
+ // In platform-specific implementations, NowNanos() should return time points
449
+ // that are MONOTONIC.
450
+ virtual uint64_t NowNanos() { return NowMicros() * 1000; }
451
+
452
+ // 0 indicates not supported.
453
+ virtual uint64_t NowCPUNanos() { return 0; }
454
+
455
+ // Sleep/delay the thread for the prescribed number of micro-seconds.
456
+ virtual void SleepForMicroseconds(int micros) = 0;
457
+
458
+ // Get the current host name as a null terminated string iff the string
459
+ // length is < len. The hostname should otherwise be truncated to len.
460
+ virtual Status GetHostName(char* name, uint64_t len) = 0;
461
+
462
+ // Get the current hostname from the given env as a std::string in result.
463
+ // The result may be truncated if the hostname is too
464
+ // long
465
+ virtual Status GetHostNameString(std::string* result);
466
+
467
+ // Get the number of seconds since the Epoch, 1970-01-01 00:00:00 (UTC).
468
+ // Only overwrites *unix_time on success.
469
+ virtual Status GetCurrentTime(int64_t* unix_time) = 0;
470
+
471
+ // Get full directory name for this db.
472
+ virtual Status GetAbsolutePath(const std::string& db_path,
473
+ std::string* output_path) = 0;
474
+
475
+ // The number of background worker threads of a specific thread pool
476
+ // for this environment. 'LOW' is the default pool.
477
+ // default number: 1
478
+ virtual void SetBackgroundThreads(int number, Priority pri = LOW) = 0;
479
+ virtual int GetBackgroundThreads(Priority pri = LOW) = 0;
480
+
481
+ virtual Status SetAllowNonOwnerAccess(bool /*allow_non_owner_access*/) {
482
+ return Status::NotSupported("Env::SetAllowNonOwnerAccess() not supported.");
483
+ }
484
+
485
+ // Enlarge number of background worker threads of a specific thread pool
486
+ // for this environment if it is smaller than specified. 'LOW' is the default
487
+ // pool.
488
+ virtual void IncBackgroundThreadsIfNeeded(int number, Priority pri) = 0;
489
+
490
+ // Lower IO priority for threads from the specified pool.
491
+ virtual void LowerThreadPoolIOPriority(Priority /*pool*/ = LOW) {}
492
+
493
+ // Lower CPU priority for threads from the specified pool.
494
+ virtual Status LowerThreadPoolCPUPriority(Priority /*pool*/,
495
+ CpuPriority /*pri*/) {
496
+ return Status::NotSupported(
497
+ "Env::LowerThreadPoolCPUPriority(Priority, CpuPriority) not supported");
498
+ }
499
+
500
+ // Lower CPU priority for threads from the specified pool.
501
+ virtual void LowerThreadPoolCPUPriority(Priority /*pool*/ = LOW) {}
502
+
503
+ // Converts seconds-since-Jan-01-1970 to a printable string
504
+ virtual std::string TimeToString(uint64_t time) = 0;
505
+
506
+ // Generates a unique id that can be used to identify a db
507
+ virtual std::string GenerateUniqueId();
508
+
509
+ // OptimizeForLogWrite will create a new EnvOptions object that is a copy of
510
+ // the EnvOptions in the parameters, but is optimized for reading log files.
511
+ virtual EnvOptions OptimizeForLogRead(const EnvOptions& env_options) const;
512
+
513
+ // OptimizeForManifestRead will create a new EnvOptions object that is a copy
514
+ // of the EnvOptions in the parameters, but is optimized for reading manifest
515
+ // files.
516
+ virtual EnvOptions OptimizeForManifestRead(
517
+ const EnvOptions& env_options) const;
518
+
519
+ // OptimizeForLogWrite will create a new EnvOptions object that is a copy of
520
+ // the EnvOptions in the parameters, but is optimized for writing log files.
521
+ // Default implementation returns the copy of the same object.
522
+ virtual EnvOptions OptimizeForLogWrite(const EnvOptions& env_options,
523
+ const DBOptions& db_options) const;
524
+ // OptimizeForManifestWrite will create a new EnvOptions object that is a copy
525
+ // of the EnvOptions in the parameters, but is optimized for writing manifest
526
+ // files. Default implementation returns the copy of the same object.
527
+ virtual EnvOptions OptimizeForManifestWrite(
528
+ const EnvOptions& env_options) const;
529
+
530
+ // OptimizeForCompactionTableWrite will create a new EnvOptions object that is
531
+ // a copy of the EnvOptions in the parameters, but is optimized for writing
532
+ // table files.
533
+ virtual EnvOptions OptimizeForCompactionTableWrite(
534
+ const EnvOptions& env_options,
535
+ const ImmutableDBOptions& immutable_ops) const;
536
+
537
+ // OptimizeForCompactionTableWrite will create a new EnvOptions object that
538
+ // is a copy of the EnvOptions in the parameters, but is optimized for reading
539
+ // table files.
540
+ virtual EnvOptions OptimizeForCompactionTableRead(
541
+ const EnvOptions& env_options,
542
+ const ImmutableDBOptions& db_options) const;
543
+
544
+ // Returns the status of all threads that belong to the current Env.
545
+ virtual Status GetThreadList(std::vector<ThreadStatus>* /*thread_list*/) {
546
+ return Status::NotSupported("Env::GetThreadList() not supported.");
547
+ }
548
+
549
+ // Returns the pointer to ThreadStatusUpdater. This function will be
550
+ // used in RocksDB internally to update thread status and supports
551
+ // GetThreadList().
552
+ virtual ThreadStatusUpdater* GetThreadStatusUpdater() const {
553
+ return thread_status_updater_;
554
+ }
555
+
556
+ // Returns the ID of the current thread.
557
+ virtual uint64_t GetThreadID() const;
558
+
559
+ // This seems to clash with a macro on Windows, so #undef it here
560
+ #undef GetFreeSpace
561
+
562
+ // Get the amount of free disk space
563
+ virtual Status GetFreeSpace(const std::string& /*path*/,
564
+ uint64_t* /*diskfree*/) {
565
+ return Status::NotSupported("Env::GetFreeSpace() not supported.");
566
+ }
567
+
568
+ // Check whether the specified path is a directory
569
+ virtual Status IsDirectory(const std::string& /*path*/, bool* /*is_dir*/) {
570
+ return Status::NotSupported("Env::IsDirectory() not supported.");
571
+ }
572
+
573
+ virtual void SanitizeEnvOptions(EnvOptions* /*env_opts*/) const {}
574
+
575
+ // Get the FileSystem implementation this Env was constructed with. It
576
+ // could be a fully implemented one, or a wrapper class around the Env
577
+ const std::shared_ptr<FileSystem>& GetFileSystem() const;
578
+
579
+ // If you're adding methods here, remember to add them to EnvWrapper too.
580
+
581
+ protected:
582
+ // The pointer to an internal structure that will update the
583
+ // status of each thread.
584
+ ThreadStatusUpdater* thread_status_updater_;
585
+
586
+ // Pointer to the underlying FileSystem implementation
587
+ std::shared_ptr<FileSystem> file_system_;
588
+
589
+ private:
590
+ static const size_t kMaxHostNameLen = 256;
591
+ };
592
+
593
+ // The factory function to construct a ThreadStatusUpdater. Any Env
594
+ // that supports GetThreadList() feature should call this function in its
595
+ // constructor to initialize thread_status_updater_.
596
+ ThreadStatusUpdater* CreateThreadStatusUpdater();
597
+
598
+ // A file abstraction for reading sequentially through a file
599
+ class SequentialFile {
600
+ public:
601
+ SequentialFile() {}
602
+ virtual ~SequentialFile();
603
+
604
+ // Read up to "n" bytes from the file. "scratch[0..n-1]" may be
605
+ // written by this routine. Sets "*result" to the data that was
606
+ // read (including if fewer than "n" bytes were successfully read).
607
+ // May set "*result" to point at data in "scratch[0..n-1]", so
608
+ // "scratch[0..n-1]" must be live when "*result" is used.
609
+ // If an error was encountered, returns a non-OK status.
610
+ //
611
+ // REQUIRES: External synchronization
612
+ virtual Status Read(size_t n, Slice* result, char* scratch) = 0;
613
+
614
+ // Skip "n" bytes from the file. This is guaranteed to be no
615
+ // slower that reading the same data, but may be faster.
616
+ //
617
+ // If end of file is reached, skipping will stop at the end of the
618
+ // file, and Skip will return OK.
619
+ //
620
+ // REQUIRES: External synchronization
621
+ virtual Status Skip(uint64_t n) = 0;
622
+
623
+ // Indicates the upper layers if the current SequentialFile implementation
624
+ // uses direct IO.
625
+ virtual bool use_direct_io() const { return false; }
626
+
627
+ // Use the returned alignment value to allocate
628
+ // aligned buffer for Direct I/O
629
+ virtual size_t GetRequiredBufferAlignment() const { return kDefaultPageSize; }
630
+
631
+ // Remove any kind of caching of data from the offset to offset+length
632
+ // of this file. If the length is 0, then it refers to the end of file.
633
+ // If the system is not caching the file contents, then this is a noop.
634
+ virtual Status InvalidateCache(size_t /*offset*/, size_t /*length*/) {
635
+ return Status::NotSupported(
636
+ "SequentialFile::InvalidateCache not supported.");
637
+ }
638
+
639
+ // Positioned Read for direct I/O
640
+ // If Direct I/O enabled, offset, n, and scratch should be properly aligned
641
+ virtual Status PositionedRead(uint64_t /*offset*/, size_t /*n*/,
642
+ Slice* /*result*/, char* /*scratch*/) {
643
+ return Status::NotSupported(
644
+ "SequentialFile::PositionedRead() not supported.");
645
+ }
646
+
647
+ // If you're adding methods here, remember to add them to
648
+ // SequentialFileWrapper too.
649
+ };
650
+
651
+ // A read IO request structure for use in MultiRead
652
+ struct ReadRequest {
653
+ // File offset in bytes
654
+ uint64_t offset;
655
+
656
+ // Length to read in bytes
657
+ size_t len;
658
+
659
+ // A buffer that MultiRead() can optionally place data in. It can
660
+ // ignore this and allocate its own buffer
661
+ char* scratch;
662
+
663
+ // Output parameter set by MultiRead() to point to the data buffer, and
664
+ // the number of valid bytes
665
+ Slice result;
666
+
667
+ // Status of read
668
+ Status status;
669
+ };
670
+
671
+ // A file abstraction for randomly reading the contents of a file.
672
+ class RandomAccessFile {
673
+ public:
674
+ RandomAccessFile() {}
675
+ virtual ~RandomAccessFile();
676
+
677
+ // Read up to "n" bytes from the file starting at "offset".
678
+ // "scratch[0..n-1]" may be written by this routine. Sets "*result"
679
+ // to the data that was read (including if fewer than "n" bytes were
680
+ // successfully read). May set "*result" to point at data in
681
+ // "scratch[0..n-1]", so "scratch[0..n-1]" must be live when
682
+ // "*result" is used. If an error was encountered, returns a non-OK
683
+ // status.
684
+ //
685
+ // Safe for concurrent use by multiple threads.
686
+ // If Direct I/O enabled, offset, n, and scratch should be aligned properly.
687
+ virtual Status Read(uint64_t offset, size_t n, Slice* result,
688
+ char* scratch) const = 0;
689
+
690
+ // Readahead the file starting from offset by n bytes for caching.
691
+ virtual Status Prefetch(uint64_t /*offset*/, size_t /*n*/) {
692
+ return Status::OK();
693
+ }
694
+
695
+ // Read a bunch of blocks as described by reqs. The blocks can
696
+ // optionally be read in parallel. This is a synchronous call, i.e it
697
+ // should return after all reads have completed. The reads will be
698
+ // non-overlapping. If the function return Status is not ok, status of
699
+ // individual requests will be ignored and return status will be assumed
700
+ // for all read requests. The function return status is only meant for any
701
+ // any errors that occur before even processing specific read requests
702
+ virtual Status MultiRead(ReadRequest* reqs, size_t num_reqs) {
703
+ assert(reqs != nullptr);
704
+ for (size_t i = 0; i < num_reqs; ++i) {
705
+ ReadRequest& req = reqs[i];
706
+ req.status = Read(req.offset, req.len, &req.result, req.scratch);
707
+ }
708
+ return Status::OK();
709
+ }
710
+
711
+ // Tries to get an unique ID for this file that will be the same each time
712
+ // the file is opened (and will stay the same while the file is open).
713
+ // Furthermore, it tries to make this ID at most "max_size" bytes. If such an
714
+ // ID can be created this function returns the length of the ID and places it
715
+ // in "id"; otherwise, this function returns 0, in which case "id"
716
+ // may not have been modified.
717
+ //
718
+ // This function guarantees, for IDs from a given environment, two unique ids
719
+ // cannot be made equal to each other by adding arbitrary bytes to one of
720
+ // them. That is, no unique ID is the prefix of another.
721
+ //
722
+ // This function guarantees that the returned ID will not be interpretable as
723
+ // a single varint.
724
+ //
725
+ // Note: these IDs are only valid for the duration of the process.
726
+ virtual size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const {
727
+ return 0; // Default implementation to prevent issues with backwards
728
+ // compatibility.
729
+ }
730
+
731
+ enum AccessPattern { NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED };
732
+
733
+ virtual void Hint(AccessPattern /*pattern*/) {}
734
+
735
+ // Indicates the upper layers if the current RandomAccessFile implementation
736
+ // uses direct IO.
737
+ virtual bool use_direct_io() const { return false; }
738
+
739
+ // Use the returned alignment value to allocate
740
+ // aligned buffer for Direct I/O
741
+ virtual size_t GetRequiredBufferAlignment() const { return kDefaultPageSize; }
742
+
743
+ // Remove any kind of caching of data from the offset to offset+length
744
+ // of this file. If the length is 0, then it refers to the end of file.
745
+ // If the system is not caching the file contents, then this is a noop.
746
+ virtual Status InvalidateCache(size_t /*offset*/, size_t /*length*/) {
747
+ return Status::NotSupported(
748
+ "RandomAccessFile::InvalidateCache not supported.");
749
+ }
750
+
751
+ // If you're adding methods here, remember to add them to
752
+ // RandomAccessFileWrapper too.
753
+ };
754
+
755
+ // A file abstraction for sequential writing. The implementation
756
+ // must provide buffering since callers may append small fragments
757
+ // at a time to the file.
758
+ class WritableFile {
759
+ public:
760
+ WritableFile()
761
+ : last_preallocated_block_(0),
762
+ preallocation_block_size_(0),
763
+ io_priority_(Env::IO_TOTAL),
764
+ write_hint_(Env::WLTH_NOT_SET),
765
+ strict_bytes_per_sync_(false) {}
766
+
767
+ explicit WritableFile(const EnvOptions& options)
768
+ : last_preallocated_block_(0),
769
+ preallocation_block_size_(0),
770
+ io_priority_(Env::IO_TOTAL),
771
+ write_hint_(Env::WLTH_NOT_SET),
772
+ strict_bytes_per_sync_(options.strict_bytes_per_sync) {}
773
+ // No copying allowed
774
+ WritableFile(const WritableFile&) = delete;
775
+ void operator=(const WritableFile&) = delete;
776
+
777
+ virtual ~WritableFile();
778
+
779
+ // Append data to the end of the file
780
+ // Note: A WriteabelFile object must support either Append or
781
+ // PositionedAppend, so the users cannot mix the two.
782
+ virtual Status Append(const Slice& data) = 0;
783
+
784
+ // PositionedAppend data to the specified offset. The new EOF after append
785
+ // must be larger than the previous EOF. This is to be used when writes are
786
+ // not backed by OS buffers and hence has to always start from the start of
787
+ // the sector. The implementation thus needs to also rewrite the last
788
+ // partial sector.
789
+ // Note: PositionAppend does not guarantee moving the file offset after the
790
+ // write. A WritableFile object must support either Append or
791
+ // PositionedAppend, so the users cannot mix the two.
792
+ //
793
+ // PositionedAppend() can only happen on the page/sector boundaries. For that
794
+ // reason, if the last write was an incomplete sector we still need to rewind
795
+ // back to the nearest sector/page and rewrite the portion of it with whatever
796
+ // we need to add. We need to keep where we stop writing.
797
+ //
798
+ // PositionedAppend() can only write whole sectors. For that reason we have to
799
+ // pad with zeros for the last write and trim the file when closing according
800
+ // to the position we keep in the previous step.
801
+ //
802
+ // PositionedAppend() requires aligned buffer to be passed in. The alignment
803
+ // required is queried via GetRequiredBufferAlignment()
804
+ virtual Status PositionedAppend(const Slice& /* data */,
805
+ uint64_t /* offset */) {
806
+ return Status::NotSupported(
807
+ "WritableFile::PositionedAppend() not supported.");
808
+ }
809
+
810
+ // Truncate is necessary to trim the file to the correct size
811
+ // before closing. It is not always possible to keep track of the file
812
+ // size due to whole pages writes. The behavior is undefined if called
813
+ // with other writes to follow.
814
+ virtual Status Truncate(uint64_t /*size*/) { return Status::OK(); }
815
+ virtual Status Close() = 0;
816
+ virtual Status Flush() = 0;
817
+ virtual Status Sync() = 0; // sync data
818
+
819
+ /*
820
+ * Sync data and/or metadata as well.
821
+ * By default, sync only data.
822
+ * Override this method for environments where we need to sync
823
+ * metadata as well.
824
+ */
825
+ virtual Status Fsync() { return Sync(); }
826
+
827
+ // true if Sync() and Fsync() are safe to call concurrently with Append()
828
+ // and Flush().
829
+ virtual bool IsSyncThreadSafe() const { return false; }
830
+
831
+ // Indicates the upper layers if the current WritableFile implementation
832
+ // uses direct IO.
833
+ virtual bool use_direct_io() const { return false; }
834
+
835
+ // Use the returned alignment value to allocate
836
+ // aligned buffer for Direct I/O
837
+ virtual size_t GetRequiredBufferAlignment() const { return kDefaultPageSize; }
838
+ /*
839
+ * Change the priority in rate limiter if rate limiting is enabled.
840
+ * If rate limiting is not enabled, this call has no effect.
841
+ */
842
+ virtual void SetIOPriority(Env::IOPriority pri) { io_priority_ = pri; }
843
+
844
+ virtual Env::IOPriority GetIOPriority() { return io_priority_; }
845
+
846
+ virtual void SetWriteLifeTimeHint(Env::WriteLifeTimeHint hint) {
847
+ write_hint_ = hint;
848
+ }
849
+
850
+ virtual Env::WriteLifeTimeHint GetWriteLifeTimeHint() { return write_hint_; }
851
+ /*
852
+ * Get the size of valid data in the file.
853
+ */
854
+ virtual uint64_t GetFileSize() { return 0; }
855
+
856
+ /*
857
+ * Get and set the default pre-allocation block size for writes to
858
+ * this file. If non-zero, then Allocate will be used to extend the
859
+ * underlying storage of a file (generally via fallocate) if the Env
860
+ * instance supports it.
861
+ */
862
+ virtual void SetPreallocationBlockSize(size_t size) {
863
+ preallocation_block_size_ = size;
864
+ }
865
+
866
+ virtual void GetPreallocationStatus(size_t* block_size,
867
+ size_t* last_allocated_block) {
868
+ *last_allocated_block = last_preallocated_block_;
869
+ *block_size = preallocation_block_size_;
870
+ }
871
+
872
+ // For documentation, refer to RandomAccessFile::GetUniqueId()
873
+ virtual size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const {
874
+ return 0; // Default implementation to prevent issues with backwards
875
+ }
876
+
877
+ // Remove any kind of caching of data from the offset to offset+length
878
+ // of this file. If the length is 0, then it refers to the end of file.
879
+ // If the system is not caching the file contents, then this is a noop.
880
+ // This call has no effect on dirty pages in the cache.
881
+ virtual Status InvalidateCache(size_t /*offset*/, size_t /*length*/) {
882
+ return Status::NotSupported("WritableFile::InvalidateCache not supported.");
883
+ }
884
+
885
+ // Sync a file range with disk.
886
+ // offset is the starting byte of the file range to be synchronized.
887
+ // nbytes specifies the length of the range to be synchronized.
888
+ // This asks the OS to initiate flushing the cached data to disk,
889
+ // without waiting for completion.
890
+ // Default implementation does nothing.
891
+ virtual Status RangeSync(uint64_t /*offset*/, uint64_t /*nbytes*/) {
892
+ if (strict_bytes_per_sync_) {
893
+ return Sync();
894
+ }
895
+ return Status::OK();
896
+ }
897
+
898
+ // PrepareWrite performs any necessary preparation for a write
899
+ // before the write actually occurs. This allows for pre-allocation
900
+ // of space on devices where it can result in less file
901
+ // fragmentation and/or less waste from over-zealous filesystem
902
+ // pre-allocation.
903
+ virtual void PrepareWrite(size_t offset, size_t len) {
904
+ if (preallocation_block_size_ == 0) {
905
+ return;
906
+ }
907
+ // If this write would cross one or more preallocation blocks,
908
+ // determine what the last preallocation block necessary to
909
+ // cover this write would be and Allocate to that point.
910
+ const auto block_size = preallocation_block_size_;
911
+ size_t new_last_preallocated_block =
912
+ (offset + len + block_size - 1) / block_size;
913
+ if (new_last_preallocated_block > last_preallocated_block_) {
914
+ size_t num_spanned_blocks =
915
+ new_last_preallocated_block - last_preallocated_block_;
916
+ // TODO: Don't ignore errors from allocate
917
+ Allocate(block_size * last_preallocated_block_,
918
+ block_size * num_spanned_blocks)
919
+ .PermitUncheckedError();
920
+ last_preallocated_block_ = new_last_preallocated_block;
921
+ }
922
+ }
923
+
924
+ // Pre-allocates space for a file.
925
+ virtual Status Allocate(uint64_t /*offset*/, uint64_t /*len*/) {
926
+ return Status::OK();
927
+ }
928
+
929
+ // If you're adding methods here, remember to add them to
930
+ // WritableFileWrapper too.
931
+
932
+ protected:
933
+ size_t preallocation_block_size() { return preallocation_block_size_; }
934
+
935
+ private:
936
+ size_t last_preallocated_block_;
937
+ size_t preallocation_block_size_;
938
+
939
+ protected:
940
+ Env::IOPriority io_priority_;
941
+ Env::WriteLifeTimeHint write_hint_;
942
+ const bool strict_bytes_per_sync_;
943
+ };
944
+
945
+ // A file abstraction for random reading and writing.
946
+ class RandomRWFile {
947
+ public:
948
+ RandomRWFile() {}
949
+ // No copying allowed
950
+ RandomRWFile(const RandomRWFile&) = delete;
951
+ RandomRWFile& operator=(const RandomRWFile&) = delete;
952
+
953
+ virtual ~RandomRWFile() {}
954
+
955
+ // Indicates if the class makes use of direct I/O
956
+ // If false you must pass aligned buffer to Write()
957
+ virtual bool use_direct_io() const { return false; }
958
+
959
+ // Use the returned alignment value to allocate
960
+ // aligned buffer for Direct I/O
961
+ virtual size_t GetRequiredBufferAlignment() const { return kDefaultPageSize; }
962
+
963
+ // Write bytes in `data` at offset `offset`, Returns Status::OK() on success.
964
+ // Pass aligned buffer when use_direct_io() returns true.
965
+ virtual Status Write(uint64_t offset, const Slice& data) = 0;
966
+
967
+ // Read up to `n` bytes starting from offset `offset` and store them in
968
+ // result, provided `scratch` size should be at least `n`.
969
+ // Returns Status::OK() on success.
970
+ virtual Status Read(uint64_t offset, size_t n, Slice* result,
971
+ char* scratch) const = 0;
972
+
973
+ virtual Status Flush() = 0;
974
+
975
+ virtual Status Sync() = 0;
976
+
977
+ virtual Status Fsync() { return Sync(); }
978
+
979
+ virtual Status Close() = 0;
980
+
981
+ // If you're adding methods here, remember to add them to
982
+ // RandomRWFileWrapper too.
983
+ };
984
+
985
+ // MemoryMappedFileBuffer object represents a memory-mapped file's raw buffer.
986
+ // Subclasses should release the mapping upon destruction.
987
+ class MemoryMappedFileBuffer {
988
+ public:
989
+ MemoryMappedFileBuffer(void* _base, size_t _length)
990
+ : base_(_base), length_(_length) {}
991
+
992
+ virtual ~MemoryMappedFileBuffer() = 0;
993
+
994
+ // We do not want to unmap this twice. We can make this class
995
+ // movable if desired, however, since
996
+ MemoryMappedFileBuffer(const MemoryMappedFileBuffer&) = delete;
997
+ MemoryMappedFileBuffer& operator=(const MemoryMappedFileBuffer&) = delete;
998
+
999
+ void* GetBase() const { return base_; }
1000
+ size_t GetLen() const { return length_; }
1001
+
1002
+ protected:
1003
+ void* base_;
1004
+ const size_t length_;
1005
+ };
1006
+
1007
+ // Directory object represents collection of files and implements
1008
+ // filesystem operations that can be executed on directories.
1009
+ class Directory {
1010
+ public:
1011
+ virtual ~Directory() {}
1012
+ // Fsync directory. Can be called concurrently from multiple threads.
1013
+ virtual Status Fsync() = 0;
1014
+
1015
+ virtual size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const {
1016
+ return 0;
1017
+ }
1018
+
1019
+ // If you're adding methods here, remember to add them to
1020
+ // DirectoryWrapper too.
1021
+ };
1022
+
1023
+ enum InfoLogLevel : unsigned char {
1024
+ DEBUG_LEVEL = 0,
1025
+ INFO_LEVEL,
1026
+ WARN_LEVEL,
1027
+ ERROR_LEVEL,
1028
+ FATAL_LEVEL,
1029
+ HEADER_LEVEL,
1030
+ NUM_INFO_LOG_LEVELS,
1031
+ };
1032
+
1033
+ // An interface for writing log messages.
1034
+ class Logger {
1035
+ public:
1036
+ size_t kDoNotSupportGetLogFileSize = (std::numeric_limits<size_t>::max)();
1037
+
1038
+ explicit Logger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
1039
+ : closed_(false), log_level_(log_level) {}
1040
+ // No copying allowed
1041
+ Logger(const Logger&) = delete;
1042
+ void operator=(const Logger&) = delete;
1043
+
1044
+ virtual ~Logger();
1045
+
1046
+ // Close the log file. Must be called before destructor. If the return
1047
+ // status is NotSupported(), it means the implementation does cleanup in
1048
+ // the destructor
1049
+ virtual Status Close();
1050
+
1051
+ // Write a header to the log file with the specified format
1052
+ // It is recommended that you log all header information at the start of the
1053
+ // application. But it is not enforced.
1054
+ virtual void LogHeader(const char* format, va_list ap) {
1055
+ // Default implementation does a simple INFO level log write.
1056
+ // Please override as per the logger class requirement.
1057
+ Logv(InfoLogLevel::INFO_LEVEL, format, ap);
1058
+ }
1059
+
1060
+ // Write an entry to the log file with the specified format.
1061
+ //
1062
+ // Users who override the `Logv()` overload taking `InfoLogLevel` do not need
1063
+ // to implement this, unless they explicitly invoke it in
1064
+ // `Logv(InfoLogLevel, ...)`.
1065
+ virtual void Logv(const char* /* format */, va_list /* ap */) {
1066
+ assert(false);
1067
+ }
1068
+
1069
+ // Write an entry to the log file with the specified log level
1070
+ // and format. Any log with level under the internal log level
1071
+ // of *this (see @SetInfoLogLevel and @GetInfoLogLevel) will not be
1072
+ // printed.
1073
+ virtual void Logv(const InfoLogLevel log_level, const char* format,
1074
+ va_list ap);
1075
+
1076
+ virtual size_t GetLogFileSize() const { return kDoNotSupportGetLogFileSize; }
1077
+ // Flush to the OS buffers
1078
+ virtual void Flush() {}
1079
+ virtual InfoLogLevel GetInfoLogLevel() const { return log_level_; }
1080
+ virtual void SetInfoLogLevel(const InfoLogLevel log_level) {
1081
+ log_level_ = log_level;
1082
+ }
1083
+
1084
+ // If you're adding methods here, remember to add them to LoggerWrapper too.
1085
+
1086
+ protected:
1087
+ virtual Status CloseImpl();
1088
+ bool closed_;
1089
+
1090
+ private:
1091
+ InfoLogLevel log_level_;
1092
+ };
1093
+
1094
+ // Identifies a locked file.
1095
+ class FileLock {
1096
+ public:
1097
+ FileLock() {}
1098
+ virtual ~FileLock();
1099
+
1100
+ private:
1101
+ // No copying allowed
1102
+ FileLock(const FileLock&) = delete;
1103
+ void operator=(const FileLock&) = delete;
1104
+ };
1105
+
1106
+ class DynamicLibrary {
1107
+ public:
1108
+ virtual ~DynamicLibrary() {}
1109
+
1110
+ // Returns the name of the dynamic library.
1111
+ virtual const char* Name() const = 0;
1112
+
1113
+ // Loads the symbol for sym_name from the library and updates the input
1114
+ // function. Returns the loaded symbol.
1115
+ template <typename T>
1116
+ Status LoadFunction(const std::string& sym_name, std::function<T>* function) {
1117
+ assert(nullptr != function);
1118
+ void* ptr = nullptr;
1119
+ Status s = LoadSymbol(sym_name, &ptr);
1120
+ *function = reinterpret_cast<T*>(ptr);
1121
+ return s;
1122
+ }
1123
+ // Loads and returns the symbol for sym_name from the library.
1124
+ virtual Status LoadSymbol(const std::string& sym_name, void** func) = 0;
1125
+ };
1126
+
1127
+ extern void LogFlush(const std::shared_ptr<Logger>& info_log);
1128
+
1129
+ extern void Log(const InfoLogLevel log_level,
1130
+ const std::shared_ptr<Logger>& info_log, const char* format,
1131
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(3, 4);
1132
+
1133
+ // a set of log functions with different log levels.
1134
+ extern void Header(const std::shared_ptr<Logger>& info_log, const char* format,
1135
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1136
+ extern void Debug(const std::shared_ptr<Logger>& info_log, const char* format,
1137
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1138
+ extern void Info(const std::shared_ptr<Logger>& info_log, const char* format,
1139
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1140
+ extern void Warn(const std::shared_ptr<Logger>& info_log, const char* format,
1141
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1142
+ extern void Error(const std::shared_ptr<Logger>& info_log, const char* format,
1143
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1144
+ extern void Fatal(const std::shared_ptr<Logger>& info_log, const char* format,
1145
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1146
+
1147
+ // Log the specified data to *info_log if info_log is non-nullptr.
1148
+ // The default info log level is InfoLogLevel::INFO_LEVEL.
1149
+ extern void Log(const std::shared_ptr<Logger>& info_log, const char* format,
1150
+ ...) ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1151
+
1152
+ extern void LogFlush(Logger* info_log);
1153
+
1154
+ extern void Log(const InfoLogLevel log_level, Logger* info_log,
1155
+ const char* format, ...) ROCKSDB_PRINTF_FORMAT_ATTR(3, 4);
1156
+
1157
+ // The default info log level is InfoLogLevel::INFO_LEVEL.
1158
+ extern void Log(Logger* info_log, const char* format, ...)
1159
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1160
+
1161
+ // a set of log functions with different log levels.
1162
+ extern void Header(Logger* info_log, const char* format, ...)
1163
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1164
+ extern void Debug(Logger* info_log, const char* format, ...)
1165
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1166
+ extern void Info(Logger* info_log, const char* format, ...)
1167
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1168
+ extern void Warn(Logger* info_log, const char* format, ...)
1169
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1170
+ extern void Error(Logger* info_log, const char* format, ...)
1171
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1172
+ extern void Fatal(Logger* info_log, const char* format, ...)
1173
+ ROCKSDB_PRINTF_FORMAT_ATTR(2, 3);
1174
+
1175
+ // A utility routine: write "data" to the named file.
1176
+ extern Status WriteStringToFile(Env* env, const Slice& data,
1177
+ const std::string& fname,
1178
+ bool should_sync = false);
1179
+
1180
+ // A utility routine: read contents of named file into *data
1181
+ extern Status ReadFileToString(Env* env, const std::string& fname,
1182
+ std::string* data);
1183
+
1184
+ // Below are helpers for wrapping most of the classes in this file.
1185
+ // They forward all calls to another instance of the class.
1186
+ // Useful when wrapping the default implementations.
1187
+ // Typical usage is to inherit your wrapper from *Wrapper, e.g.:
1188
+ //
1189
+ // class MySequentialFileWrapper : public
1190
+ // ROCKSDB_NAMESPACE::SequentialFileWrapper {
1191
+ // public:
1192
+ // MySequentialFileWrapper(ROCKSDB_NAMESPACE::SequentialFile* target):
1193
+ // ROCKSDB_NAMESPACE::SequentialFileWrapper(target) {}
1194
+ // Status Read(size_t n, Slice* result, char* scratch) override {
1195
+ // cout << "Doing a read of size " << n << "!" << endl;
1196
+ // return ROCKSDB_NAMESPACE::SequentialFileWrapper::Read(n, result,
1197
+ // scratch);
1198
+ // }
1199
+ // // All other methods are forwarded to target_ automatically.
1200
+ // };
1201
+ //
1202
+ // This is often more convenient than inheriting the class directly because
1203
+ // (a) Don't have to override and forward all methods - the Wrapper will
1204
+ // forward everything you're not explicitly overriding.
1205
+ // (b) Don't need to update the wrapper when more methods are added to the
1206
+ // rocksdb class. Unless you actually want to override the behavior.
1207
+ // (And unless rocksdb people forgot to update the *Wrapper class.)
1208
+
1209
+ // An implementation of Env that forwards all calls to another Env.
1210
+ // May be useful to clients who wish to override just part of the
1211
+ // functionality of another Env.
1212
+ class EnvWrapper : public Env {
1213
+ public:
1214
+ // Initialize an EnvWrapper that delegates all calls to *t
1215
+ explicit EnvWrapper(Env* t) : target_(t) {}
1216
+ ~EnvWrapper() override;
1217
+
1218
+ // Return the target to which this Env forwards all calls
1219
+ Env* target() const { return target_; }
1220
+
1221
+ // The following text is boilerplate that forwards all methods to target()
1222
+ Status RegisterDbPaths(const std::vector<std::string>& paths) override {
1223
+ return target_->RegisterDbPaths(paths);
1224
+ }
1225
+
1226
+ Status UnregisterDbPaths(const std::vector<std::string>& paths) override {
1227
+ return target_->UnregisterDbPaths(paths);
1228
+ }
1229
+
1230
+ Status NewSequentialFile(const std::string& f,
1231
+ std::unique_ptr<SequentialFile>* r,
1232
+ const EnvOptions& options) override {
1233
+ return target_->NewSequentialFile(f, r, options);
1234
+ }
1235
+ Status NewRandomAccessFile(const std::string& f,
1236
+ std::unique_ptr<RandomAccessFile>* r,
1237
+ const EnvOptions& options) override {
1238
+ return target_->NewRandomAccessFile(f, r, options);
1239
+ }
1240
+ Status NewWritableFile(const std::string& f, std::unique_ptr<WritableFile>* r,
1241
+ const EnvOptions& options) override {
1242
+ return target_->NewWritableFile(f, r, options);
1243
+ }
1244
+ Status ReopenWritableFile(const std::string& fname,
1245
+ std::unique_ptr<WritableFile>* result,
1246
+ const EnvOptions& options) override {
1247
+ return target_->ReopenWritableFile(fname, result, options);
1248
+ }
1249
+ Status ReuseWritableFile(const std::string& fname,
1250
+ const std::string& old_fname,
1251
+ std::unique_ptr<WritableFile>* r,
1252
+ const EnvOptions& options) override {
1253
+ return target_->ReuseWritableFile(fname, old_fname, r, options);
1254
+ }
1255
+ Status NewRandomRWFile(const std::string& fname,
1256
+ std::unique_ptr<RandomRWFile>* result,
1257
+ const EnvOptions& options) override {
1258
+ return target_->NewRandomRWFile(fname, result, options);
1259
+ }
1260
+ Status NewMemoryMappedFileBuffer(
1261
+ const std::string& fname,
1262
+ std::unique_ptr<MemoryMappedFileBuffer>* result) override {
1263
+ return target_->NewMemoryMappedFileBuffer(fname, result);
1264
+ }
1265
+ Status NewDirectory(const std::string& name,
1266
+ std::unique_ptr<Directory>* result) override {
1267
+ return target_->NewDirectory(name, result);
1268
+ }
1269
+ Status FileExists(const std::string& f) override {
1270
+ return target_->FileExists(f);
1271
+ }
1272
+ Status GetChildren(const std::string& dir,
1273
+ std::vector<std::string>* r) override {
1274
+ return target_->GetChildren(dir, r);
1275
+ }
1276
+ Status GetChildrenFileAttributes(
1277
+ const std::string& dir, std::vector<FileAttributes>* result) override {
1278
+ return target_->GetChildrenFileAttributes(dir, result);
1279
+ }
1280
+ Status DeleteFile(const std::string& f) override {
1281
+ return target_->DeleteFile(f);
1282
+ }
1283
+ Status Truncate(const std::string& fname, size_t size) override {
1284
+ return target_->Truncate(fname, size);
1285
+ }
1286
+ Status CreateDir(const std::string& d) override {
1287
+ return target_->CreateDir(d);
1288
+ }
1289
+ Status CreateDirIfMissing(const std::string& d) override {
1290
+ return target_->CreateDirIfMissing(d);
1291
+ }
1292
+ Status DeleteDir(const std::string& d) override {
1293
+ return target_->DeleteDir(d);
1294
+ }
1295
+ Status GetFileSize(const std::string& f, uint64_t* s) override {
1296
+ return target_->GetFileSize(f, s);
1297
+ }
1298
+
1299
+ Status GetFileModificationTime(const std::string& fname,
1300
+ uint64_t* file_mtime) override {
1301
+ return target_->GetFileModificationTime(fname, file_mtime);
1302
+ }
1303
+
1304
+ Status RenameFile(const std::string& s, const std::string& t) override {
1305
+ return target_->RenameFile(s, t);
1306
+ }
1307
+
1308
+ Status LinkFile(const std::string& s, const std::string& t) override {
1309
+ return target_->LinkFile(s, t);
1310
+ }
1311
+
1312
+ Status NumFileLinks(const std::string& fname, uint64_t* count) override {
1313
+ return target_->NumFileLinks(fname, count);
1314
+ }
1315
+
1316
+ Status AreFilesSame(const std::string& first, const std::string& second,
1317
+ bool* res) override {
1318
+ return target_->AreFilesSame(first, second, res);
1319
+ }
1320
+
1321
+ Status LockFile(const std::string& f, FileLock** l) override {
1322
+ return target_->LockFile(f, l);
1323
+ }
1324
+
1325
+ Status UnlockFile(FileLock* l) override { return target_->UnlockFile(l); }
1326
+
1327
+ Status IsDirectory(const std::string& path, bool* is_dir) override {
1328
+ return target_->IsDirectory(path, is_dir);
1329
+ }
1330
+
1331
+ Status LoadLibrary(const std::string& lib_name,
1332
+ const std::string& search_path,
1333
+ std::shared_ptr<DynamicLibrary>* result) override {
1334
+ return target_->LoadLibrary(lib_name, search_path, result);
1335
+ }
1336
+
1337
+ void Schedule(void (*f)(void* arg), void* a, Priority pri,
1338
+ void* tag = nullptr, void (*u)(void* arg) = nullptr) override {
1339
+ return target_->Schedule(f, a, pri, tag, u);
1340
+ }
1341
+
1342
+ int UnSchedule(void* tag, Priority pri) override {
1343
+ return target_->UnSchedule(tag, pri);
1344
+ }
1345
+
1346
+ void StartThread(void (*f)(void*), void* a) override {
1347
+ return target_->StartThread(f, a);
1348
+ }
1349
+ void WaitForJoin() override { return target_->WaitForJoin(); }
1350
+ unsigned int GetThreadPoolQueueLen(Priority pri = LOW) const override {
1351
+ return target_->GetThreadPoolQueueLen(pri);
1352
+ }
1353
+ Status GetTestDirectory(std::string* path) override {
1354
+ return target_->GetTestDirectory(path);
1355
+ }
1356
+ Status NewLogger(const std::string& fname,
1357
+ std::shared_ptr<Logger>* result) override {
1358
+ return target_->NewLogger(fname, result);
1359
+ }
1360
+ uint64_t NowMicros() override { return target_->NowMicros(); }
1361
+ uint64_t NowNanos() override { return target_->NowNanos(); }
1362
+ uint64_t NowCPUNanos() override { return target_->NowCPUNanos(); }
1363
+
1364
+ void SleepForMicroseconds(int micros) override {
1365
+ target_->SleepForMicroseconds(micros);
1366
+ }
1367
+ Status GetHostName(char* name, uint64_t len) override {
1368
+ return target_->GetHostName(name, len);
1369
+ }
1370
+ Status GetCurrentTime(int64_t* unix_time) override {
1371
+ return target_->GetCurrentTime(unix_time);
1372
+ }
1373
+ Status GetAbsolutePath(const std::string& db_path,
1374
+ std::string* output_path) override {
1375
+ return target_->GetAbsolutePath(db_path, output_path);
1376
+ }
1377
+ void SetBackgroundThreads(int num, Priority pri) override {
1378
+ return target_->SetBackgroundThreads(num, pri);
1379
+ }
1380
+ int GetBackgroundThreads(Priority pri) override {
1381
+ return target_->GetBackgroundThreads(pri);
1382
+ }
1383
+
1384
+ Status SetAllowNonOwnerAccess(bool allow_non_owner_access) override {
1385
+ return target_->SetAllowNonOwnerAccess(allow_non_owner_access);
1386
+ }
1387
+
1388
+ void IncBackgroundThreadsIfNeeded(int num, Priority pri) override {
1389
+ return target_->IncBackgroundThreadsIfNeeded(num, pri);
1390
+ }
1391
+
1392
+ void LowerThreadPoolIOPriority(Priority pool) override {
1393
+ target_->LowerThreadPoolIOPriority(pool);
1394
+ }
1395
+
1396
+ void LowerThreadPoolCPUPriority(Priority pool) override {
1397
+ target_->LowerThreadPoolCPUPriority(pool);
1398
+ }
1399
+
1400
+ Status LowerThreadPoolCPUPriority(Priority pool, CpuPriority pri) override {
1401
+ return target_->LowerThreadPoolCPUPriority(pool, pri);
1402
+ }
1403
+
1404
+ std::string TimeToString(uint64_t time) override {
1405
+ return target_->TimeToString(time);
1406
+ }
1407
+
1408
+ Status GetThreadList(std::vector<ThreadStatus>* thread_list) override {
1409
+ return target_->GetThreadList(thread_list);
1410
+ }
1411
+
1412
+ ThreadStatusUpdater* GetThreadStatusUpdater() const override {
1413
+ return target_->GetThreadStatusUpdater();
1414
+ }
1415
+
1416
+ uint64_t GetThreadID() const override { return target_->GetThreadID(); }
1417
+
1418
+ std::string GenerateUniqueId() override {
1419
+ return target_->GenerateUniqueId();
1420
+ }
1421
+
1422
+ EnvOptions OptimizeForLogRead(const EnvOptions& env_options) const override {
1423
+ return target_->OptimizeForLogRead(env_options);
1424
+ }
1425
+ EnvOptions OptimizeForManifestRead(
1426
+ const EnvOptions& env_options) const override {
1427
+ return target_->OptimizeForManifestRead(env_options);
1428
+ }
1429
+ EnvOptions OptimizeForLogWrite(const EnvOptions& env_options,
1430
+ const DBOptions& db_options) const override {
1431
+ return target_->OptimizeForLogWrite(env_options, db_options);
1432
+ }
1433
+ EnvOptions OptimizeForManifestWrite(
1434
+ const EnvOptions& env_options) const override {
1435
+ return target_->OptimizeForManifestWrite(env_options);
1436
+ }
1437
+ EnvOptions OptimizeForCompactionTableWrite(
1438
+ const EnvOptions& env_options,
1439
+ const ImmutableDBOptions& immutable_ops) const override {
1440
+ return target_->OptimizeForCompactionTableWrite(env_options, immutable_ops);
1441
+ }
1442
+ EnvOptions OptimizeForCompactionTableRead(
1443
+ const EnvOptions& env_options,
1444
+ const ImmutableDBOptions& db_options) const override {
1445
+ return target_->OptimizeForCompactionTableRead(env_options, db_options);
1446
+ }
1447
+ Status GetFreeSpace(const std::string& path, uint64_t* diskfree) override {
1448
+ return target_->GetFreeSpace(path, diskfree);
1449
+ }
1450
+ void SanitizeEnvOptions(EnvOptions* env_opts) const override {
1451
+ target_->SanitizeEnvOptions(env_opts);
1452
+ }
1453
+
1454
+ private:
1455
+ Env* target_;
1456
+ };
1457
+
1458
+ class SequentialFileWrapper : public SequentialFile {
1459
+ public:
1460
+ explicit SequentialFileWrapper(SequentialFile* target) : target_(target) {}
1461
+
1462
+ Status Read(size_t n, Slice* result, char* scratch) override {
1463
+ return target_->Read(n, result, scratch);
1464
+ }
1465
+ Status Skip(uint64_t n) override { return target_->Skip(n); }
1466
+ bool use_direct_io() const override { return target_->use_direct_io(); }
1467
+ size_t GetRequiredBufferAlignment() const override {
1468
+ return target_->GetRequiredBufferAlignment();
1469
+ }
1470
+ Status InvalidateCache(size_t offset, size_t length) override {
1471
+ return target_->InvalidateCache(offset, length);
1472
+ }
1473
+ Status PositionedRead(uint64_t offset, size_t n, Slice* result,
1474
+ char* scratch) override {
1475
+ return target_->PositionedRead(offset, n, result, scratch);
1476
+ }
1477
+
1478
+ private:
1479
+ SequentialFile* target_;
1480
+ };
1481
+
1482
+ class RandomAccessFileWrapper : public RandomAccessFile {
1483
+ public:
1484
+ explicit RandomAccessFileWrapper(RandomAccessFile* target)
1485
+ : target_(target) {}
1486
+
1487
+ Status Read(uint64_t offset, size_t n, Slice* result,
1488
+ char* scratch) const override {
1489
+ return target_->Read(offset, n, result, scratch);
1490
+ }
1491
+ Status MultiRead(ReadRequest* reqs, size_t num_reqs) override {
1492
+ return target_->MultiRead(reqs, num_reqs);
1493
+ }
1494
+ Status Prefetch(uint64_t offset, size_t n) override {
1495
+ return target_->Prefetch(offset, n);
1496
+ }
1497
+ size_t GetUniqueId(char* id, size_t max_size) const override {
1498
+ return target_->GetUniqueId(id, max_size);
1499
+ }
1500
+ void Hint(AccessPattern pattern) override { target_->Hint(pattern); }
1501
+ bool use_direct_io() const override { return target_->use_direct_io(); }
1502
+ size_t GetRequiredBufferAlignment() const override {
1503
+ return target_->GetRequiredBufferAlignment();
1504
+ }
1505
+ Status InvalidateCache(size_t offset, size_t length) override {
1506
+ return target_->InvalidateCache(offset, length);
1507
+ }
1508
+
1509
+ private:
1510
+ RandomAccessFile* target_;
1511
+ };
1512
+
1513
+ class WritableFileWrapper : public WritableFile {
1514
+ public:
1515
+ explicit WritableFileWrapper(WritableFile* t) : target_(t) {}
1516
+
1517
+ Status Append(const Slice& data) override { return target_->Append(data); }
1518
+ Status PositionedAppend(const Slice& data, uint64_t offset) override {
1519
+ return target_->PositionedAppend(data, offset);
1520
+ }
1521
+ Status Truncate(uint64_t size) override { return target_->Truncate(size); }
1522
+ Status Close() override { return target_->Close(); }
1523
+ Status Flush() override { return target_->Flush(); }
1524
+ Status Sync() override { return target_->Sync(); }
1525
+ Status Fsync() override { return target_->Fsync(); }
1526
+ bool IsSyncThreadSafe() const override { return target_->IsSyncThreadSafe(); }
1527
+
1528
+ bool use_direct_io() const override { return target_->use_direct_io(); }
1529
+
1530
+ size_t GetRequiredBufferAlignment() const override {
1531
+ return target_->GetRequiredBufferAlignment();
1532
+ }
1533
+
1534
+ void SetIOPriority(Env::IOPriority pri) override {
1535
+ target_->SetIOPriority(pri);
1536
+ }
1537
+
1538
+ Env::IOPriority GetIOPriority() override { return target_->GetIOPriority(); }
1539
+
1540
+ void SetWriteLifeTimeHint(Env::WriteLifeTimeHint hint) override {
1541
+ target_->SetWriteLifeTimeHint(hint);
1542
+ }
1543
+
1544
+ Env::WriteLifeTimeHint GetWriteLifeTimeHint() override {
1545
+ return target_->GetWriteLifeTimeHint();
1546
+ }
1547
+
1548
+ uint64_t GetFileSize() override { return target_->GetFileSize(); }
1549
+
1550
+ void SetPreallocationBlockSize(size_t size) override {
1551
+ target_->SetPreallocationBlockSize(size);
1552
+ }
1553
+
1554
+ void GetPreallocationStatus(size_t* block_size,
1555
+ size_t* last_allocated_block) override {
1556
+ target_->GetPreallocationStatus(block_size, last_allocated_block);
1557
+ }
1558
+
1559
+ size_t GetUniqueId(char* id, size_t max_size) const override {
1560
+ return target_->GetUniqueId(id, max_size);
1561
+ }
1562
+
1563
+ Status InvalidateCache(size_t offset, size_t length) override {
1564
+ return target_->InvalidateCache(offset, length);
1565
+ }
1566
+
1567
+ Status RangeSync(uint64_t offset, uint64_t nbytes) override {
1568
+ return target_->RangeSync(offset, nbytes);
1569
+ }
1570
+
1571
+ void PrepareWrite(size_t offset, size_t len) override {
1572
+ target_->PrepareWrite(offset, len);
1573
+ }
1574
+
1575
+ Status Allocate(uint64_t offset, uint64_t len) override {
1576
+ return target_->Allocate(offset, len);
1577
+ }
1578
+
1579
+ private:
1580
+ WritableFile* target_;
1581
+ };
1582
+
1583
+ class RandomRWFileWrapper : public RandomRWFile {
1584
+ public:
1585
+ explicit RandomRWFileWrapper(RandomRWFile* target) : target_(target) {}
1586
+
1587
+ bool use_direct_io() const override { return target_->use_direct_io(); }
1588
+ size_t GetRequiredBufferAlignment() const override {
1589
+ return target_->GetRequiredBufferAlignment();
1590
+ }
1591
+ Status Write(uint64_t offset, const Slice& data) override {
1592
+ return target_->Write(offset, data);
1593
+ }
1594
+ Status Read(uint64_t offset, size_t n, Slice* result,
1595
+ char* scratch) const override {
1596
+ return target_->Read(offset, n, result, scratch);
1597
+ }
1598
+ Status Flush() override { return target_->Flush(); }
1599
+ Status Sync() override { return target_->Sync(); }
1600
+ Status Fsync() override { return target_->Fsync(); }
1601
+ Status Close() override { return target_->Close(); }
1602
+
1603
+ private:
1604
+ RandomRWFile* target_;
1605
+ };
1606
+
1607
+ class DirectoryWrapper : public Directory {
1608
+ public:
1609
+ explicit DirectoryWrapper(Directory* target) : target_(target) {}
1610
+
1611
+ Status Fsync() override { return target_->Fsync(); }
1612
+ size_t GetUniqueId(char* id, size_t max_size) const override {
1613
+ return target_->GetUniqueId(id, max_size);
1614
+ }
1615
+
1616
+ private:
1617
+ Directory* target_;
1618
+ };
1619
+
1620
+ class LoggerWrapper : public Logger {
1621
+ public:
1622
+ explicit LoggerWrapper(Logger* target) : target_(target) {}
1623
+
1624
+ Status Close() override { return target_->Close(); }
1625
+ void LogHeader(const char* format, va_list ap) override {
1626
+ return target_->LogHeader(format, ap);
1627
+ }
1628
+ void Logv(const char* format, va_list ap) override {
1629
+ return target_->Logv(format, ap);
1630
+ }
1631
+ void Logv(const InfoLogLevel log_level, const char* format,
1632
+ va_list ap) override {
1633
+ return target_->Logv(log_level, format, ap);
1634
+ }
1635
+ size_t GetLogFileSize() const override { return target_->GetLogFileSize(); }
1636
+ void Flush() override { return target_->Flush(); }
1637
+ InfoLogLevel GetInfoLogLevel() const override {
1638
+ return target_->GetInfoLogLevel();
1639
+ }
1640
+ void SetInfoLogLevel(const InfoLogLevel log_level) override {
1641
+ return target_->SetInfoLogLevel(log_level);
1642
+ }
1643
+
1644
+ private:
1645
+ Logger* target_;
1646
+ };
1647
+
1648
+ // Returns a new environment that stores its data in memory and delegates
1649
+ // all non-file-storage tasks to base_env. The caller must delete the result
1650
+ // when it is no longer needed.
1651
+ // *base_env must remain live while the result is in use.
1652
+ Env* NewMemEnv(Env* base_env);
1653
+
1654
+ // Returns a new environment that is used for HDFS environment.
1655
+ // This is a factory method for HdfsEnv declared in hdfs/env_hdfs.h
1656
+ Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname);
1657
+
1658
+ // Returns a new environment that measures function call times for filesystem
1659
+ // operations, reporting results to variables in PerfContext.
1660
+ // This is a factory method for TimedEnv defined in utilities/env_timed.cc.
1661
+ Env* NewTimedEnv(Env* base_env);
1662
+
1663
+ // Returns an instance of logger that can be used for storing informational
1664
+ // messages.
1665
+ // This is a factory method for EnvLogger declared in logging/env_logging.h
1666
+ Status NewEnvLogger(const std::string& fname, Env* env,
1667
+ std::shared_ptr<Logger>* result);
1668
+
1669
+ std::unique_ptr<Env> NewCompositeEnv(const std::shared_ptr<FileSystem>& fs);
1670
+
1671
+ } // namespace ROCKSDB_NAMESPACE