add clone method to checked_space_map
This commit is contained in:
parent
876dd2427f
commit
f503cf7fbe
@ -54,6 +54,7 @@ namespace persistent_data {
|
|||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr<persistent_space_map> ptr;
|
typedef boost::shared_ptr<persistent_space_map> ptr;
|
||||||
|
|
||||||
|
// FIXME: these two should be const
|
||||||
virtual size_t root_size() = 0;
|
virtual size_t root_size() = 0;
|
||||||
virtual void copy_root(void *dest, size_t len) = 0;
|
virtual void copy_root(void *dest, size_t len) = 0;
|
||||||
};
|
};
|
||||||
@ -65,6 +66,8 @@ namespace persistent_data {
|
|||||||
virtual void check(block_counter &counter) const {
|
virtual void check(block_counter &counter) const {
|
||||||
throw std::runtime_error("not implemented");
|
throw std::runtime_error("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ptr clone() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class sm_adjust {
|
class sm_adjust {
|
||||||
|
@ -381,11 +381,11 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t root_size() {
|
virtual size_t root_size() {
|
||||||
return sizeof(sm_root_disk);
|
return sizeof(sm_root_disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_root(void *dest, size_t len) {
|
virtual void copy_root(void *dest, size_t len) {
|
||||||
sm_root_disk d;
|
sm_root_disk d;
|
||||||
sm_root v;
|
sm_root v;
|
||||||
|
|
||||||
@ -401,6 +401,16 @@ namespace {
|
|||||||
::memcpy(dest, &d, sizeof(d));
|
::memcpy(dest, &d, sizeof(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual checked_space_map::ptr clone() const {
|
||||||
|
sm_root root;
|
||||||
|
root.nr_blocks_ = nr_blocks_;
|
||||||
|
root.nr_allocated_ = nr_allocated_;
|
||||||
|
root.bitmap_root_ = indexes_->get_root();
|
||||||
|
root.ref_count_root_ = ref_counts_.get_root();
|
||||||
|
return checked_space_map::ptr(
|
||||||
|
new sm_disk(indexes_->clone(), tm_, root));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
transaction_manager::ptr get_tm() const {
|
transaction_manager::ptr get_tm() const {
|
||||||
return tm_;
|
return tm_;
|
||||||
|
@ -138,6 +138,9 @@ namespace {
|
|||||||
return sm_->check(counter);
|
return sm_->check(counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual checked_space_map::ptr clone() const {
|
||||||
|
return checked_space_map::ptr(new sm_recursive(sm_->clone()));
|
||||||
|
}
|
||||||
|
|
||||||
void flush_ops() {
|
void flush_ops() {
|
||||||
op_map::const_iterator it, end = ops_.end();
|
op_map::const_iterator it, end = ops_.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user