Skip to content

Commit

Permalink
Latest Rearrange, small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Jan 20, 2024
1 parent e2a38d8 commit f2a53b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/Rearrange",
"state" : {
"revision" : "3b154b59176ce40839071e7830c83410a0139d86"
"revision" : "3b154b59176ce40839071e7830c83410a0139d86",
"version" : "1.8.0"
}
},
{
Expand Down
10 changes: 7 additions & 3 deletions Sources/RangeState/RangeValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ public final class RangeValidator<Content: VersionedContent> {
self.continuation = continuation

Task {
for await versionedRange in stream {
await validateRangeAsync(versionedRange)
}
await self.beginMonitoring(stream)
}
}

deinit {
continuation.finish()
}

private func beginMonitoring(_ stream: Sequence) async {
for await versionedRange in stream {
await self.validateRangeAsync(versionedRange)
}
}

/// Manually mark a region as invalid.
public func invalidate(_ target: RangeTarget) {
let invalidated = target.indexSet(with: length)
Expand Down

0 comments on commit f2a53b1

Please sign in to comment.