UNPKG

snowflake-sdk

Version:
107 lines (106 loc) 3.25 kB
export = QueryContextCache; /** * Most Recently Used and Priority based cache. A separate cache for each connection in the driver. */ /** * @param {Number} capacity Maximum capacity of the cache. * @param {Number} sessionId Session for which the cache is created. */ declare function QueryContextCache(capacity: number, sessionId: number): void; declare class QueryContextCache { /** * Most Recently Used and Priority based cache. A separate cache for each connection in the driver. */ /** * @param {Number} capacity Maximum capacity of the cache. * @param {Number} sessionId Session for which the cache is created. */ constructor(capacity: number, sessionId: number); sessionId: number; capacity: number; idMap: Map<any, any>; treeSet: Set<any>; priorityMap: Map<any, any>; sortTreeSet(): void; addQCE(qce: any): void; /** * Remove an element from the cache. * * @param {Object} qce element to remove. */ removeQCE(qce: Object): void; /** * Replace the cache element with a new response element. Remove old element exist in the cache * and add a new element received. * * @param {Object} oldQCE an element exist in the cache * @param {Object} newQCE a new element just received. */ replaceQCE(oldQCE: Object, newQCE: Object): void; /** * Merge a new element comes from the server with the existing cache. Merge is based on read time * stamp for the same id and based on priority for two different ids. * * @param {Number} id * @param {Number} timestamp * @param {Number} priority * @param {String} context * */ merge(newQCE: any): void; /** * After the merge, loop through priority list and make sure cache is at most capacity. Remove all * other elements from the list based on priority. */ checkCacheCapacity(): void; /** Clear the cache. */ clearCache(): void; getElements(): Set<any>; /** * @param data: the QueryContext Object serialized as a JSON format string */ deserializeQueryContext(data: any): void; deserializeQueryContextElement(node: any): QueryContextElement | null; logCacheEntries(): void; getSize(): number; getQueryContextDTO(): { entries: { id: any; timestamp: any; priority: any; context: { base64Data: any; }; }[]; }; getSerializeQueryContext(): { entries: { id: any; timestamp: any; priority: any; context: any; }[]; }; } /** * * @param {String} id * @param {Number} timestamp * @param {Number} priority * @param {String} context */ declare function QueryContextElement(id: string, timestamp: number, priority: number, context: string): void; declare class QueryContextElement { /** * * @param {String} id * @param {Number} timestamp * @param {Number} priority * @param {String} context */ constructor(id: string, timestamp: number, priority: number, context: string); id: string; timestamp: number; priority: number; context: string; }