AFIO  v2.00 late alpha
afio_v2_xxx::algorithm::shared_fs_mutex::shared_fs_mutex Class Referenceabstract

Abstract base class for an object which protects shared filing system resources. More...

#include "base.hpp"

Inheritance diagram for afio_v2_xxx::algorithm::shared_fs_mutex::shared_fs_mutex:
afio_v2_xxx::algorithm::shared_fs_mutex::atomic_append afio_v2_xxx::algorithm::shared_fs_mutex::byte_ranges afio_v2_xxx::algorithm::shared_fs_mutex::lock_files afio_v2_xxx::algorithm::shared_fs_mutex::memory_map< Hasher, HashIndexSize, SpinlockType > afio_v2_xxx::algorithm::shared_fs_mutex::safe_byte_ranges

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_guardlock (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_guardlock (entity_type entity, deadline d=deadline(), bool spin_not_sleep=false) noexcept
 Lock a single entity for exclusive or shared access.
 
result< entities_guardtry_lock (entities_type entities) noexcept
 Try to lock all of a sequence of entities for exclusive or shared access.
 
result< entities_guardtry_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_mutexoperator= (const shared_fs_mutex &)=default
 
shared_fs_mutexoperator= (shared_fs_mutex &&)=default
 

Detailed Description

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.


The documentation for this class was generated from the following file: