2015-03-12 14:27:51 +01:00
|
|
|
#include "BlockStoreWithRandomKeys.h"
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
using namespace blockstore;
|
|
|
|
|
|
|
|
using std::string;
|
2015-01-24 22:27:14 +01:00
|
|
|
using std::unique_ptr;
|
2014-12-09 17:19:59 +01:00
|
|
|
|
2015-01-24 22:27:14 +01:00
|
|
|
unique_ptr<Block> BlockStoreWithRandomKeys::create(size_t size) {
|
|
|
|
auto result = tryCreate(size);
|
|
|
|
while (!result) {
|
2014-12-09 20:36:32 +01:00
|
|
|
result = tryCreate(size);
|
|
|
|
}
|
|
|
|
return result;
|
2014-12-09 17:19:59 +01:00
|
|
|
}
|
|
|
|
|
2015-01-24 22:27:14 +01:00
|
|
|
unique_ptr<Block> BlockStoreWithRandomKeys::tryCreate(size_t size) {
|
2014-12-09 20:36:32 +01:00
|
|
|
Key key = Key::CreateRandomKey();
|
2015-01-24 22:27:14 +01:00
|
|
|
return create(key, size);
|
2014-12-09 17:19:59 +01:00
|
|
|
}
|
2014-12-09 20:36:32 +01:00
|
|
|
|