Skip to main content

SqliteBucketStorage

Extends

Implements

Constructors

new SqliteBucketStorage()

new SqliteBucketStorage(
db,
mutex,
logger?): SqliteBucketStorage

Parameters

ParameterType
dbDBAdapter
mutexMutex
logger?ILogger

Returns

SqliteBucketStorage

Overrides

BaseObserver.constructor

Properties

PropertyType
tableNamesSet<string>

Methods

_getClientId()

_getClientId(): Promise<string>

Returns

Promise<string>


autoCompact()

autoCompact(): Promise<void>

Exposed for tests only.

Returns

Promise<void>

Implementation of

BucketStorageAdapter.autoCompact


dispose()

dispose(): Promise<void>

Returns

Promise<void>

Implementation of

BucketStorageAdapter.dispose


forceCompact()

forceCompact(): Promise<void>

Force a compact, for tests.

Returns

Promise<void>

Implementation of

BucketStorageAdapter.forceCompact


getBucketStates()

getBucketStates(): Promise<BucketState[]>

Returns

Promise<BucketState[]>

Implementation of

BucketStorageAdapter.getBucketStates


getClientId()

getClientId(): Promise<string>

Get an unique client id.

Returns

Promise<string>

Implementation of

BucketStorageAdapter.getClientId


getCrudBatch()

getCrudBatch(limit?): Promise<null | CrudBatch>

Get a batch of objects to send to the server. When the objects are successfully sent to the server, call .complete()

Parameters

ParameterType
limit?number

Returns

Promise<null | CrudBatch>

Implementation of

BucketStorageAdapter.getCrudBatch


getMaxOpId()

getMaxOpId(): string

Returns

string

Implementation of

BucketStorageAdapter.getMaxOpId


hasCompletedSync()

hasCompletedSync(): Promise<boolean>

Returns

Promise<boolean>

Implementation of

BucketStorageAdapter.hasCompletedSync


hasCrud()

hasCrud(): Promise<boolean>

Returns

Promise<boolean>

Implementation of

BucketStorageAdapter.hasCrud


init()

init(): Promise<void>

Returns

Promise<void>

Implementation of

BucketStorageAdapter.init


iterateAsyncListeners()

iterateAsyncListeners(cb): Promise<void>

Parameters

ParameterType
cb(listener) => Promise<any>

Returns

Promise<void>

Implementation of

BucketStorageAdapter.iterateAsyncListeners

Inherited from

BaseObserver.iterateAsyncListeners


iterateListeners()

iterateListeners(cb): void

Parameters

ParameterType
cb(listener) => any

Returns

void

Implementation of

BucketStorageAdapter.iterateListeners

Inherited from

BaseObserver.iterateListeners


nextCrudItem()

nextCrudItem(): Promise<undefined | CrudEntry>

Returns

Promise<undefined | CrudEntry>

Implementation of

BucketStorageAdapter.nextCrudItem


registerListener()

registerListener(listener): () => void

Register a listener for updates to the PowerSync client.

Parameters

ParameterType
listenerPartial<BucketStorageListener>

Returns

Function

Returns

void

Implementation of

BucketStorageAdapter.registerListener

Inherited from

BaseObserver.registerListener


removeBuckets()

removeBuckets(buckets): Promise<void>

Parameters

ParameterType
bucketsstring[]

Returns

Promise<void>

Implementation of

BucketStorageAdapter.removeBuckets


saveSyncData()

saveSyncData(batch): Promise<void>

Parameters

ParameterType
batchSyncDataBatch

Returns

Promise<void>

Implementation of

BucketStorageAdapter.saveSyncData


setTargetCheckpoint()

setTargetCheckpoint(checkpoint): Promise<void>

Set a target checkpoint.

Parameters

ParameterType
checkpointCheckpoint

Returns

Promise<void>

Implementation of

BucketStorageAdapter.setTargetCheckpoint


startSession()

startSession(): void

Reset any caches.

Returns

void

Implementation of

BucketStorageAdapter.startSession


syncLocalDatabase()

syncLocalDatabase(checkpoint): Promise<SyncLocalDatabaseResult>

Parameters

ParameterType
checkpointCheckpoint

Returns

Promise<SyncLocalDatabaseResult>

Implementation of

BucketStorageAdapter.syncLocalDatabase


updateLocalTarget()

updateLocalTarget(cb): Promise<boolean>

Parameters

ParameterType
cb() => Promise<string>

Returns

Promise<boolean>

Implementation of

BucketStorageAdapter.updateLocalTarget


validateChecksums()

validateChecksums(checkpoint): Promise<SyncLocalDatabaseResult>

Parameters

ParameterType
checkpointCheckpoint

Returns

Promise<SyncLocalDatabaseResult>


writeTransaction()

writeTransaction<T>(callback, options?): Promise<T>

Type parameters

Type parameter
T

Parameters

ParameterType
callback(tx) => Promise<T>
options?object
options.timeoutMs?number

Returns

Promise<T>