Add GetTemperature on existing files (#9498)

Summary:
For tiered storage

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

Test Plan: Just API placeholders for now

Reviewed By: jay-zhuang

Differential Revision: D33993094

Pulled By: pdillinger

fbshipit-source-id: 3cf19a450c7232e05306e94018559b26e9fd35db
main
Peter Dillinger 2 years ago committed by Facebook GitHub Bot
parent 98942a297d
commit bd08374130
  1. 30
      include/rocksdb/file_system.h

@ -701,6 +701,13 @@ class FSSequentialFile {
return IOStatus::NotSupported("PositionedRead");
}
// EXPERIMENTAL
// When available, returns the actual temperature for the file. This is
// useful in case some outside process moves a file from one tier to another,
// though the temperature is generally expected not to change while a file is
// open.
virtual Temperature GetTemperature() const { return Temperature::kUnknown; }
// If you're adding methods here, remember to add them to
// SequentialFileWrapper too.
};
@ -818,6 +825,13 @@ class FSRandomAccessFile {
return IOStatus::NotSupported("InvalidateCache not supported.");
}
// EXPERIMENTAL
// When available, returns the actual temperature for the file. This is
// useful in case some outside process moves a file from one tier to another,
// though the temperature is generally expected not to change while a file is
// open.
virtual Temperature GetTemperature() const { return Temperature::kUnknown; }
// If you're adding methods here, remember to add them to
// RandomAccessFileWrapper too.
};
@ -1102,6 +1116,13 @@ class FSRandomRWFile {
virtual IOStatus Close(const IOOptions& options, IODebugContext* dbg) = 0;
// EXPERIMENTAL
// When available, returns the actual temperature for the file. This is
// useful in case some outside process moves a file from one tier to another,
// though the temperature is generally expected not to change while a file is
// open.
virtual Temperature GetTemperature() const { return Temperature::kUnknown; }
// If you're adding methods here, remember to add them to
// RandomRWFileWrapper too.
@ -1418,6 +1439,9 @@ class FSSequentialFileWrapper : public FSSequentialFile {
IODebugContext* dbg) override {
return target_->PositionedRead(offset, n, options, result, scratch, dbg);
}
Temperature GetTemperature() const override {
return target_->GetTemperature();
}
private:
FSSequentialFile* target_;
@ -1466,6 +1490,9 @@ class FSRandomAccessFileWrapper : public FSRandomAccessFile {
IOStatus InvalidateCache(size_t offset, size_t length) override {
return target_->InvalidateCache(offset, length);
}
Temperature GetTemperature() const override {
return target_->GetTemperature();
}
private:
std::unique_ptr<FSRandomAccessFile> guard_;
@ -1629,6 +1656,9 @@ class FSRandomRWFileWrapper : public FSRandomRWFile {
IOStatus Close(const IOOptions& options, IODebugContext* dbg) override {
return target_->Close(options, dbg);
}
Temperature GetTemperature() const override {
return target_->GetTemperature();
}
private:
FSRandomRWFile* target_;

Loading…
Cancel
Save