[#CDBWrapper]
= CDBWrapper
:mrdocs:

Wraps a LevelDB database, providing typed, serialized key&hyphen;value access&period;

== Synopsis

Declared in `&lt;dbwrapper&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CDBWrapper;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CDBWrapper/2constructor-08.adoc[`CDBWrapper`]         [.small]#[constructor]#
| Constructors
| xref:CDBWrapper/2destructor.adoc[`&#126;CDBWrapper`] [.small]#[destructor]#
| Closes the database and releases its resources&period;
| xref:CDBWrapper/operator_assign.adoc[`operator&equals;`]  [.small]#[deleted]#
| Copy assignment is disabled&period;
| xref:CDBWrapper/CompactFull.adoc[`CompactFull`] 
| Perform a blocking full compaction of the underlying LevelDB&period;
| xref:CDBWrapper/DynamicMemoryUsage.adoc[`DynamicMemoryUsage`] 
| Get an estimate of LevelDB memory usage (in bytes)&period;
| xref:CDBWrapper/Erase.adoc[`Erase`] 
| Removes the value stored under the given key&period;
| xref:CDBWrapper/EstimateSize.adoc[`EstimateSize`] 
| Estimates the on&hyphen;disk size of the entries in the given key range&period;
| xref:CDBWrapper/Exists.adoc[`Exists`] 
| Checks whether a value is stored under the given key&period;
| xref:CDBWrapper/GetProperty.adoc[`GetProperty`] 
| Return a LevelDB property value, if available&period;
| xref:CDBWrapper/IsEmpty.adoc[`IsEmpty`] 
| Return true if the database managed by this class contains no entries&period;
| xref:CDBWrapper/NewIterator.adoc[`NewIterator`] 
| Creates a new iterator over the database&period; The caller owns the returned iterator&period;
| xref:CDBWrapper/Read.adoc[`Read`] 
| Reads and de&hyphen;obfuscates the value stored under the given key&period;
| xref:CDBWrapper/Write.adoc[`Write`] 
| Writes a single key&hyphen;value pair to the database&period;
| xref:CDBWrapper/WriteBatch.adoc[`WriteBatch`] 
| Atomically applies all writes and erases queued in a batch&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CDBWrapper/HasKeyStartingWith.adoc[`HasKeyStartingWith`] 
| Probe an unopened database for a key prefix&period; Return true if a database at path exists and contains at least 1 entry beginning with prefix&semi; missing or empty databases return false, and database errors throw dbwrapper&lowbar;error&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:dbwrapper_private/GetObfuscation.adoc[dbwrapper&lowbar;private::GetObfuscation]`
| Work around circular dependency, as well as for testing in dbwrapper&lowbar;tests&period; Database obfuscation should be considered an implementation detail of the specific database&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:index_util/LookUpOne.adoc[`index&lowbar;util&colon;&colon;LookUpOne`]
| Look up a single index entry for a block, trying the height index then the hash index&period;
|===

== Derived Classes

[cols="1,4"]
|===
| Name| Description
| xref:kernel/BlockTreeDB.adoc[`BlockTreeDB`] 
| Access to the block database (blocks&sol;index&sol;)
| xref:BaseIndex/DB.adoc[`DB`] 
| The database stores a block locator of the chain the database is synced to so that the index can efficiently determine the point it last stopped at&period; A locator is used instead of a simple hash of the chain tip because blocks and block index entries may not be flushed to disk until after this database is updated&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
