libfoedus-core
FOEDUS Core Library
foedus::storage::Metadata Struct Reference

Metadata of one storage. More...

Detailed Description

Metadata of one storage.

Metadata of a storage is a concise set of information about its structure, not about its data. For example, ID, name, and other stuffs specific to the storage type.

Metadata file format
So far, we use a human-readable XML format for all metadata. The main reason is ease of debugging.
When metadata is written
Currently, all metadata of all storages are written to a single file for each snapshotting. We start from previous snapshot and apply durable logs up to some epoch just like data files. We have a plan to implement a stratified metadata-store equivalent to data files, but it has lower priority. It happens only once per several seconds, and the cost to dump that file, even in XML format, is negligible unless there are many thousands stores. (yes, which might be the case later, but not for now.)
When metadata is read
Snapshot metadata files are read at next snapshotting and at next restart.
No virtual methods and no heap-allocation
Metadata objects are placed in shared memory. It must not have any heap-allocated data (eg std::string) nor virtual methods.

Definition at line 58 of file metadata.hpp.

#include <metadata.hpp>

Inheritance diagram for foedus::storage::Metadata:
Collaboration diagram for foedus::storage::Metadata:

Classes

struct  SnapshotThresholds
 Tuning parameters related to snapshotting. More...
 

Public Member Functions

 Metadata ()
 
 Metadata (StorageId id, StorageType type, const StorageName &name)
 
 Metadata (StorageId id, StorageType type, const StorageName &name, SnapshotPagePointer root_snapshot_page_id)
 
bool keeps_all_volatile_pages () const
 

Static Public Member Functions

static std::string describe (const Metadata &metadata)
 to_string operator of all Metadata objects. More...
 

Public Attributes

StorageId id_
 the unique ID of this storage. More...
 
StorageType type_
 type of the storage. More...
 
StorageName name_
 the unique name of this storage. More...
 
SnapshotPagePointer root_snapshot_page_id_
 Pointer to a snapshotted page this storage is rooted at. More...
 
SnapshotThresholds snapshot_thresholds_
 

Constructor & Destructor Documentation

foedus::storage::Metadata::Metadata ( )
inline

Definition at line 79 of file metadata.hpp.

81  }
0 indicates invalid type.
Definition: storage_id.hpp:124
StorageName name_
the unique name of this storage.
Definition: metadata.hpp:107
SnapshotThresholds snapshot_thresholds_
Definition: metadata.hpp:114
StorageType type_
type of the storage.
Definition: metadata.hpp:105
StorageId id_
the unique ID of this storage.
Definition: metadata.hpp:103
SnapshotPagePointer root_snapshot_page_id_
Pointer to a snapshotted page this storage is rooted at.
Definition: metadata.hpp:112
foedus::storage::Metadata::Metadata ( StorageId  id,
StorageType  type,
const StorageName name 
)
inline

Definition at line 82 of file metadata.hpp.

83  : id_(id), type_(type), name_(name), root_snapshot_page_id_(0), snapshot_thresholds_() {}
StorageName name_
the unique name of this storage.
Definition: metadata.hpp:107
SnapshotThresholds snapshot_thresholds_
Definition: metadata.hpp:114
StorageType type_
type of the storage.
Definition: metadata.hpp:105
StorageId id_
the unique ID of this storage.
Definition: metadata.hpp:103
SnapshotPagePointer root_snapshot_page_id_
Pointer to a snapshotted page this storage is rooted at.
Definition: metadata.hpp:112
foedus::storage::Metadata::Metadata ( StorageId  id,
StorageType  type,
const StorageName name,
SnapshotPagePointer  root_snapshot_page_id 
)
inline

Definition at line 84 of file metadata.hpp.

89  : id_(id),
90  type_(type),
91  name_(name),
92  root_snapshot_page_id_(root_snapshot_page_id),
StorageName name_
the unique name of this storage.
Definition: metadata.hpp:107
SnapshotThresholds snapshot_thresholds_
Definition: metadata.hpp:114
StorageType type_
type of the storage.
Definition: metadata.hpp:105
StorageId id_
the unique ID of this storage.
Definition: metadata.hpp:103
SnapshotPagePointer root_snapshot_page_id_
Pointer to a snapshotted page this storage is rooted at.
Definition: metadata.hpp:112

Member Function Documentation

std::string foedus::storage::Metadata::describe ( const Metadata metadata)
static

to_string operator of all Metadata objects.

Definition at line 35 of file metadata.cpp.

References foedus::storage::kArrayStorage, foedus::storage::kHashStorage, foedus::storage::kMasstreeStorage, foedus::storage::kSequentialStorage, and type_.

35  {
36  switch (metadata.type_) {
37  case kArrayStorage:
38  return static_cast<const array::ArrayMetadata&>(metadata).describe();
39  case kHashStorage:
40  return static_cast<const hash::HashMetadata&>(metadata).describe();
41  case kMasstreeStorage:
42  return static_cast<const masstree::MasstreeMetadata&>(metadata).describe();
43  case kSequentialStorage:
44  return static_cast<const sequential::SequentialMetadata&>(metadata).describe();
45  default:
46  return "Unknown metadata type";
47  }
48 }
static std::string describe(const Metadata &metadata)
to_string operator of all Metadata objects.
Definition: metadata.cpp:35
bool foedus::storage::Metadata::keeps_all_volatile_pages ( ) const
inline

Member Data Documentation

SnapshotThresholds foedus::storage::Metadata::snapshot_thresholds_

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