2014-01-23 06:16:03 +05:30
|
|
|
#ifndef ERA_METADATA_H
|
|
|
|
#define ERA_METADATA_H
|
|
|
|
|
|
|
|
#include "base/endian_utils.h"
|
|
|
|
|
|
|
|
#include "persistent-data/block.h"
|
|
|
|
#include "persistent-data/data-structures/array.h"
|
|
|
|
#include "persistent-data/data-structures/bitset.h"
|
|
|
|
#include "persistent-data/space-maps/disk.h"
|
|
|
|
#include "persistent-data/transaction_manager.h"
|
|
|
|
|
|
|
|
#include "era/superblock.h"
|
2014-01-30 03:07:25 +05:30
|
|
|
#include "era/writeset_tree.h"
|
2014-01-23 06:16:03 +05:30
|
|
|
#include "era/era_array.h"
|
|
|
|
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace era {
|
|
|
|
class metadata {
|
|
|
|
public:
|
|
|
|
enum open_type {
|
|
|
|
CREATE,
|
|
|
|
OPEN
|
|
|
|
};
|
|
|
|
|
2020-04-30 19:00:01 +05:30
|
|
|
typedef block_manager::read_ref read_ref;
|
|
|
|
typedef block_manager::write_ref write_ref;
|
2020-04-30 19:32:43 +05:30
|
|
|
typedef std::shared_ptr<metadata> ptr;
|
2014-01-23 06:16:03 +05:30
|
|
|
|
2020-04-30 19:00:01 +05:30
|
|
|
metadata(block_manager::ptr bm, open_type ot);
|
|
|
|
metadata(block_manager::ptr bm, block_address metadata_snap);
|
2014-08-07 20:13:01 +05:30
|
|
|
void commit();
|
2014-01-23 06:16:03 +05:30
|
|
|
|
|
|
|
typedef persistent_data::transaction_manager tm;
|
|
|
|
tm::ptr tm_;
|
|
|
|
superblock sb_;
|
|
|
|
checked_space_map::ptr metadata_sm_;
|
2014-01-30 03:07:25 +05:30
|
|
|
writeset_tree::ptr writeset_tree_;
|
2014-01-23 06:16:03 +05:30
|
|
|
era_array::ptr era_array_;
|
|
|
|
|
|
|
|
private:
|
2020-04-30 19:00:01 +05:30
|
|
|
void create_metadata(block_manager::ptr bm);
|
|
|
|
void open_metadata(block_manager::ptr bm,
|
2014-01-31 22:01:27 +05:30
|
|
|
block_address loc = SUPERBLOCK_LOCATION);
|
2014-08-07 20:13:01 +05:30
|
|
|
|
|
|
|
void commit_space_map();
|
|
|
|
void commit_writesets();
|
|
|
|
void commit_era_array();
|
|
|
|
void commit_superblock();
|
2014-01-23 06:16:03 +05:30
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
|
|
|
#endif
|