2014-12-09 17:19:59 +01:00
|
|
|
#pragma once
|
2015-10-15 13:09:21 +02:00
|
|
|
#ifndef MESSMER_BLOCKSTORE_INTERFACE_HELPERS_BLOCKSTOREWITHRANDOMKEYS_H_
|
|
|
|
#define MESSMER_BLOCKSTORE_INTERFACE_HELPERS_BLOCKSTOREWITHRANDOMKEYS_H_
|
2014-12-09 17:19:59 +01:00
|
|
|
|
2015-03-12 14:27:51 +01:00
|
|
|
#include "../BlockStore.h"
|
2015-02-17 00:23:33 +01:00
|
|
|
#include "../Block.h"
|
2015-10-22 17:41:43 +02:00
|
|
|
#include <messmer/cpp-utils/random/Random.h>
|
2014-12-09 17:19:59 +01:00
|
|
|
|
|
|
|
namespace blockstore {
|
|
|
|
|
|
|
|
// This is an implementation helpers for BlockStores that use random block keys.
|
|
|
|
// You should never give this static type to the client. The client should always
|
|
|
|
// work with the BlockStore interface instead.
|
|
|
|
class BlockStoreWithRandomKeys: public BlockStore {
|
|
|
|
public:
|
2015-04-18 14:47:12 +02:00
|
|
|
Key createKey() final {
|
2015-10-22 17:41:43 +02:00
|
|
|
return cpputils::Random::PseudoRandom().getFixedSize<Key::BINARY_LENGTH>();
|
2015-04-18 14:47:12 +02:00
|
|
|
}
|
2014-12-09 17:19:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|