@atlaspack/cache 2.12.1-dev.3502 → 2.12.1-dev.3520
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/LMDBLiteCache.js +6 -8
- package/package.json +7 -7
- package/src/LMDBLiteCache.js +10 -9
package/lib/LMDBLiteCache.js
CHANGED
@@ -106,8 +106,8 @@ class LMDBLiteCache {
|
|
106
106
|
dir: this.dir
|
107
107
|
};
|
108
108
|
}
|
109
|
-
static deserialize(
|
110
|
-
return new LMDBLiteCache(
|
109
|
+
static deserialize(cache) {
|
110
|
+
return new LMDBLiteCache(cache.dir);
|
111
111
|
}
|
112
112
|
has(key) {
|
113
113
|
return Promise.resolve(this.store.get(key) != null);
|
@@ -128,12 +128,10 @@ class LMDBLiteCache {
|
|
128
128
|
setStream(key, stream) {
|
129
129
|
return pipeline(stream, this.fs.createWriteStream(_path().default.join(this.dir, key)));
|
130
130
|
}
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
return Promise.reject(err);
|
136
|
-
}
|
131
|
+
|
132
|
+
// eslint-disable-next-line require-await
|
133
|
+
async getBlob(key) {
|
134
|
+
return this.getBlobSync(key);
|
137
135
|
}
|
138
136
|
getBlobSync(key) {
|
139
137
|
const buffer = this.store.get(key);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaspack/cache",
|
3
3
|
"description": "Interface for defining caches and file-system, IDB and LMDB implementations.",
|
4
|
-
"version": "2.12.1-dev.
|
4
|
+
"version": "2.12.1-dev.3520+8a5346e28",
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
6
6
|
"publishConfig": {
|
7
7
|
"access": "public"
|
@@ -22,11 +22,11 @@
|
|
22
22
|
"check-ts": "tsc --noEmit index.d.ts"
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@atlaspack/build-cache": "2.12.1-dev.
|
26
|
-
"@atlaspack/fs": "2.12.1-dev.
|
27
|
-
"@atlaspack/logger": "2.12.1-dev.
|
28
|
-
"@atlaspack/rust": "2.12.1-dev.
|
29
|
-
"@atlaspack/utils": "2.12.1-dev.
|
25
|
+
"@atlaspack/build-cache": "2.12.1-dev.3520+8a5346e28",
|
26
|
+
"@atlaspack/fs": "2.12.1-dev.3520+8a5346e28",
|
27
|
+
"@atlaspack/logger": "2.12.1-dev.3520+8a5346e28",
|
28
|
+
"@atlaspack/rust": "2.12.1-dev.3520+8a5346e28",
|
29
|
+
"@atlaspack/utils": "2.12.1-dev.3520+8a5346e28",
|
30
30
|
"lmdb": "2.8.5"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
@@ -36,5 +36,5 @@
|
|
36
36
|
"./src/IDBCache.js": "./src/IDBCache.browser.js",
|
37
37
|
"./src/LMDBCache.js": false
|
38
38
|
},
|
39
|
-
"gitHead": "
|
39
|
+
"gitHead": "8a5346e28c1bb3b9cd40f1c4e77c66dd6666f1e4"
|
40
40
|
}
|
package/src/LMDBLiteCache.js
CHANGED
@@ -72,6 +72,10 @@ const pipeline: (Readable, Writable) => Promise<void> = promisify(
|
|
72
72
|
stream.pipeline,
|
73
73
|
);
|
74
74
|
|
75
|
+
export type SerLMDBLiteCache = {|
|
76
|
+
dir: FilePath,
|
77
|
+
|};
|
78
|
+
|
75
79
|
export class LMDBLiteCache implements Cache {
|
76
80
|
fs: NodeFS;
|
77
81
|
dir: FilePath;
|
@@ -101,14 +105,14 @@ export class LMDBLiteCache implements Cache {
|
|
101
105
|
return Promise.resolve();
|
102
106
|
}
|
103
107
|
|
104
|
-
serialize():
|
108
|
+
serialize(): SerLMDBLiteCache {
|
105
109
|
return {
|
106
110
|
dir: this.dir,
|
107
111
|
};
|
108
112
|
}
|
109
113
|
|
110
|
-
static deserialize(
|
111
|
-
return new LMDBLiteCache(
|
114
|
+
static deserialize(cache: SerLMDBLiteCache): LMDBLiteCache {
|
115
|
+
return new LMDBLiteCache(cache.dir);
|
112
116
|
}
|
113
117
|
|
114
118
|
has(key: string): Promise<boolean> {
|
@@ -139,12 +143,9 @@ export class LMDBLiteCache implements Cache {
|
|
139
143
|
);
|
140
144
|
}
|
141
145
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
} catch (err) {
|
146
|
-
return Promise.reject(err);
|
147
|
-
}
|
146
|
+
// eslint-disable-next-line require-await
|
147
|
+
async getBlob(key: string): Promise<Buffer> {
|
148
|
+
return this.getBlobSync(key);
|
148
149
|
}
|
149
150
|
|
150
151
|
getBlobSync(key: string): Buffer {
|