A stack of space map tweaks.
new_block() is now a concrete method implemented using the virtual find_free() and inc() methods. recursive space map is better at giving correct reference counts.
This commit is contained in:
@ -86,7 +86,7 @@ namespace persistent_data {
|
||||
return new_block(it);
|
||||
}
|
||||
|
||||
virtual maybe_block new_block(span_iterator &it) = 0;
|
||||
virtual maybe_block find_free(span_iterator &it) = 0;
|
||||
|
||||
virtual bool count_possibly_greater_than_one(block_address b) const = 0;
|
||||
|
||||
@ -101,6 +101,17 @@ namespace persistent_data {
|
||||
virtual void iterate(iterator &it) const {
|
||||
throw std::runtime_error("iterate() not implemented");
|
||||
}
|
||||
|
||||
|
||||
// This is a concrete method
|
||||
maybe_block new_block(span_iterator &it) {
|
||||
maybe_block mb = find_free(it);
|
||||
|
||||
if (mb)
|
||||
inc(*mb);
|
||||
|
||||
return mb;
|
||||
}
|
||||
};
|
||||
|
||||
class persistent_space_map : public space_map {
|
||||
|
Reference in New Issue
Block a user