@@ -39,8 +39,10 @@ public protocol WorkspaceDictionary
3939var keys: [String ]
4040```
4141
42- Return all keys available in the dictionary. This is an expensive (for this dictionary)
43- method as it fetches from disk, from in-memory structures, and acquire locks if needed.
42+ Return all keys available in the dictionary. This is an expensive (for this dictionary)
43+ method as it fetches from disk, from in-memory structures, and acquire locks if needed.
44+
45+ - Returns: List of all keys available at the point of time in persisted dictionary .
4446
4547## Methods
4648### `synchronize()`
@@ -131,6 +133,12 @@ func performChanges(
131133
132134### `performChanges(_:changesHandler :)`
133135
136+ ```swift
137+ func performChanges(
138+ _ transactionalObjectTypes: [Any .Type ], changesHandler : @escaping ChangesHandler
139+ ) async -> Bool
140+ ```
141+
134142 Perform a transaction for given object types and await either success or failure boolean.
135143
136144 - Parameters:
@@ -142,10 +150,10 @@ func performChanges(
142150### `subscribe(fetchedResult:changeHandler :)`
143151
144152```swift
145- func subscribe<Element: Atom >(
153+ func subscribe<Element: Atom & Equatable >(
146154 fetchedResult: FetchedResult<Element > ,
147155 changeHandler : @escaping (_ : FetchedResult<Element > ) -> Void
148- ) -> Subscription where Element : Equatable
156+ ) -> Subscription
149157```
150158
151159 Subscribe to changes of a fetched result. You queries fetched result with
@@ -171,9 +179,9 @@ func subscribe<Element: Atom>(
171179### `subscribe(object:changeHandler :)`
172180
173181```swift
174- func subscribe<Element: Atom >(
182+ func subscribe<Element: Atom & Equatable >(
175183 object: Element , changeHandler : @escaping (_ : SubscribedObject<Element > ) -> Void
176- ) -> Subscription where Element : Equatable
184+ ) -> Subscription
177185```
178186
179187 Subscribe to changes of an object. If anything in the object changed or
@@ -201,29 +209,61 @@ func subscribe<Element: Atom>(
201209### `publisher(for:)`
202210
203211```swift
204- func publisher<Element: Atom >(for : Element ) -> AtomPublisher<Element > where Element : Equatable
212+ func publisher<Element: Atom & Equatable >(for : Element ) -> AtomPublisher<Element >
205213```
206214
207215Return a publisher for object subscription in Combine.
208216
209217### `publisher(for:)`
210218
211219```swift
212- func publisher<Element: Atom >(for : FetchedResult<Element > ) -> FetchedResultPublisher< Element >
213- where Element : Equatable
220+ func publisher<Element: Atom & Equatable >(for : FetchedResult<Element > )
221+ -> FetchedResultPublisher<Element>
214222```
215223
216224Return a publisher for fetched result subscription in Combine.
217225
218226### `publisher(for:)`
219227
220228```swift
221- func publisher<Element: Atom >(for : Element .Type ) -> QueryPublisherBuilder<Element >
222- where Element : Equatable
229+ func publisher<Element: Atom & Equatable >(for : Element .Type ) -> QueryPublisherBuilder<Element >
223230```
224231
225232Return a publisher builder for query subscription in Combine.
226233
234+ ### `subscribe(object:bufferingPolicy :)`
235+
236+ ```swift
237+ func subscribe<Element: Atom & Equatable >(
238+ object: Element , bufferingPolicy : AsyncStream<Element > .Continuation .BufferingPolicy
239+ ) -> AsyncStream<Element>
240+ ```
241+
242+ Subscribe to changes to the said object, and return the AsyncSequence you can iterate over.
243+
244+ - Parameters:
245+ - object : The object previously fetched that we want to observe the new updates .
246+ - bufferingPolicy: The buffering policy to avoid issuing all updates to concerned parties . Default will be the newest of 1.
247+
248+ - Returns: An AsyncSequence that can await for new object updates . Finishes only if the object deletes .
249+
250+ ### `subscribe(fetchedResult:bufferingPolicy :)`
251+
252+ ```swift
253+ func subscribe<Element: Atom & Equatable >(
254+ fetchedResult: FetchedResult<Element > ,
255+ bufferingPolicy : AsyncStream<FetchedResult<Element >> .Continuation .BufferingPolicy
256+ ) -> AsyncStream<FetchedResult<Element>>
257+ ```
258+
259+ Subscribe to changes to the said fetched result, and return the AsyncSequence you can iterate over.
260+
261+ - Parameters:
262+ - fetchedResult : The result fetched that we want to observe the new updates .
263+ - bufferingPolicy: The buffering policy to avoid issuing all updates to concerned parties . Default will be the newest of 1.
264+
265+ - Returns: An AsyncSequence that can await for new fetched result . It never finishes .
266+
227267
228268**EXTENSION**
229269
@@ -247,6 +287,19 @@ public func performChanges(
247287)
248288```
249289
290+ ### `subscribe(object:)`
291+
292+ ```swift
293+ public func subscribe<Element: Atom & Equatable >(object : Element ) -> AsyncStream<Element >
294+ ```
295+
296+ ### `subscribe(fetchedResult:)`
297+
298+ ```swift
299+ public func subscribe<Element: Atom & Equatable >(fetchedResult : FetchedResult<Element > )
300+ -> AsyncStream<FetchedResult<Element>>
301+ ```
302+
250303
251304**CLASS**
252305
@@ -359,7 +412,7 @@ The object is deleted. This denotes the end of a subscription.
359412# `QueryPublisherBuilder`
360413
361414```swift
362- open class QueryPublisherBuilder<Element: Atom > where Element : Equatable
415+ open class QueryPublisherBuilder<Element: Atom & Equatable >
363416```
364417
365418## Methods
0 commit comments