LogoRobo.js
Framework

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 ParameterDefault type
K extends stringstring
Vunknown

Implements

Constructors

new AdapterWrapper()

new AdapterWrapper<K, V>(next): AdapterWrapper<K, V>

Parameters

ParameterType
nextFlashcoreAdapter<K, V>

Returns

AdapterWrapper<K, V>

Properties

PropertyModifierTypeDefault valueDescription
namereadonlystring'AdapterWrapper'Human-readable name for this wrapper. Subclasses should override this.
nextreadonlyFlashcoreAdapter<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
ParameterType
opsBatchOperation<K, V>[]
Returns

void | Promise<void>

Implementation of

FlashcoreAdapter.atomicBatch


compareAndSwap

Get Signature

get compareAndSwap(): (key, expected, next) => boolean | Promise<boolean>

Compare and swap. Propagates from underlying adapter if available.

Returns

Function

Parameters
ParameterType
keyK
expectedV
nextV
Returns

boolean | Promise<boolean>

Implementation of

FlashcoreAdapter.compareAndSwap


maxValueSize

Get Signature

get maxValueSize(): number

Maximum 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

FlashcoreAdapter.maxValueSize


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
ParameterType
prefixK
Returns

| K[] | Promise<K[]> | AsyncIterable<K, any, any> | Promise<AsyncIterable<K, any, any>>

Implementation of

FlashcoreAdapter.scan


setIfNotExists

Get Signature

get setIfNotExists(): (key, value) => boolean | Promise<boolean>

Set if not exists. Propagates from underlying adapter if available.

Returns

Function

Parameters
ParameterType
keyK
valueV
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
ParameterType
fn(tx) => Promise<void>
Returns

Promise<void>

Implementation of

FlashcoreAdapter.transaction

Methods

capabilities()?

optional capabilities(): Partial<AdapterCapabilitiesReport>

Extended capabilities. Propagates from underlying adapter if available.

Returns

Partial<AdapterCapabilitiesReport>

Implementation of

FlashcoreAdapter.capabilities


clear()

clear(): boolean | void | Promise<void> | Promise<boolean>

Clear all data.

Returns

boolean | void | Promise<void> | Promise<boolean>

Implementation of

FlashcoreAdapter.clear


delete()

delete(key): boolean | Promise<boolean>

Delete a key. Returns true if the key existed and was deleted.

Parameters

ParameterType
keyK

Returns

boolean | Promise<boolean>

Implementation of

FlashcoreAdapter.delete


get()

get(key): V | Promise<V>

Get a value by key. Returns undefined if the key does not exist.

Parameters

ParameterType
keyK

Returns

V | Promise<V>

Implementation of

FlashcoreAdapter.get


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

ParameterType
keyK

Returns

boolean | Promise<boolean>

Implementation of

FlashcoreAdapter.has


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

FlashcoreAdapter.init


set()

set(key, value): boolean | Promise<boolean>

Set a key-value pair. Returns true if the operation succeeded.

Parameters

ParameterType
keyK
valueV

Returns

boolean | Promise<boolean>

Implementation of

FlashcoreAdapter.set


shutdown()?

optional shutdown(): void | Promise<void>

Shutdown the adapter (e.g., close connections).

Returns

void | Promise<void>

Implementation of

FlashcoreAdapter.shutdown

On this page