Expose the table properties to application

Summary: Provide a public API for users to access the table properties for each SSTable.

Test Plan: Added a unit tests to test the function correctness under differnet conditions.

Reviewers: haobo, dhruba, sdong

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D16083
This commit is contained in:
kailiu
2014-02-13 16:28:21 -08:00
parent b2e7ee8b41
commit 63690625cd
12 changed files with 272 additions and 65 deletions

View File

@@ -3488,6 +3488,23 @@ Status DBImpl::MakeRoomForWrite(bool force,
return s;
}
Status DBImpl::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
// Increment the ref count
mutex_.Lock();
auto version = versions_->current();
version->Ref();
mutex_.Unlock();
auto s = version->GetPropertiesOfAllTables(props);
// Decrement the ref count
mutex_.Lock();
version->Unref();
mutex_.Unlock();
return s;
}
const std::string& DBImpl::GetName() const {
return dbname_;
}