kuzzle-sdk
Version:
Official Javascript SDK for Kuzzle
68 lines (67 loc) • 1.97 kB
TypeScript
import { Kuzzle } from "../../Kuzzle";
/**
* This class handle buffers for every supported API action of the document controller:
* - create, update, createOrReplace, replace, get, exists, delete
*
* Each buffer is filled with documents to be write/get/delete into a collection.
*
* A timer will regularly execute the m* actions with the documents inside the buffers.
*
* If the interval is too big, buffers may contain too much documents for Kuzzle limits.
* (e.g. "limits.documentsWriteCount" is 200 by default)
*
* @internal
*/
export declare class BatchWriter {
private timer;
private sdk;
/**
* Timer interval to execute m* API actions
*/
private interval;
/**
* Max write buffer size. (Should match "limits.documentsWriteCount")
*/
private maxWriteBufferSize;
/**
* Max read buffer size. (Should match "limits.documentsReadCount")
*/
private maxReadBufferSize;
private buffers;
get addCreate(): any;
get addUpdate(): any;
get addGet(): any;
get addExists(): any;
get addDelete(): any;
get addReplace(): any;
get addCreateOrReplace(): any;
constructor(sdk: Kuzzle, { interval, maxWriteBufferSize, maxReadBufferSize }?: {
interval?: number;
maxWriteBufferSize?: number;
maxReadBufferSize?: number;
});
/**
* Execute API actions with documents stored in the buffers.
*/
execute(): Promise<void>;
/**
* Initialize the buffers and start the timer
*/
begin(): void;
/**
* Execute pending actions from the buffers and stop the timer.
*/
dispose(): Promise<void>;
/**
* Reset all the buffers
*/
private prepareRound;
private sendWriteBuffer;
private sendCreateBuffer;
private sendUpdateBuffer;
private sendReplaceBuffer;
private sendCreateOrReplaceBuffer;
private sendGetBuffer;
private sendExistsBuffer;
private sendDeleteBuffer;
}