Revert ObjectMonitor to previous implementation

This commit is contained in:
John Estropia
2019-10-16 19:20:11 +09:00
parent 64a0264354
commit 2818a778a4
9 changed files with 95 additions and 114 deletions

View File

@@ -88,10 +88,15 @@ public final class LiveObject<O: DynamicObject>: ObjectRepresentation, Hashable
}
return Self.init(objectID: self.id, context: context)
}
public func asReadOnly(in dataStack: DataStack) -> O? {
return dataStack.unsafeContext().fetchExisting(self.id)
}
public func asEditable(in transaction: BaseDataTransaction) -> O? {
return self.context.fetchExisting(self.id)
return transaction.unsafeContext().fetchExisting(self.id)
}
public func asSnapshot(in dataStack: DataStack) -> ObjectSnapshot<O>? {
@@ -113,11 +118,6 @@ public final class LiveObject<O: DynamicObject>: ObjectRepresentation, Hashable
}
return .init(objectID: self.id, context: context)
}
public func asObjectMonitor(in dataStack: DataStack) -> ObjectMonitor<O>? {
return .init(objectID: self.id, context: dataStack.unsafeContext())
}
// MARK: Equatable
@@ -354,12 +354,4 @@ extension LiveObject where O: CoreStoreObject {
return self.snapshot[dynamicMember: member]
}
/**
Returns the value for the property identified by a given key.
*/
public subscript<T>(dynamicMember member: KeyPath<O, T>) -> T {
return self.object[keyPath: member]
}
}