Class WriteSizeCache

Class Documentation

class WriteSizeCache

Public Functions

WriteSizeCache() = default
virtual ~WriteSizeCache() = default
std::pair<size_t, size_t> record(std::string path, size_t size)

Record the size of a file and add it to the cache.

Parameters:
  • path – gekkofs path

  • size – current size to set for given path

Returns:

[size_update counter, current cached size]

std::pair<size_t, size_t> reset(const std::string &path, bool evict)

reset entry from the cache

Parameters:
  • path

  • evict – if true, entry is removed from cache, reseted to cnt 0 otherwise

Returns:

[size_update counter, current cached size]

std::pair<int, off64_t> flush(const std::string &path, bool evict = true)

Flush the cache for a given path contacting the corresponding daemon.

Parameters:
  • path

  • evict – during flush: if true, entry is removed from cache, reseted to cnt 0 otherwise

Returns:

error code and flushed size

size_t flush_threshold() const
void flush_threshold(size_t flush_threshold)

Private Members

std::unordered_map<std::string, std::pair<size_t, size_t>> size_cache
std::mutex mtx_
size_t flush_threshold_ = {0}