libfoedus-core
FOEDUS Core Library
foedus::storage::StorageControlBlock Struct Referencefinal

A base layout of shared data for all storage types. More...

Detailed Description

A base layout of shared data for all storage types.

Individual storage types define their own control blocks that is compatible with this layout.

Attention
This is not for inheritance! Rather to guarantee the layout of 'common' part. When we want to deal with a control block of unknown storage type, we reinterpret to this type and obtain common information. So, the individual storage control blocks must have a compatible layout to this.

Definition at line 53 of file storage.hpp.

#include <storage.hpp>

Collaboration diagram for foedus::storage::StorageControlBlock:

Public Member Functions

 StorageControlBlock ()=delete
 
 ~StorageControlBlock ()=delete
 
bool exists () const
 
bool is_valid_status () const
 
void initialize ()
 
void uninitialize ()
 

Public Attributes

soc::SharedMutex status_mutex_
 The mutext to protect changing the status. More...
 
StorageStatus status_
 Status of the storage. More...
 
DualPagePointer root_page_pointer_
 Points to the root page (or something equivalent). More...
 
Metadata meta_
 common part of the metadata. More...
 
char padding_ [ 4096-sizeof(soc::SharedMutex)-8-sizeof(DualPagePointer)-sizeof(Metadata)]
 Just to make this exactly 4kb. More...
 

Constructor & Destructor Documentation

foedus::storage::StorageControlBlock::StorageControlBlock ( )
delete
foedus::storage::StorageControlBlock::~StorageControlBlock ( )
delete

Member Function Documentation

void foedus::storage::StorageControlBlock::initialize ( )
inline

Definition at line 63 of file storage.hpp.

References foedus::soc::SharedMutex::initialize(), foedus::storage::kNotExists, root_page_pointer_, foedus::storage::DualPagePointer::snapshot_pointer_, status_, status_mutex_, foedus::storage::DualPagePointer::volatile_pointer_, and foedus::storage::VolatilePagePointer::word.

Referenced by foedus::storage::StorageManagerPimpl::create_storage(), foedus::storage::StorageManagerPimpl::create_storage_apply(), and foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot().

63  {
68  }
soc::SharedMutex status_mutex_
The mutext to protect changing the status.
Definition: storage.hpp:78
void initialize(bool recursive=false)
DualPagePointer root_page_pointer_
Points to the root page (or something equivalent).
Definition: storage.hpp:82
VolatilePagePointer volatile_pointer_
Definition: storage_id.hpp:308
SnapshotPagePointer snapshot_pointer_
Definition: storage_id.hpp:307
Initial state, which means the storage has not been created yet.
Definition: storage_id.hpp:156
StorageStatus status_
Status of the storage.
Definition: storage.hpp:80

Here is the call graph for this function:

Here is the caller graph for this function:

bool foedus::storage::StorageControlBlock::is_valid_status ( ) const
inline

Definition at line 59 of file storage.hpp.

References foedus::storage::kExists, foedus::storage::kMarkedForDeath, foedus::storage::kNotExists, and status_.

Referenced by foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().

59  {
61  }
The storage has been marked for drop and can't be used.
Definition: storage_id.hpp:164
The storage has been created and ready for use.
Definition: storage_id.hpp:158
Initial state, which means the storage has not been created yet.
Definition: storage_id.hpp:156
StorageStatus status_
Status of the storage.
Definition: storage.hpp:80

Here is the caller graph for this function:

void foedus::storage::StorageControlBlock::uninitialize ( )
inline

Definition at line 69 of file storage.hpp.

References status_mutex_, and foedus::soc::SharedMutex::uninitialize().

Referenced by foedus::storage::StorageManagerPimpl::drop_storage(), and foedus::storage::StorageManagerPimpl::drop_storage_apply().

69  {
71  }
soc::SharedMutex status_mutex_
The mutext to protect changing the status.
Definition: storage.hpp:78

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

char foedus::storage::StorageControlBlock::padding_[ 4096-sizeof(soc::SharedMutex)-8-sizeof(DualPagePointer)-sizeof(Metadata)]

Just to make this exactly 4kb.

Individual control block doesn't have this.

Definition at line 88 of file storage.hpp.

soc::SharedMutex foedus::storage::StorageControlBlock::status_mutex_

The mutext to protect changing the status.

Reading the status is not protected, so we have to make sure we don't suddenly drop a storage. We first change the status to kMarkedForDeath, then drop it after a while.

Definition at line 78 of file storage.hpp.

Referenced by initialize(), and uninitialize().


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