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:
Joe Thornber
2013-04-23 10:57:47 +01:00
parent e0230c5c55
commit d8a208cbc8
7 changed files with 107 additions and 104 deletions

View File

@ -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 {