internal: incomplete vault systems behind feature flag (#2340)
This commit is contained in:
@@ -37,6 +37,10 @@ export default class WebDeviceInterface {
|
||||
return {}
|
||||
}
|
||||
|
||||
clearAllDataFromDevice() {
|
||||
localStorage.clear()
|
||||
}
|
||||
|
||||
_getDatabaseKeyPrefix(identifier) {
|
||||
if (identifier) {
|
||||
return `${identifier}-item-`
|
||||
@@ -61,29 +65,45 @@ export default class WebDeviceInterface {
|
||||
|
||||
async getDatabaseLoadChunks(options, identifier) {
|
||||
const entries = await this.getAllDatabaseEntries(identifier)
|
||||
const sorted = GetSortedPayloadsByPriority(entries, options)
|
||||
const {
|
||||
itemsKeyPayloads,
|
||||
keySystemRootKeyPayloads,
|
||||
keySystemItemsKeyPayloads,
|
||||
contentTypePriorityPayloads,
|
||||
remainingPayloads,
|
||||
} = GetSortedPayloadsByPriority(entries, options)
|
||||
|
||||
const itemsKeysChunk = {
|
||||
entries: sorted.itemsKeyPayloads,
|
||||
entries: itemsKeyPayloads,
|
||||
}
|
||||
|
||||
const keySystemRootKeysChunk = {
|
||||
entries: keySystemRootKeyPayloads,
|
||||
}
|
||||
|
||||
const keySystemItemsKeysChunk = {
|
||||
entries: keySystemItemsKeyPayloads,
|
||||
}
|
||||
|
||||
const contentTypePriorityChunk = {
|
||||
entries: sorted.contentTypePriorityPayloads,
|
||||
entries: contentTypePriorityPayloads,
|
||||
}
|
||||
|
||||
const remainingPayloadsChunks = []
|
||||
for (let i = 0; i < sorted.remainingPayloads.length; i += options.batchSize) {
|
||||
for (let i = 0; i < remainingPayloads.length; i += options.batchSize) {
|
||||
remainingPayloadsChunks.push({
|
||||
entries: sorted.remainingPayloads.slice(i, i + options.batchSize),
|
||||
entries: remainingPayloads.slice(i, i + options.batchSize),
|
||||
})
|
||||
}
|
||||
|
||||
const result = {
|
||||
fullEntries: {
|
||||
itemsKeys: itemsKeysChunk,
|
||||
keySystemRootKeys: keySystemRootKeysChunk,
|
||||
keySystemItemsKeys: keySystemItemsKeysChunk,
|
||||
remainingChunks: [contentTypePriorityChunk, ...remainingPayloadsChunks],
|
||||
},
|
||||
remainingChunksItemCount: sorted.contentTypePriorityPayloads.length + sorted.remainingPayloads.length,
|
||||
remainingChunksItemCount: contentTypePriorityPayloads.length + remainingPayloads.length,
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user