Skip to content

Commit

Permalink
sstable, storage: Mark dir/temp_dir private
Browse files Browse the repository at this point in the history
Now all storage access via sstable happens with the help of storage
class API so its internals can be finally made private.

Signed-off-by: Pavel Emelyanov <[email protected]>
  • Loading branch information
xemul committed Dec 15, 2022
1 parent 6296ca3 commit 6d10a34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions sstables/sstables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2005,15 +2005,15 @@ std::vector<sstring> sstable::component_filenames() const {
}

bool sstable::requires_view_building() const {
return boost::algorithm::ends_with(_storage.dir, staging_dir);
return boost::algorithm::ends_with(_storage.prefix(), staging_dir);
}

bool sstable::is_quarantined() const noexcept {
return boost::algorithm::ends_with(_storage.dir, quarantine_dir);
return boost::algorithm::ends_with(_storage.prefix(), quarantine_dir);
}

bool sstable::is_uploaded() const noexcept {
return boost::algorithm::ends_with(_storage.dir, upload_dir);
return boost::algorithm::ends_with(_storage.prefix(), upload_dir);
}

sstring sstable::component_basename(const sstring& ks, const sstring& cf, version_types version, generation_type generation,
Expand Down
5 changes: 2 additions & 3 deletions sstables/sstables.hh
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,9 @@ public:

class filesystem_storage {
friend class test;
public:
sstring dir;
std::optional<sstring> temp_dir; // Valid while the sstable is being created, until sealed

explicit filesystem_storage(sstring dir_) : dir(std::move(dir_)) {}

private:
future<> check_create_links_replay(const sstable& sst, const sstring& dst_dir, generation_type dst_gen, const std::vector<std::pair<sstables::component_type, sstring>>& comps) const;
future<> remove_temp_dir();
Expand All @@ -480,6 +477,8 @@ public:
future<> touch_temp_dir(const sstable& sst);

public:
explicit filesystem_storage(sstring dir_) : dir(std::move(dir_)) {}

using absolute_path = bool_class<class absolute_path_tag>; // FIXME -- should go away eventually
future<> seal(const sstable& sst);
future<> snapshot(const sstable& sst, sstring dir, absolute_path abs) const;
Expand Down

0 comments on commit 6d10a34

Please sign in to comment.