Add property_bag to FileOptions (#9030)

Summary:
Add a property_bag option in FileOptions for direct FileSystem users to pass custom properties to the provider in APIs such as NewRandomAccessFile, NewWritableFile etc. This field will be ignored/not populated by RocksDB.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9030

Reviewed By: zhichao-cao

Differential Revision: D31630643

Pulled By: anand1976

fbshipit-source-id: 1e1ddc5e2933ecada99a94eada5f309b674a03e8
This commit is contained in:
anand76 2021-10-18 23:00:57 -07:00 committed by Facebook GitHub Bot
parent f0841d4faf
commit aa21896880

View File

@ -25,6 +25,7 @@
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <unordered_map>
#include <vector> #include <vector>
#include "rocksdb/env.h" #include "rocksdb/env.h"
@ -90,6 +91,14 @@ struct IOOptions {
// Type of data being read/written // Type of data being read/written
IOType type; IOType type;
// EXPERIMENTAL
// An option map that's opaque to RocksDB. It can be used to implement a
// custom contract between a FileSystem user and the provider. This is only
// useful in cases where a RocksDB user directly uses the FileSystem or file
// object for their own purposes, and wants to pass extra options to APIs
// such as NewRandomAccessFile and NewWritableFile.
std::unordered_map<std::string, std::string> property_bag;
IOOptions() : timeout(0), prio(IOPriority::kIOLow), type(IOType::kUnknown) {} IOOptions() : timeout(0), prio(IOPriority::kIOLow), type(IOType::kUnknown) {}
}; };