|
|
@ -77,7 +77,7 @@ Status MockTableFactory::NewTableReader( |
|
|
|
TableBuilder* MockTableFactory::NewTableBuilder( |
|
|
|
TableBuilder* MockTableFactory::NewTableBuilder( |
|
|
|
const TableBuilderOptions& table_builder_options, uint32_t column_family_id, |
|
|
|
const TableBuilderOptions& table_builder_options, uint32_t column_family_id, |
|
|
|
WritableFileWriter* file) const { |
|
|
|
WritableFileWriter* file) const { |
|
|
|
uint32_t id = GetAndWriteNextID(file->writable_file()); |
|
|
|
uint32_t id = GetAndWriteNextID(file); |
|
|
|
|
|
|
|
|
|
|
|
return new MockTableBuilder(id, &file_system_); |
|
|
|
return new MockTableBuilder(id, &file_system_); |
|
|
|
} |
|
|
|
} |
|
|
@ -90,12 +90,14 @@ Status MockTableFactory::CreateMockTable(Env* env, const std::string& fname, |
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint32_t id = GetAndWriteNextID(file.get()); |
|
|
|
WritableFileWriter file_writer(std::move(file), EnvOptions()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t id = GetAndWriteNextID(&file_writer); |
|
|
|
file_system_.files.insert({id, std::move(file_contents)}); |
|
|
|
file_system_.files.insert({id, std::move(file_contents)}); |
|
|
|
return Status::OK(); |
|
|
|
return Status::OK(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
uint32_t MockTableFactory::GetAndWriteNextID(WritableFile* file) const { |
|
|
|
uint32_t MockTableFactory::GetAndWriteNextID(WritableFileWriter* file) const { |
|
|
|
uint32_t next_id = next_id_.fetch_add(1); |
|
|
|
uint32_t next_id = next_id_.fetch_add(1); |
|
|
|
char buf[4]; |
|
|
|
char buf[4]; |
|
|
|
EncodeFixed32(buf, next_id); |
|
|
|
EncodeFixed32(buf, next_id); |
|
|
|