Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3352949
D7185.id24375.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7185.id24375.diff
View Options
diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js
--- a/web/database/worker/db-worker.js
+++ b/web/database/worker/db-worker.js
@@ -25,6 +25,11 @@
updateDraft,
} from '../queries/draft-queries.js';
import { getMetadata, setMetadata } from '../queries/metadata-queries.js';
+import {
+ getPersistStorageItem,
+ removePersistStorageItem,
+ setPersistStorageItem,
+} from '../queries/storage-engine-queries.js';
import {
CURRENT_USER_ID_KEY,
SQLITE_CONTENT,
@@ -144,6 +149,32 @@
type: workerResponseMessageTypes.GET_CURRENT_USER_ID,
userID,
};
+ } else if (
+ message.type === workerRequestMessageTypes.GET_PERSIST_STORAGE_ITEM
+ ) {
+ if (!sqliteDb) {
+ throw new Error('Database not initialized');
+ }
+ return {
+ type: workerResponseMessageTypes.GET_PERSIST_STORAGE_ITEM,
+ item: getPersistStorageItem(sqliteDb, message.key),
+ };
+ } else if (
+ message.type === workerRequestMessageTypes.SET_PERSIST_STORAGE_ITEM
+ ) {
+ if (!sqliteDb) {
+ throw new Error('Database not initialized');
+ }
+ setPersistStorageItem(sqliteDb, message.key, message.item);
+ return;
+ } else if (
+ message.type === workerRequestMessageTypes.REMOVE_PERSIST_STORAGE_ITEM
+ ) {
+ if (!sqliteDb) {
+ throw new Error('Database not initialized');
+ }
+ removePersistStorageItem(sqliteDb, message.key);
+ return;
}
throw new Error('Request type not supported');
diff --git a/web/types/worker-types.js b/web/types/worker-types.js
--- a/web/types/worker-types.js
+++ b/web/types/worker-types.js
@@ -14,6 +14,9 @@
GET_CLIENT_STORE: 4,
SET_CURRENT_USER_ID: 5,
GET_CURRENT_USER_ID: 6,
+ GET_PERSIST_STORAGE_ITEM: 7,
+ SET_PERSIST_STORAGE_ITEM: 8,
+ REMOVE_PERSIST_STORAGE_ITEM: 9,
});
export type PingWorkerRequestMessage = {
@@ -49,6 +52,22 @@
+type: 6,
};
+export type GetPersistStorageItemRequestMessage = {
+ +type: 7,
+ +key: string,
+};
+
+export type SetPersistStorageItemRequestMessage = {
+ +type: 8,
+ +key: string,
+ +item: string,
+};
+
+export type RemovePersistStorageItemRequestMessage = {
+ +type: 9,
+ +key: string,
+};
+
export type WorkerRequestMessage =
| PingWorkerRequestMessage
| InitWorkerRequestMessage
@@ -56,7 +75,10 @@
| ProcessStoreOperationsRequestMessage
| GetClientStoreRequestMessage
| SetCurrentUserIDRequestMessage
- | GetCurrentUserIDRequestMessage;
+ | GetCurrentUserIDRequestMessage
+ | GetPersistStorageItemRequestMessage
+ | SetPersistStorageItemRequestMessage
+ | RemovePersistStorageItemRequestMessage;
export type WorkerRequestProxyMessage = {
+id: number,
@@ -68,6 +90,7 @@
PONG: 0,
CLIENT_STORE: 1,
GET_CURRENT_USER_ID: 2,
+ GET_PERSIST_STORAGE_ITEM: 3,
});
export type PongWorkerResponseMessage = {
@@ -85,10 +108,16 @@
+userID: ?string,
};
+export type GetPersistStorageItemResponseMessage = {
+ +type: 3,
+ +item: string,
+};
+
export type WorkerResponseMessage =
| PongWorkerResponseMessage
| ClientStoreResponseMessage
- | GetCurrentUserIDResponseMessage;
+ | GetCurrentUserIDResponseMessage
+ | GetPersistStorageItemResponseMessage;
export type WorkerResponseProxyMessage = {
+id?: number,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 7:27 AM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574542
Default Alt Text
D7185.id24375.diff (3 KB)
Attached To
Mode
D7185: [web-db] process redux-persist operations in SQLite
Attached
Detach File
Event Timeline
Log In to Comment