-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
127 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
@_exported import ConcurrencyTaskManager | ||
@_exported import Combine | ||
@_exported import VergeComparator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import VergeComparator | ||
|
||
public enum NormalizedStorageComparisons<Storage: NormalizedStorageType> { | ||
|
||
/// True indicates database is not changed | ||
public struct StorageComparison: Comparison { | ||
public typealias Input = Storage | ||
|
||
public func callAsFunction(_ lhs: Storage, _ rhs: Storage) -> Bool { | ||
|
||
lhs == rhs | ||
|
||
// (lhs._backingStorage.entityUpdatedMarker, lhs._backingStorage.indexUpdatedMarker) == (rhs._backingStorage.entityUpdatedMarker, rhs._backingStorage.indexUpdatedMarker) | ||
} | ||
} | ||
|
||
/// Returns true if the table of the entity in database has no changes. | ||
/// | ||
/// - Complexity: O(1) | ||
public struct TableComparison<Entity: EntityType>: Comparison { | ||
|
||
public typealias Input = Storage | ||
|
||
public func callAsFunction(_ lhs: Storage, _ rhs: Storage) -> Bool { | ||
// lhs._backingStorage.entityBackingStorage.table(Entity.self).updatedMarker == rhs._backingStorage.entityBackingStorage.table(Entity.self).updatedMarker | ||
fatalError() | ||
} | ||
|
||
} | ||
|
||
/// Returns true if the updates result does not contain the entity. | ||
public struct UpdateComparison<Entity: EntityType>: Comparison { | ||
|
||
public typealias Input = Storage | ||
|
||
|
||
public let entityID: Entity.EntityID | ||
|
||
public init(entityID: Entity.EntityID) { | ||
self.entityID = entityID | ||
} | ||
|
||
public func callAsFunction(_ lhs: Storage, _ rhs: Storage) -> Bool { | ||
|
||
fatalError() | ||
|
||
// guard let result = rhs._backingStorage.lastUpdatesResult else { | ||
// return false | ||
// } | ||
// guard !result.wasUpdated(entityID) else { | ||
// return false | ||
// } | ||
// guard !result.wasDeleted(entityID) else { | ||
// return false | ||
// } | ||
// return true | ||
|
||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters