Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(filesystem): Add set and get properties on directories #12247

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions velox/common/file/FileSystems.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ struct FileOptions {
/// filesystem on Unix-like operating system, this corresponds to the direct
/// IO mode if set.
bool bufferIo{true};

/// Property bag to set onto files/directories. Think something similar to
/// ioctl(2). For other remote filesystems, this can be PutObjectTagging in
/// S3.
std::optional<std::unordered_map<std::string, std::string>> properties{
std::nullopt};
};

/// Defines directory options
Expand Down Expand Up @@ -144,6 +150,22 @@ class FileSystem {
/// recursively). Throws velox exception on failure.
virtual void rmdir(std::string_view path) = 0;

/// Sets the property for a directory. The user provides the key-value pairs
/// inside 'properties' field of options. Throws velox exception on failure.
virtual void setDirectoryProperty(
std::string_view /*path*/,
const DirectoryOptions& options = {}) {
VELOX_UNSUPPORTED("setDirectoryProperty not implemented");
}

/// Gets the property for a directory. If no property is found, std::nullopt
/// is returned. Throws velox exception on failure.
virtual std::optional<std::string> getDirectoryProperty(
std::string_view /*path*/,
std::string_view /*propertyKey*/) {
VELOX_UNSUPPORTED("getDirectoryProperty not implemented");
}

protected:
std::shared_ptr<const config::ConfigBase> config_;
};
Expand Down
Loading