Initial ad messages implementation

This commit is contained in:
Ali
2021-08-24 19:40:25 +02:00
parent 01d708ef4d
commit 44562a845a
26 changed files with 930 additions and 38 deletions

View File

@@ -71,6 +71,10 @@ final class ItemCacheTable: Table {
self.valueBox.set(self.table, key: self.itemKey(id: id), value: encoder.readBufferNoCopy())
})
}
func putData(id: ItemCacheEntryId, entry: Data, metaTable: ItemCacheMetaTable) {
self.valueBox.set(self.table, key: self.itemKey(id: id), value: ReadBuffer(data: entry))
}
func retrieve(id: ItemCacheEntryId, metaTable: ItemCacheMetaTable) -> PostboxCoding? {
if let value = self.valueBox.get(self.table, key: self.itemKey(id: id)), let entry = PostboxDecoder(buffer: value).decodeRootObject() {
@@ -78,6 +82,13 @@ final class ItemCacheTable: Table {
}
return nil
}
func retrieveData(id: ItemCacheEntryId, metaTable: ItemCacheMetaTable) -> Data? {
if let value = self.valueBox.get(self.table, key: self.itemKey(id: id)) {
return value.makeData()
}
return nil
}
func remove(id: ItemCacheEntryId, metaTable: ItemCacheMetaTable) {
self.valueBox.remove(self.table, key: self.itemKey(id: id), secure: false)