LLFIO
v2.00 late beta
|
Abstract base class for an object which protects shared filing system resources. More...
#include "base.hpp"
Classes | |
class | entities_guard |
RAII holder for a lock on a sequence of entities. More... | |
struct | entity_type |
The type of an entity id. More... | |
Public Types | |
using | entities_type = span< entity_type > |
The type of a sequence of entities. | |
Public Member Functions | |
entity_type | entity_from_buffer (const char *buffer, size_t bytes, bool exclusive=true) noexcept |
Generates an entity id from a sequence of bytes. | |
template<typename T > | |
entity_type | entity_from_string (const std::basic_string< T > &str, bool exclusive=true) noexcept |
Generates an entity id from a string. | |
entity_type | random_entity (bool exclusive=true) noexcept |
Generates a cryptographically random entity id. | |
void | fill_random_entities (span< entity_type > seq, bool exclusive=true) noexcept |
Fills a sequence of entity ids with cryptographic randomness. Much faster than calling random_entity() individually. | |
virtual result< void > | _lock (entities_guard &out, deadline d, bool spin_not_sleep) noexcept=0 |
result< entities_guard > | lock (entities_type entities, deadline d=deadline(), bool spin_not_sleep=false) noexcept |
Lock all of a sequence of entities for exclusive or shared access. | |
result< entities_guard > | lock (entity_type entity, deadline d=deadline(), bool spin_not_sleep=false) noexcept |
Lock a single entity for exclusive or shared access. | |
result< entities_guard > | try_lock (entities_type entities) noexcept |
Try to lock all of a sequence of entities for exclusive or shared access. | |
result< entities_guard > | try_lock (entity_type entity) noexcept |
Try to lock a single entity for exclusive or shared access. | |
virtual void | unlock (entities_type entities, unsigned long long hint=0) noexcept=0 |
Unlock a previously locked sequence of entities. | |
Protected Member Functions | |
shared_fs_mutex (const shared_fs_mutex &)=default | |
shared_fs_mutex (shared_fs_mutex &&)=default | |
shared_fs_mutex & | operator= (const shared_fs_mutex &)=default |
shared_fs_mutex & | operator= (shared_fs_mutex &&)=default |
Abstract base class for an object which protects shared filing system resources.
The implementations of this abstract base class have various pros and cons with varying time and space complexities. See their documentation for details. All share the concept of "entity_type" as being a unique 63 bit identifier of a lockable entity. Various conversion functions are provided below for converting strings, buffers etc. into an entity_type.