|
PST File Format SDK v0.4
|
PST implementation. More...
#include <database.h>
Inheritance diagram for pstsdk::database_impl< T >:
Collaboration diagram for pstsdk::database_impl< T >:Public Member Functions | |
| template<typename K , typename V > | |
| std::shared_ptr< pstsdk::bt_nonleaf_page< K, V > > | read_bt_nonleaf_page (const page_info &pi, pstsdk::disk::bt_page< T, disk::bt_entry< T > > &the_page) |
Lookup functions | |
| node | lookup_node (node_id nid) |
| Open a node. | |
| node_info | lookup_node_info (node_id nid) |
| Lookup information about a node. | |
| block_info | lookup_block_info (block_id bid) |
| Lookup information about a block. | |
Page factory functions | |
| std::shared_ptr< bbt_page > | read_bbt_root () |
| Get the root of the BBT of this context. | |
| std::shared_ptr< nbt_page > | read_nbt_root () |
| Get the root of the NBT of this context. | |
| std::shared_ptr< bbt_page > | read_bbt_page (const page_info &pi) |
| Open a BBT page. | |
| std::shared_ptr< nbt_page > | read_nbt_page (const page_info &pi) |
| Open a NBT page. | |
| std::shared_ptr< nbt_leaf_page > | read_nbt_leaf_page (const page_info &pi) |
| Open a NBT leaf page. | |
| std::shared_ptr< bbt_leaf_page > | read_bbt_leaf_page (const page_info &pi) |
| Open a BBT leaf page. | |
| std::shared_ptr< nbt_nonleaf_page > | read_nbt_nonleaf_page (const page_info &pi) |
| Open a NBT nonleaf page. | |
| std::shared_ptr< bbt_nonleaf_page > | read_bbt_nonleaf_page (const page_info &pi) |
| Open a BBT nonleaf page. | |
Public Member Functions inherited from pstsdk::db_context | |
| virtual | ~db_context () |
| std::shared_ptr< block > | read_block (block_id bid) |
| Open a block in this context. | |
| std::shared_ptr< data_block > | read_data_block (block_id bid) |
| Open a data_block in this context. | |
| std::shared_ptr< extended_block > | read_extended_block (block_id bid) |
| Open a extended_block in this context. | |
| std::shared_ptr< external_block > | read_external_block (block_id bid) |
| Open a external_block in this context. | |
| std::shared_ptr< subnode_block > | read_subnode_block (block_id bid) |
| Open a subnode_block in this context. | |
| std::shared_ptr< subnode_leaf_block > | read_subnode_leaf_block (block_id bid) |
| Open a subnode_leaf_block in this context. | |
| std::shared_ptr< subnode_nonleaf_block > | read_subnode_nonleaf_block (block_id bid) |
| Open a subnode_nonleaf_block in this context. | |
| std::shared_ptr< block > | read_block (const block_info &bi) |
| Open a block in this context. | |
| std::shared_ptr< data_block > | read_data_block (const block_info &bi) |
| Open a data_block in this context. | |
| std::shared_ptr< extended_block > | read_extended_block (const block_info &bi) |
| Open a extended_block in this context. | |
| std::shared_ptr< external_block > | read_external_block (const block_info &bi) |
| Open a block in this context. | |
| std::shared_ptr< subnode_block > | read_subnode_block (const block_info &bi) |
| Open a subnode_block in this context. | |
| std::shared_ptr< subnode_leaf_block > | read_subnode_leaf_block (const block_info &bi) |
| Open a subnode_leaf_block in this context. | |
| std::shared_ptr< subnode_nonleaf_block > | read_subnode_nonleaf_block (const block_info &bi) |
| Open a subnode_nonleaf_block in this context. | |
PST implementation.
The actual implementation of a database context - this class is responsible for translating between the disk format (as indicated by the template parameter) and the disk-agnostic in memory classes returned from the various factory methods.
open_database will instantiate the correct database_impl type for a given filename.
| T | ulonglong for a Unicode store, ulong for an ANSI store |
Definition at line 101 of file database.h.
|
protected |
|
inlineprotected |
Construct a database_impl from this filename.
| invalid_format | if the file format is not understood |
| runtime_error | if an error occurs opening the file |
| [in] | filename | The filename to open |
Definition at line 430 of file database.h.
|
inlineprotected |
Construct a database_impl from a file.
| invalid_format | if the file format is not understood |
| runtime_error | if an error occurs opening the file |
| [in] | file | The file |
Definition at line 441 of file database.h.
|
inlineprotected |
Construct a database_impl from another database_impl, copying its header.
| [in] | other_database | Pointer to the source database_impl to copy from |
Definition at line 452 of file database.h.
|
inlinevirtual |
Lookup information about a block.
| key_not_found<block_id> | if the specified block was not found |
| [in] | bid | The id of the block to lookup |
Implements pstsdk::db_context.
Definition at line 651 of file database.h.
|
inlinevirtual |
Open a node.
| key_not_found<node_id> | if the specified node was not found |
| [in] | nid | The id of the node to lookup |
Implements pstsdk::db_context.
Definition at line 107 of file database.h.
|
inlinevirtual |
Lookup information about a node.
| key_not_found<node_id> | if the specified node was not found |
| [in] | nid | The id of the node to lookup |
Implements pstsdk::db_context.
Definition at line 645 of file database.h.
|
inlinevirtual |
Open a BBT leaf page.
| [in] | pi | Information about the page to open |
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 500 of file database.h.
|
inlineprotected |
Definition at line 517 of file database.h.
|
inlinevirtual |
Open a BBT nonleaf page.
| [in] | pi | Information about the page to open |
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 576 of file database.h.
|
inlinevirtual |
Open a BBT page.
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 593 of file database.h.
|
inlinevirtual |
Get the root of the BBT of this context.
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 406 of file database.h.
|
inlinevirtual |
Open a block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 127 of file database.h.
|
inlinevirtual |
Open a block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 666 of file database.h.
|
inlineprotected |
Read block data, perform validation checks.
| [in] | bi | The block information to read from disk |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Definition at line 331 of file database.h.
|
protected |
|
inline |
Definition at line 558 of file database.h.
|
inlinevirtual |
Open a data_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 129 of file database.h.
|
inlinevirtual |
Open a data_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 683 of file database.h.
|
inlinevirtual |
Open an extended_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 131 of file database.h.
|
inlinevirtual |
Open a extended_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 700 of file database.h.
|
inlinevirtual |
Open a external_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 133 of file database.h.
|
inlinevirtual |
Open a external_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 788 of file database.h.
|
inlinevirtual |
Open a NBT leaf page.
| [in] | pi | Information about the page to open |
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 460 of file database.h.
|
inlineprotected |
Definition at line 477 of file database.h.
|
inlinevirtual |
Open a NBT nonleaf page.
| [in] | pi | Information about the page to open |
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 540 of file database.h.
|
inlinevirtual |
Open a NBT page.
| [in] | pi | Information about the page to open |
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 619 of file database.h.
|
inlinevirtual |
Get the root of the NBT of this context.
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 418 of file database.h.
|
protected |
Read page data, perform validation checks.
| [in] | pi | The page information to read from disk |
| unexpected_page | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the page appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's signature appears incorrect |
| database_corrupt | (PSTSDK_VALIDATION_LEVEL_WEAK) If the page trailer's ptypeRepeat != ptype |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the page's CRC doesn't match the trailer |
Definition at line 369 of file database.h.
|
inlinevirtual |
Open a subnode_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 135 of file database.h.
|
inlinevirtual |
Open a subnode_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 817 of file database.h.
|
inlinevirtual |
Open a subnode_leaf_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 137 of file database.h.
|
inlinevirtual |
Open a subnode_leaf_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 841 of file database.h.
|
inlineprotected |
Definition at line 879 of file database.h.
|
inlinevirtual |
Open a subnode_nonleaf_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bid | The id of the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 139 of file database.h.
|
inlinevirtual |
Open a subnode_nonleaf_block in the specified context.
| [in] | parent | The context to open this block in. It must be either this context or a child context of this context. |
| [in] | bi | Information about the block to open |
| unexpected_block | (PSTSDK_VALIDATION_LEVEL_WEAK) If the parameters of the block appear incorrect |
| sig_mismatch | (PSTSDK_VALIDATION_LEVEL_WEAK) If the block trailer's signature appears incorrect |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_FULL) If the block's CRC doesn't match the trailer |
Implements pstsdk::db_context.
Definition at line 860 of file database.h.
|
inlineprotected |
Definition at line 901 of file database.h.
|
protected |
Validate the header of this file.
| invalid_format | if this header is for a database format incompatible with this object |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
|
friend |
Open a db_context by copying the in-memory header and file handle from another db_context.
| [in] | other_database | A reference to an existing shared_db_ptr to copy from |
|
friend |
Open a db_context for the given file.
| invalid_format | if the file format is not understood |
| runtime_error | if an error occurs opening the file |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
| [in] | filename | The filename to open |
|
friend |
Open a db_context for the given file instance.
| invalid_format | if the file format is not understood |
| runtime_error | if an error occurs opening the file |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
| [in] | file | A shared_ptr to a file instance (e.g., backed by custom filesystem) |
|
friend |
Try to open the given file as a Unicode store.
| invalid_format | if the file format is not Unicode |
| runtime_error | if an error occurs opening the file |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
| [in] | filename | The filename to open |
|
friend |
Try to open the given file as a Unicode store with custom file instance.
| invalid_format | if the file format is not Unicode |
| runtime_error | if an error occurs opening the file |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
| [in] | file | A shared_ptr to a file instance |
|
friend |
Try to open the given file as an ANSI store.
| invalid_format | if the file format is not ANSI |
| runtime_error | if an error occurs opening the file |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
| [in] | filename | The filename to open |
|
friend |
Try to open the given file as an ANSI store with custom file instance.
| invalid_format | if the file format is not ANSI |
| runtime_error | if an error occurs opening the file |
| crc_fail | (PSTSDK_VALIDATION_LEVEL_WEAK) if the CRC of this header doesn't match |
| [in] | file | A shared_ptr to a file instance |
|
protected |
Definition at line 219 of file database.h.
|
protected |
Definition at line 217 of file database.h.
|
protected |
Definition at line 218 of file database.h.
|
protected |
Definition at line 220 of file database.h.