Give DatabaseTable an RSDatabaseQueue.
This commit is contained in:
parent
02174012ec
commit
da9a974dff
@ -12,10 +12,12 @@ import Data
|
|||||||
final class ArticlesTable: DatabaseTable {
|
final class ArticlesTable: DatabaseTable {
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
|
let queue: RSDatabaseQueue
|
||||||
|
|
||||||
init(name: String) {
|
init(name: String, queue: RSDatabaseQueue) {
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.queue = queue
|
||||||
}
|
}
|
||||||
|
|
||||||
private let cachedArticles: NSMapTable<NSString, Article> = NSMapTable.weakToWeakObjects()
|
private let cachedArticles: NSMapTable<NSString, Article> = NSMapTable.weakToWeakObjects()
|
||||||
|
@ -32,9 +32,12 @@ import Data
|
|||||||
final class AttachmentsTable: DatabaseTable {
|
final class AttachmentsTable: DatabaseTable {
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
|
let queue: RSDatabaseQueue
|
||||||
|
|
||||||
|
init(name: String, queue: RSDatabaseQueue) {
|
||||||
|
|
||||||
init(name: String) {
|
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.queue = queue
|
||||||
}
|
}
|
||||||
|
|
||||||
private var cachedAttachments = [String: Attachment]() // Attachment.databaseID key
|
private var cachedAttachments = [String: Attachment]() // Attachment.databaseID key
|
||||||
|
@ -12,10 +12,12 @@ import Data
|
|||||||
final class AuthorsTable: DatabaseTable {
|
final class AuthorsTable: DatabaseTable {
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
|
let queue: RSDatabaseQueue
|
||||||
|
|
||||||
init(name: String) {
|
init(name: String, queue: RSDatabaseQueue) {
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.queue = queue
|
||||||
}
|
}
|
||||||
|
|
||||||
var cachedAuthors = [String: Author]()
|
var cachedAuthors = [String: Author]()
|
||||||
|
@ -16,10 +16,12 @@ final class StatusesTable: DatabaseTable {
|
|||||||
|
|
||||||
var cachedStatuses = [String: ArticleStatus]()
|
var cachedStatuses = [String: ArticleStatus]()
|
||||||
let name: String
|
let name: String
|
||||||
|
let queue: RSDatabaseQueue
|
||||||
|
|
||||||
init(name: String) {
|
init(name: String, queue: RSDatabaseQueue) {
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.queue = queue
|
||||||
}
|
}
|
||||||
|
|
||||||
func markArticles(_ articles: Set<Article>, statusKey: String, flag: Bool) {
|
func markArticles(_ articles: Set<Article>, statusKey: String, flag: Bool) {
|
||||||
|
@ -19,13 +19,15 @@ typealias TagNameSet = Set<String>
|
|||||||
final class TagsTable: DatabaseTable {
|
final class TagsTable: DatabaseTable {
|
||||||
|
|
||||||
let name: String
|
let name: String
|
||||||
|
let queue: RSDatabaseQueue
|
||||||
|
|
||||||
private var articleIDCache = [String: TagNameSet]() // articleID: tags
|
private var articleIDCache = [String: TagNameSet]() // articleID: tags
|
||||||
private var articleIDsWithNoTags = TagNameSet()
|
private var articleIDsWithNoTags = Set<String>
|
||||||
|
|
||||||
init(name: String) {
|
init(name: String, queue: RSDatabaseQueue) {
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.queue = queue
|
||||||
}
|
}
|
||||||
|
|
||||||
func saveTagsForArticles(_ articles: Set<Article>) {
|
func saveTagsForArticles(_ articles: Set<Article>) {
|
||||||
|
@ -10,9 +10,10 @@ import Foundation
|
|||||||
|
|
||||||
public protocol DatabaseTable {
|
public protocol DatabaseTable {
|
||||||
|
|
||||||
public var name: String {get}
|
var name: String {get}
|
||||||
|
var queue: RSDatabaseQueue {get}
|
||||||
|
|
||||||
public init(name: String)
|
init(name: String, queue: RSDatabaseQueue)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension DatabaseTable {
|
extension DatabaseTable {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user