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