sstables: add static method filename to sstable

This function is likely to be duplicated over time, so let's make
it available as a static method of sstable class.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
This commit is contained in:
Raphael S. Carvalho
2015-05-19 15:22:52 -03:00
parent 2e31147c70
commit ff52678eb5
2 changed files with 12 additions and 0 deletions

View File

@@ -1112,6 +1112,16 @@ const sstring sstable::filename(component_type f) {
return _dir + "/" + version + "-" + generation + "-" + format + "-" + component;
}
const sstring sstable::filename(sstring dir, version_types version, unsigned long generation,
format_types format, component_type component) {
auto& v = _version_string.at(version);
auto& f = _format_string.at(format);
auto& c= _component_map.at(component);
auto g = to_sstring(generation);
return dir + "/" + v + "-" + g + "-" + f + "-" + c;
}
sstable::version_types sstable::version_from_sstring(sstring &s) {
return reverse_map(s, _version_string);
}

View File

@@ -84,6 +84,8 @@ public:
static version_types version_from_sstring(sstring& s);
static format_types format_from_sstring(sstring& s);
static const sstring filename(sstring dir, version_types version, unsigned long generation,
format_types format, component_type component);
future<> load();
future<> store();