Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clickhouse-buffer

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickhouse-buffer - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

6

lib/index.d.ts

@@ -48,6 +48,6 @@ import { ClickhouseClient } from "@watchdg/clickhouse-client";

private static calcBytes;
private static getStreamEncoder;
private static maxTimeHandler;
private static isConditionMet;
private static maxTimeHandler;
private static flushToFiles;
private static getStreamEncoder;
private static loadToDatabase;

@@ -61,3 +61,3 @@ static getRowsInFiles(files: string[]): number;

loadFilesToDatabase(): Promise<void>;
release(): void;
release(): Promise<void>;
filesInMemory(): number;

@@ -64,0 +64,0 @@ rowsInMemory(): number;

@@ -81,5 +81,11 @@ "use strict";

}
static isConditionMet(self) {
return (self.conditions?.maxTime && (Date.now() - self.lastLoadDate) >= self.conditions.maxTime) ||
(self.conditions?.maxRows && self.statRowsInFiles >= self.conditions.maxRows);
static getStreamEncoder(contentEncoding) {
switch (contentEncoding) {
case 'gzip':
return (0, zlib_1.createGzip)();
case 'br':
return (0, zlib_1.createBrotliCompress)();
case 'deflate':
return (0, zlib_1.createDeflate)();
}
}

@@ -92,2 +98,6 @@ static maxTimeHandler(self) {

}
static isConditionMet(self) {
return (self.conditions?.maxTime && (Date.now() - self.lastLoadDate) >= self.conditions.maxTime) ||
(self.conditions?.maxRows && self.statRowsInFiles >= self.conditions.maxRows);
}
static async flushToFiles(self, rows, checkConditions = false) {

@@ -134,19 +144,9 @@ const rowsLength = rows.length;

}
static getStreamEncoder(contentEncoding) {
switch (contentEncoding) {
case 'gzip':
return (0, zlib_1.createGzip)();
case 'br':
return (0, zlib_1.createBrotliCompress)();
case 'deflate':
return (0, zlib_1.createDeflate)();
}
}
static async loadToDatabase(self, files) {
self.lastLoadDate = Date.now();
const paths = files.map(function (filename) {
return path_1.default.join(self.directoryPath, filename);
});
await self.loadToDatabaseMutex.acquire();
try {
await self.loadToDatabaseMutex.acquire()
.then(async function () {
const paths = files.map(function (filename) {
return path_1.default.join(self.directoryPath, filename);
});
let stream = (0, files_to_stream_1.filesToStream)(Array.from(paths));

@@ -162,10 +162,9 @@ const encoder = ClickhouseBuffer.getStreamEncoder(self.compressed);

});
}
catch (error) {
//
}
self.loadToDatabaseMutex.release();
for (const path of paths) {
await (0, promises_1.rm)(path, { force: true });
}
for (const path of paths) {
await (0, promises_1.rm)(path, { force: true });
}
})
.finally(function () {
self.loadToDatabaseMutex.release();
});
}

@@ -213,8 +212,9 @@ static getRowsInFiles(files) {

}
release() {
this.clickhouseClient.close().finally();
async release() {
if (this.conditions.maxTime) {
clearInterval(this.maxTimeTimer);
}
setImmediate(ClickhouseBuffer.flushToFiles, this, this.rows);
const rows = this.resetRows();
await ClickhouseBuffer.flushToFiles(this, rows, false);
await this.clickhouseClient.close();
}

@@ -221,0 +221,0 @@ filesInMemory() {

{
"name": "clickhouse-buffer",
"version": "1.8.0",
"version": "1.9.0",
"license": "MIT",

@@ -26,3 +26,3 @@ "author": {

"devDependencies": {
"@types/jest": "^28.1.3",
"@types/jest": "^28.1.4",
"@types/node": "^18.0.0",

@@ -32,3 +32,3 @@ "@typescript-eslint/eslint-plugin": "^5.30.0",

"eslint": "^8.18.0",
"jest": "^28.1.1",
"jest": "^28.1.2",
"rimraf": "^3.0.2",

@@ -35,0 +35,0 @@ "ts-jest": "^28.0.5",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc