eckit::FilePool class

Pool of a maximum number of open files. Open files manipulated via DataHandle interface. Handles are kept open as long as possible following LRU algorithm Handles must be checked-out before usage, should be checked back in once writing finished. No limit to number of checked out handles. Handles are closed when purged from pool due to LRU or when pool is destroyed.

Constructors, destructors, conversion operators

FilePool(size_t capacity)
~FilePool()

Public functions

auto checkout(const PathName& path) -> DataHandle*
void checkin(DataHandle* handle)
auto remove(const PathName& path) -> bool
auto size() const -> size_t
Current size of pool.
void capacity(size_t size)
Resize pool capacity.
auto capacity() const -> size_t
Returns max size of pool.
auto usage() const -> size_t
Returns number of checked-out DataHandles.
void print(std::ostream& os) const
Lists the contents of the Pool both in use and cached DataHandle's.

Friends

auto operator<<(std::ostream& s, const FilePool& p) -> std::ostream&

Function documentation

DataHandle* eckit::FilePool::checkout(const PathName& path)

Checkout a DataHandle for use Ownership is passed from FilePool to the client

void eckit::FilePool::checkin(DataHandle* handle)

Return a DataHandle after use Ownership is passed back from the client to FilePool

bool eckit::FilePool::remove(const PathName& path)

Remove a DataHandle from the pool