abstract AdapterWrapper<K, V>
Class: abstract AdapterWrapper<K, V>
Base class for adapter wrappers.
Implements the decorator pattern: wraps an underlying adapter and passes through all method calls by default. Subclasses override specific methods to add behavior.
Correctly propagates optional capabilities from the wrapped adapter.
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
K extends string | string |
V | unknown |
Implements
FlashcoreAdapter<K,V>
Constructors
new AdapterWrapper()
new AdapterWrapper<K, V>(next): AdapterWrapper<K, V>Parameters
| Parameter | Type |
|---|---|
next | FlashcoreAdapter<K, V> |
Returns
AdapterWrapper<K, V>
Properties
| Property | Modifier | Type | Default value | Description |
|---|---|---|---|---|
name | readonly | string | 'AdapterWrapper' | Human-readable name for this wrapper. Subclasses should override this. |
next | readonly | FlashcoreAdapter<K, V> | undefined | - |
Accessors
atomicBatch
Get Signature
get atomicBatch(): (ops) => void | Promise<void>Atomic batch operations. Propagates from underlying adapter if available.
Returns
Function
Parameters
| Parameter | Type |
|---|---|
ops | BatchOperation<K, V>[] |
Returns
void | Promise<void>
Implementation of
compareAndSwap
Get Signature
get compareAndSwap(): (key, expected, next) => boolean | Promise<boolean>Compare and swap. Propagates from underlying adapter if available.
Returns
Function
Parameters
| Parameter | Type |
|---|---|
key | K |
expected | V |
next | V |
Returns
boolean | Promise<boolean>
Implementation of
FlashcoreAdapter.compareAndSwap
maxValueSize
Get Signature
get maxValueSize(): numberMaximum value size. Propagates from underlying adapter if available.
Returns
number
Maximum size in bytes for a single value. Used for chunk sizing and WAL segmentation.
Implementation of
scan
Get Signature
get scan(): (prefix) =>
| K[]
| Promise<K[]>
| AsyncIterable<K, any, any>
| Promise<AsyncIterable<K, any, any>>Scan for keys with a prefix. Propagates from underlying adapter if available.
Returns
Function
Parameters
| Parameter | Type |
|---|---|
prefix | K |
Returns
| K[]
| Promise<K[]>
| AsyncIterable<K, any, any>
| Promise<AsyncIterable<K, any, any>>
Implementation of
setIfNotExists
Get Signature
get setIfNotExists(): (key, value) => boolean | Promise<boolean>Set if not exists. Propagates from underlying adapter if available.
Returns
Function
Parameters
| Parameter | Type |
|---|---|
key | K |
value | V |
Returns
boolean | Promise<boolean>
Implementation of
FlashcoreAdapter.setIfNotExists
transaction
Get Signature
get transaction(): (fn) => Promise<void>Native transaction API. Propagates from underlying adapter if available.
Returns
Function
Parameters
| Parameter | Type |
|---|---|
fn | (tx) => Promise<void> |
Returns
Promise<void>
Implementation of
Methods
capabilities()?
optional capabilities(): Partial<AdapterCapabilitiesReport>Extended capabilities. Propagates from underlying adapter if available.
Returns
Partial<AdapterCapabilitiesReport>
Implementation of
clear()
clear(): boolean | void | Promise<void> | Promise<boolean>Clear all data.
Returns
boolean | void | Promise<void> | Promise<boolean>
Implementation of
delete()
delete(key): boolean | Promise<boolean>Delete a key. Returns true if the key existed and was deleted.
Parameters
| Parameter | Type |
|---|---|
key | K |
Returns
boolean | Promise<boolean>
Implementation of
get()
get(key): V | Promise<V>Get a value by key. Returns undefined if the key does not exist.
Parameters
| Parameter | Type |
|---|---|
key | K |
Returns
V | Promise<V>
Implementation of
getInnermostAdapter()
protected getInnermostAdapter(): FlashcoreAdapter<K, V>Get the innermost adapter by unwrapping all wrappers.
Returns
FlashcoreAdapter<K, V>
getWrappedAdapter()
protected getWrappedAdapter(): FlashcoreAdapter<K, V>Get the underlying (wrapped) adapter.
Returns
FlashcoreAdapter<K, V>
has()
has(key): boolean | Promise<boolean>Check if a key exists. Must return true for stored falsy values (0, false, '', null).
Parameters
| Parameter | Type |
|---|---|
key | K |
Returns
boolean | Promise<boolean>
Implementation of
init()?
optional init(): void | Promise<void>Initialize the adapter (e.g., connect, create directories). Called once during Flashcore.$.init().
Returns
void | Promise<void>
Implementation of
set()
set(key, value): boolean | Promise<boolean>Set a key-value pair. Returns true if the operation succeeded.
Parameters
| Parameter | Type |
|---|---|
key | K |
value | V |
Returns
boolean | Promise<boolean>
Implementation of
shutdown()?
optional shutdown(): void | Promise<void>Shutdown the adapter (e.g., close connections).
Returns
void | Promise<void>
