session-ios/SessionSnodeKit/Storage.swift

29 lines
1.5 KiB
Swift
Raw Normal View History

2020-11-09 00:58:47 +01:00
import SessionUtilitiesKit
2020-12-07 06:00:21 +01:00
import PromiseKit
2021-07-12 05:22:35 +02:00
import Sodium
2020-11-05 02:07:21 +01:00
2020-11-05 03:39:32 +01:00
public protocol SessionSnodeKitStorageProtocol {
2020-11-05 02:07:21 +01:00
2020-12-07 06:00:21 +01:00
@discardableResult
func write(with block: @escaping (Any) -> Void) -> Promise<Void>
@discardableResult
func write(with block: @escaping (Any) -> Void, completion: @escaping () -> Void) -> Promise<Void>
2020-12-07 06:00:21 +01:00
func writeSync(with block: @escaping (Any) -> Void)
2020-11-05 02:07:21 +01:00
func getUserPublicKey() -> String?
2021-07-12 05:22:35 +02:00
func getUserED25519KeyPair() -> Box.KeyPair?
2020-11-05 02:07:21 +01:00
func getOnionRequestPaths() -> [OnionRequestAPI.Path]
func setOnionRequestPaths(to paths: [OnionRequestAPI.Path], using transaction: Any)
func getSnodePool() -> Set<Snode>
func setSnodePool(to snodePool: Set<Snode>, using transaction: Any)
2020-12-06 23:29:46 +01:00
func getLastSnodePoolRefreshDate() -> Date?
func setLastSnodePoolRefreshDate(to date: Date, using transaction: Any)
2020-11-05 02:07:21 +01:00
func getSwarm(for publicKey: String) -> Set<Snode>
func setSwarm(to swarm: Set<Snode>, for publicKey: String, using transaction: Any)
func getLastMessageHash(for snode: Snode, associatedWith publicKey: String) -> String?
func setLastMessageHashInfo(for snode: Snode, associatedWith publicKey: String, to lastMessageHashInfo: JSON, using transaction: Any)
func pruneLastMessageHashInfoIfExpired(for snode: Snode, associatedWith publicKey: String)
2020-11-05 02:07:21 +01:00
func getReceivedMessages(for publicKey: String) -> Set<String>
func setReceivedMessages(to receivedMessages: Set<String>, for publicKey: String, using transaction: Any)
}