Id -> ID renaming.

This commit is contained in:
Brent Simmons 2024-04-07 15:25:27 -07:00
parent 1a7c2251a3
commit c62e3293a6
6 changed files with 19 additions and 19 deletions

View File

@ -9,21 +9,21 @@
import Foundation import Foundation
protocol FeedlyEntryIdentifierProviding: AnyObject { protocol FeedlyEntryIdentifierProviding: AnyObject {
@MainActor var entryIds: Set<String> { get } @MainActor var entryIDs: Set<String> { get }
} }
final class FeedlyEntryIdentifierProvider: FeedlyEntryIdentifierProviding { final class FeedlyEntryIdentifierProvider: FeedlyEntryIdentifierProviding {
private (set) var entryIds: Set<String> private (set) var entryIDs: Set<String>
init(entryIds: Set<String> = Set()) { init(entryIDs: Set<String> = Set()) {
self.entryIds = entryIds self.entryIDs = entryIDs
} }
@MainActor func addEntryIds(from provider: FeedlyEntryIdentifierProviding) { @MainActor func addEntryIDs(from provider: FeedlyEntryIdentifierProviding) {
entryIds.formUnion(provider.entryIds) entryIDs.formUnion(provider.entryIDs)
} }
@MainActor func addEntryIds(in articleIds: [String]) { @MainActor func addEntryIDs(in articleIds: [String]) {
entryIds.formUnion(articleIds) entryIDs.formUnion(articleIds)
} }
} }

View File

@ -35,16 +35,16 @@ class FeedlyDownloadArticlesOperation: FeedlyOperation {
} }
override func run() { override func run() {
var articleIds = missingArticleEntryIdProvider.entryIds var articleIds = missingArticleEntryIdProvider.entryIDs
articleIds.formUnion(updatedArticleEntryIdProvider.entryIds) articleIds.formUnion(updatedArticleEntryIdProvider.entryIDs)
os_log(.debug, log: log, "Requesting %{public}i articles.", articleIds.count) os_log(.debug, log: log, "Requesting %{public}i articles.", articleIds.count)
let feedlyAPILimitBatchSize = 1000 let feedlyAPILimitBatchSize = 1000
for articleIds in Array(articleIds).chunked(into: feedlyAPILimitBatchSize) { for articleIds in Array(articleIds).chunked(into: feedlyAPILimitBatchSize) {
Task { @MainActor in Task { @MainActor in
let provider = FeedlyEntryIdentifierProvider(entryIds: Set(articleIds)) let provider = FeedlyEntryIdentifierProvider(entryIDs: Set(articleIds))
let getEntries = FeedlyGetEntriesOperation(service: getEntriesService, provider: provider, log: log) let getEntries = FeedlyGetEntriesOperation(service: getEntriesService, provider: provider, log: log)
getEntries.delegate = self getEntries.delegate = self
self.operationQueue.add(getEntries) self.operationQueue.add(getEntries)

View File

@ -13,8 +13,8 @@ final class FeedlyFetchIdsForMissingArticlesOperation: FeedlyOperation, FeedlyEn
private let account: Account private let account: Account
private(set) var entryIds = Set<String>() private(set) var entryIDs = Set<String>()
init(account: Account) { init(account: Account) {
self.account = account self.account = account
} }
@ -25,7 +25,7 @@ final class FeedlyFetchIdsForMissingArticlesOperation: FeedlyOperation, FeedlyEn
do { do {
if let articleIDs = try await account.fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate() { if let articleIDs = try await account.fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate() {
self.entryIds.formUnion(articleIDs) self.entryIDs.formUnion(articleIDs)
} }
self.didFinish() self.didFinish()

View File

@ -54,7 +54,7 @@ final class FeedlyGetEntriesOperation: FeedlyOperation, FeedlyEntryProviding, Fe
} }
override func run() { override func run() {
service.getEntries(for: provider.entryIds) { result in service.getEntries(for: provider.entryIDs) { result in
switch result { switch result {
case .success(let entries): case .success(let entries):
self.entries = entries self.entries = entries

View File

@ -16,7 +16,7 @@ protocol FeedlyGetStreamIdsOperationDelegate: AnyObject {
/// Single responsibility is to get the stream ids from Feedly. /// Single responsibility is to get the stream ids from Feedly.
final class FeedlyGetStreamIdsOperation: FeedlyOperation, FeedlyEntryIdentifierProviding { final class FeedlyGetStreamIdsOperation: FeedlyOperation, FeedlyEntryIdentifierProviding {
var entryIds: Set<String> { var entryIDs: Set<String> {
guard let ids = streamIds?.ids else { guard let ids = streamIds?.ids else {
assertionFailure("Has this operation been addeded as a dependency on the caller?") assertionFailure("Has this operation been addeded as a dependency on the caller?")
return [] return []

View File

@ -35,7 +35,7 @@ class FeedlyGetUpdatedArticleIdsOperation: FeedlyOperation, FeedlyEntryIdentifie
self.init(account: account, resource: all, service: service, newerThan: newerThan, log: log) self.init(account: account, resource: all, service: service, newerThan: newerThan, log: log)
} }
var entryIds: Set<String> { var entryIDs: Set<String> {
return storedUpdatedArticleIds return storedUpdatedArticleIds
} }