Replace 'string' with 'const string&' in FileOperationInfo (#4491)
Summary: Using const string& can avoid one extra string copy. This PR addresses a recent comment made by siying on #3933. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4491 Differential Revision: D10381211 Pulled By: riversand963 fbshipit-source-id: 27fc2d65d84bc7cd07833c77cdc47f06dcfaeb31
This commit is contained in:
parent
f60c4e5a58
commit
ce52274640
@ -144,12 +144,13 @@ struct TableFileDeletionInfo {
|
||||
};
|
||||
|
||||
struct FileOperationInfo {
|
||||
std::string path;
|
||||
const std::string& path;
|
||||
uint64_t offset;
|
||||
size_t length;
|
||||
time_t start_timestamp;
|
||||
time_t finish_timestamp;
|
||||
Status status;
|
||||
FileOperationInfo(const std::string& _path) : path(_path) {}
|
||||
};
|
||||
|
||||
struct FlushJobInfo {
|
||||
|
@ -66,8 +66,7 @@ class RandomAccessFileReader {
|
||||
#ifndef ROCKSDB_LITE
|
||||
void NotifyOnFileReadFinish(uint64_t offset, size_t length, time_t start_ts,
|
||||
const Status& status) const {
|
||||
FileOperationInfo info;
|
||||
info.path = file_name_;
|
||||
FileOperationInfo info(file_name_);
|
||||
info.offset = offset;
|
||||
info.length = length;
|
||||
info.start_timestamp = start_ts;
|
||||
@ -160,8 +159,7 @@ class WritableFileWriter {
|
||||
#ifndef ROCKSDB_LITE
|
||||
void NotifyOnFileWriteFinish(uint64_t offset, size_t length, time_t start_ts,
|
||||
const Status& status) {
|
||||
FileOperationInfo info;
|
||||
info.path = file_name_;
|
||||
FileOperationInfo info(file_name_);
|
||||
info.offset = offset;
|
||||
info.length = length;
|
||||
info.start_timestamp = start_ts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user