[CI Skip] 0.32.4
This commit is contained in:
@@ -0,0 +1,273 @@
|
||||
|
||||
|
||||
*__name__*: DiskDb
|
||||
|
||||
*__summary__*: Creates DiskDb database using LruDb for caching with FileFlatDb and extending TransactionDb.
|
||||
|
||||
*__description__*: Create an instance of a Disk database using LruDb (for caching with FileFlatDb) and extending TransactionDb. Note that LruDB uses the [Least Recently Used (LRU) cache algorithm](https://www.npmjs.com/package/lru_map)
|
||||
|
||||
*__example__*:
|
||||
```javascript
|
||||
import stringToU8a from '@polkadot/util/string/toU8a';
|
||||
import DiskDb from '@polkadot/db/Disk';
|
||||
import TransactionDb from '@polkadot/db/engines/TransactionDb';
|
||||
|
||||
// Creat diskDb instance that wraps LruDb with backing and Lru cache
|
||||
const diskDb = new DiskDb();
|
||||
|
||||
// Creat txDb instance that uses diskDb
|
||||
const txDb = new TransactionDb(diskDb);
|
||||
|
||||
// Open the disk db backing database. Clears the Lru cache
|
||||
diskDb.open();
|
||||
|
||||
// Declare key/value pair to allocate to store under a the key
|
||||
const key = stringToU8a('key');
|
||||
const value = stringToU8a('some value');
|
||||
|
||||
// Store key/value pair in disk db backing and also in Lru cache
|
||||
diskDb.put(key, value);
|
||||
|
||||
// Retrieve value for key from disk db. Returns cached value if key
|
||||
// in cache, otherwise returns backing value for key and stores
|
||||
// this latest retrieved key/value pair in Lru cache
|
||||
valueRetrieved = diskDb.get(key);
|
||||
|
||||
// Delete key/value pair from disk db backing and set the key to null in Lru cache
|
||||
diskDb.del(key);
|
||||
|
||||
// Transaction to Store key/value pair in transaction db
|
||||
const isTxSuccess = txDb.transaction(() => {
|
||||
txDb.put(key, value);
|
||||
|
||||
// Boolean to indicate whether transaction was successful or not
|
||||
return true;
|
||||
});
|
||||
|
||||
console.log(`Transaction successful?: ${isTxSuccess}`);
|
||||
|
||||
// Retrieve transaction value from diskDb db
|
||||
console.log(`Transfered value: ${diskDb.get(key)}`);
|
||||
|
||||
// Close the diskDb database and clear Lru cache
|
||||
diskDb.close();
|
||||
```
|
||||
|
||||
# Hierarchy
|
||||
|
||||
[TransactionDb](_engines_transactiondb_.transactiondb.md)
|
||||
|
||||
**↳ DiskDb**
|
||||
|
||||
# Implements
|
||||
|
||||
* `TxDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new DiskDb**(base: *`string`*, name: *`string`*, options?: *`BaseDbOptions`*): [DiskDb](_disk_.diskdb.md)
|
||||
|
||||
*Overrides [TransactionDb](_engines_transactiondb_.transactiondb.md).[constructor](_engines_transactiondb_.transactiondb.md#constructor)*
|
||||
|
||||
*Defined in [Disk.ts:66](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/Disk.ts#L66)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| name | `string` |
|
||||
| `Optional` options | `BaseDbOptions` |
|
||||
|
||||
**Returns:** [DiskDb](_disk_.diskdb.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[close](_engines_transactiondb_.transactiondb.md#close)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:51](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L51)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[del](_engines_transactiondb_.transactiondb.md#del)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:81](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L81)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[drop](_engines_transactiondb_.transactiondb.md#drop)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:59](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L59)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[empty](_engines_transactiondb_.transactiondb.md#empty)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:63](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L63)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[get](_engines_transactiondb_.transactiondb.md#get)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:93](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L93)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[maintain](_engines_transactiondb_.transactiondb.md#maintain)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:71](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L71)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[open](_engines_transactiondb_.transactiondb.md#open)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:55](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L55)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[put](_engines_transactiondb_.transactiondb.md#put)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:107](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L107)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[rename](_engines_transactiondb_.transactiondb.md#rename)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:67](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L67)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[size](_engines_transactiondb_.transactiondb.md#size)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:77](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L77)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
<a id="transaction"></a>
|
||||
|
||||
## transaction
|
||||
|
||||
▸ **transaction**(fn: *`function`*): `boolean`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[transaction](_engines_transactiondb_.transactiondb.md#transaction)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:29](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L29)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `function` |
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**FileTreeDb**
|
||||
|
||||
# Implements
|
||||
|
||||
* `BaseDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new FileTreeDb**(location: *`string`*): [FileTreeDb](_engines_filetreedb_.filetreedb.md)
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:21](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L21)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| location | `string` |
|
||||
|
||||
**Returns:** [FileTreeDb](_engines_filetreedb_.filetreedb.md)
|
||||
|
||||
___
|
||||
|
||||
# Properties
|
||||
|
||||
<a id="_location"></a>
|
||||
|
||||
## _location
|
||||
|
||||
**● _location**: *`string`*
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:21](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L21)*
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:46](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L46)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:76](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L76)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:50](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L50)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:54](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L54)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:86](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L86)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:68](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L68)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:42](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L42)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:100](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L100)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:58](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L58)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Defined in [engines/FileTreeDb.ts:62](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/FileTreeDb.ts#L62)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**LruDb**
|
||||
|
||||
# Implements
|
||||
|
||||
* `BaseDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new LruDb**(backing: *`BaseDb`*, itemCount?: *`number`*): [LruDb](_engines_lrudb_.lrudb.md)
|
||||
|
||||
*Defined in [engines/LruDb.ts:20](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L20)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| backing | `BaseDb` | - |
|
||||
| `Default value` itemCount | `number` | DEFAULT_ITEM_COUNT |
|
||||
|
||||
**Returns:** [LruDb](_engines_lrudb_.lrudb.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="_getlru"></a>
|
||||
|
||||
## _getLru
|
||||
|
||||
▸ **_getLru**(key: *`Uint8Array`*): `CachedValue` | `undefined`
|
||||
|
||||
*Defined in [engines/LruDb.ts:87](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L87)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `CachedValue` | `undefined`
|
||||
|
||||
___
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:27](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L27)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:64](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L64)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:41](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L41)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:45](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L45)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Defined in [engines/LruDb.ts:71](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L71)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:56](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L56)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:34](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L34)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:91](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L91)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Defined in [engines/LruDb.ts:52](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L52)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Defined in [engines/LruDb.ts:60](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/LruDb.ts#L60)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**MemoryDb**
|
||||
|
||||
# Implements
|
||||
|
||||
* `BaseDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new MemoryDb**(options?: *`BaseDbOptions`*): [MemoryDb](_engines_memorydb_.memorydb.md)
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:16](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L16)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` options | `BaseDbOptions` |
|
||||
|
||||
**Returns:** [MemoryDb](_engines_memorydb_.memorydb.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:22](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L22)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:56](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L56)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:30](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L30)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:34](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L34)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:62](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L62)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:42](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L42)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:26](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L26)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:68](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L68)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:38](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L38)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Defined in [engines/MemoryDb.ts:50](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/MemoryDb.ts#L50)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**TransactionDb**
|
||||
|
||||
↳ [DiskDb](_disk_.diskdb.md)
|
||||
|
||||
↳ [Memory](_memory_.memory.md)
|
||||
|
||||
# Implements
|
||||
|
||||
* `TxDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new TransactionDb**(backing: *`BaseDb`*): [TransactionDb](_engines_transactiondb_.transactiondb.md)
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:21](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L21)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| backing | `BaseDb` |
|
||||
|
||||
**Returns:** [TransactionDb](_engines_transactiondb_.transactiondb.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:51](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L51)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:81](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L81)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:59](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L59)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:63](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L63)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:93](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L93)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:71](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L71)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:55](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L55)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:107](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L107)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:67](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L67)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:77](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L77)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
<a id="transaction"></a>
|
||||
|
||||
## transaction
|
||||
|
||||
▸ **transaction**(fn: *`function`*): `boolean`
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:29](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L29)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `function` |
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**Compact**
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new Compact**(file: *`string`*): [Compact](_fileflatdb_compact_.compact.md)
|
||||
|
||||
*Defined in [FileFlatDb/Compact.ts:17](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/Compact.ts#L17)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** [Compact](_fileflatdb_compact_.compact.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Defined in [FileFlatDb/Compact.ts:24](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/Compact.ts#L24)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
|
||||
|
||||
# Hierarchy
|
||||
|
||||
**FileFlatDb**
|
||||
|
||||
# Implements
|
||||
|
||||
* `BaseDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new FileFlatDb**(base: *`string`*, file?: *`string`*, options?: *`BaseDbOptions`*): [FileFlatDb](_fileflatdb_index_.fileflatdb.md)
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:32](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L32)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type | Default value |
|
||||
| ------ | ------ | ------ |
|
||||
| base | `string` | - |
|
||||
| `Default value` file | `string` | defaults.DEFAULT_FILE |
|
||||
| `Default value` options | `BaseDbOptions` | {} |
|
||||
|
||||
**Returns:** [FileFlatDb](_fileflatdb_index_.fileflatdb.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:58](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L58)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:105](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L105)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:68](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L68)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:74](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L74)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:109](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L109)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:97](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L97)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:48](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L48)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:127](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L127)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:85](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L85)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Defined in [FileFlatDb/index.ts:81](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/FileFlatDb/index.ts#L81)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
|
||||
@@ -0,0 +1,269 @@
|
||||
|
||||
|
||||
*__name__*: MemoryDb
|
||||
|
||||
*__summary__*: Creates a MemoryDb database extending TransactionDb
|
||||
|
||||
*__description__*: Create an instance of a Memory database using MemoryDb and extending TransactionDb. `options` argument (optional) used to specifies whether to use compression.
|
||||
|
||||
* Enable compression when storing "blocks" since they compress well.
|
||||
* Disable compression when storing "state" Transactions Trie using @polkadot/trie-db or @polkadot/db/src/engines/TransactionDb.ts (potentially LevelDb or RocksDb implementation of a Merkle Patricia Trie) data structure serialised with Recursive Length Prefix (RLP) encoding
|
||||
|
||||
*__example__*:
|
||||
```javascript
|
||||
import stringToU8a from '@polkadot/util/string/toU8a';
|
||||
import MemoryDb from '@polkadot/db/Memory';
|
||||
import TransactionDb from '@polkadot/db/engines/TransactionDb';
|
||||
|
||||
const memoryDb = new MemoryDb();
|
||||
const txDb = new TransactionDb(memoryDb);
|
||||
|
||||
// Open the memory database
|
||||
memoryDb.open();
|
||||
|
||||
// Declare key/value pair to allocate to store under a the key
|
||||
const key = stringToU8a('key');
|
||||
const value = stringToU8a('some value');
|
||||
|
||||
// Store key/value pair in memory db
|
||||
memoryDb.put(key, value);
|
||||
|
||||
// Retrieve value for key from memory db
|
||||
valueRetrieved = memoryDb.get(key);
|
||||
|
||||
// Delete key/value pair from memory db
|
||||
memoryDb.del(key);
|
||||
|
||||
// Transaction to Store key/value pair in transaction db
|
||||
const isTxSuccess = txDb.transaction(() => {
|
||||
txDb.put(key, value);
|
||||
|
||||
// Boolean to indicate whether transaction was successful or not
|
||||
return true;
|
||||
});
|
||||
|
||||
console.log(`Transaction successful?: ${isTxSuccess}`);
|
||||
|
||||
// Retrieve transaction value from memory db
|
||||
console.log(`Transfered value: ${memoryDb.get(key)}`);
|
||||
|
||||
// Close the memory database
|
||||
memoryDb.close();
|
||||
```
|
||||
|
||||
# Hierarchy
|
||||
|
||||
[TransactionDb](_engines_transactiondb_.transactiondb.md)
|
||||
|
||||
**↳ Memory**
|
||||
|
||||
# Implements
|
||||
|
||||
* `TxDb`
|
||||
|
||||
# Constructors
|
||||
|
||||
<a id="constructor"></a>
|
||||
|
||||
## constructor
|
||||
|
||||
⊕ **new Memory**(options?: *`BaseDbOptions`*): [Memory](_memory_.memory.md)
|
||||
|
||||
*Overrides [TransactionDb](_engines_transactiondb_.transactiondb.md).[constructor](_engines_transactiondb_.transactiondb.md#constructor)*
|
||||
|
||||
*Defined in [Memory.ts:66](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/Memory.ts#L66)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| `Optional` options | `BaseDbOptions` |
|
||||
|
||||
**Returns:** [Memory](_memory_.memory.md)
|
||||
|
||||
___
|
||||
|
||||
# Methods
|
||||
|
||||
<a id="close"></a>
|
||||
|
||||
## close
|
||||
|
||||
▸ **close**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[close](_engines_transactiondb_.transactiondb.md#close)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:51](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L51)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="del"></a>
|
||||
|
||||
## del
|
||||
|
||||
▸ **del**(key: *`Uint8Array`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[del](_engines_transactiondb_.transactiondb.md#del)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:81](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L81)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="drop"></a>
|
||||
|
||||
## drop
|
||||
|
||||
▸ **drop**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[drop](_engines_transactiondb_.transactiondb.md#drop)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:59](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L59)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="empty"></a>
|
||||
|
||||
## empty
|
||||
|
||||
▸ **empty**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[empty](_engines_transactiondb_.transactiondb.md#empty)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:63](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L63)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="get"></a>
|
||||
|
||||
## get
|
||||
|
||||
▸ **get**(key: *`Uint8Array`*): `Uint8Array` | `null`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[get](_engines_transactiondb_.transactiondb.md#get)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:93](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L93)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
|
||||
**Returns:** `Uint8Array` | `null`
|
||||
|
||||
___
|
||||
<a id="maintain"></a>
|
||||
|
||||
## maintain
|
||||
|
||||
▸ **maintain**(fn: *`ProgressCb`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[maintain](_engines_transactiondb_.transactiondb.md#maintain)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:71](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L71)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `ProgressCb` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="open"></a>
|
||||
|
||||
## open
|
||||
|
||||
▸ **open**(): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[open](_engines_transactiondb_.transactiondb.md#open)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:55](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L55)*
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="put"></a>
|
||||
|
||||
## put
|
||||
|
||||
▸ **put**(key: *`Uint8Array`*, value: *`Uint8Array`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[put](_engines_transactiondb_.transactiondb.md#put)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:107](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L107)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| key | `Uint8Array` |
|
||||
| value | `Uint8Array` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="rename"></a>
|
||||
|
||||
## rename
|
||||
|
||||
▸ **rename**(base: *`string`*, file: *`string`*): `void`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[rename](_engines_transactiondb_.transactiondb.md#rename)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:67](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L67)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| base | `string` |
|
||||
| file | `string` |
|
||||
|
||||
**Returns:** `void`
|
||||
|
||||
___
|
||||
<a id="size"></a>
|
||||
|
||||
## size
|
||||
|
||||
▸ **size**(): `number`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[size](_engines_transactiondb_.transactiondb.md#size)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:77](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L77)*
|
||||
|
||||
**Returns:** `number`
|
||||
|
||||
___
|
||||
<a id="transaction"></a>
|
||||
|
||||
## transaction
|
||||
|
||||
▸ **transaction**(fn: *`function`*): `boolean`
|
||||
|
||||
*Inherited from [TransactionDb](_engines_transactiondb_.transactiondb.md).[transaction](_engines_transactiondb_.transactiondb.md#transaction)*
|
||||
|
||||
*Defined in [engines/TransactionDb.ts:29](https://github.com/polkadot-js/common/blob/1fb1f9d/packages/db/src/engines/TransactionDb.ts#L29)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Param | Type |
|
||||
| ------ | ------ |
|
||||
| fn | `function` |
|
||||
|
||||
**Returns:** `boolean`
|
||||
|
||||
___
|
||||
|
||||
Reference in New Issue
Block a user