Skip to content

Commit 02d201c

Browse files
Merge pull request #71 from ably/ECO-5535-remove-batch-api
[ECO-5535] Remove declaration of batch API
2 parents b352c1a + 2b1677b commit 02d201c

File tree

3 files changed

+0
-85
lines changed

3 files changed

+0
-85
lines changed

Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPool
242242
try await createCounter(count: 0, coreSDK: coreSDK)
243243
}
244244

245-
internal func batch(callback _: sending BatchCallback) async throws {
246-
notYetImplemented()
247-
}
248-
249245
@discardableResult
250246
internal func on(event _: ObjectsEvent, callback _: ObjectsEventCallback) -> any OnObjectsEventResponse {
251247
notYetImplemented()

Sources/AblyLiveObjects/Public/Public Proxy Objects/PublicDefaultRealtimeObjects.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ internal final class PublicDefaultRealtimeObjects: RealtimeObjects {
8686
)
8787
}
8888

89-
internal func batch(callback: sending BatchCallback) async throws {
90-
try await proxied.batch(callback: callback)
91-
}
92-
9389
internal func on(event: ObjectsEvent, callback: @escaping ObjectsEventCallback) -> any OnObjectsEventResponse {
9490
proxied.on(event: event, callback: callback)
9591
}

Sources/AblyLiveObjects/Public/PublicTypes.swift

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ public typealias ObjectsEventCallback = @Sendable (_ subscription: OnObjectsEven
1616
/// - Parameter subscription: A ``OnLiveObjectLifecycleEventResponse`` object that allows the provided listener to deregister itself from future updates.
1717
public typealias LiveObjectLifecycleEventCallback = @Sendable (_ subscription: OnLiveObjectLifecycleEventResponse) -> Void
1818

19-
/// A function passed to ``RealtimeObjects/batch(callback:)`` to group multiple Objects operations into a single channel message.
20-
///
21-
/// - Parameter batchContext: A ``BatchContext`` object that allows grouping Objects operations for this batch.
22-
public typealias BatchCallback = (_ batchContext: sending BatchContext) -> Void
23-
2419
/// Describes the events emitted by an ``RealtimeObjects`` object.
2520
public enum ObjectsEvent: Sendable {
2621
/// The local copy of Objects on a channel is currently being synchronized with the Ably service.
@@ -56,18 +51,6 @@ public protocol RealtimeObjects: Sendable {
5651
/// Creates a new ``LiveCounter`` object instance with a value of zero.
5752
func createCounter() async throws(ARTErrorInfo) -> any LiveCounter
5853

59-
/// Allows you to group multiple operations together and send them to the Ably service in a single channel message.
60-
/// As a result, other clients will receive the changes as a single channel message after the batch function has completed.
61-
///
62-
/// This method accepts a synchronous callback, which is provided with a ``BatchContext`` object.
63-
/// Use the context object to access Objects on a channel and batch operations for them.
64-
///
65-
/// The objects' data is not modified inside the callback function. Instead, the objects will be updated
66-
/// when the batched operations are applied by the Ably service and echoed back to the client.
67-
///
68-
/// - Parameter callback: A batch callback function used to group operations together.
69-
func batch(callback: sending BatchCallback) async throws
70-
7154
/// Registers the provided listener for the specified event. If `on()` is called more than once with the same listener and event, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using `on()`, and an event is emitted once, the listener would be invoked twice.
7255
///
7356
/// - Parameters:
@@ -250,66 +233,6 @@ public protocol OnObjectsEventResponse: Sendable {
250233
func off()
251234
}
252235

253-
/// Enables grouping multiple Objects operations together by providing `BatchContext*` wrapper objects.
254-
public protocol BatchContext: Sendable {
255-
/// Mirrors the ``RealtimeObjects/getRoot()`` method and returns a ``BatchContextLiveMap`` wrapper for the root object on a channel.
256-
///
257-
/// - Returns: A ``BatchContextLiveMap`` object.
258-
func getRoot() -> BatchContextLiveMap
259-
}
260-
261-
/// A wrapper around the ``LiveMap`` object that enables batching operations inside a ``BatchCallback``.
262-
public protocol BatchContextLiveMap: AnyObject, Sendable {
263-
/// Mirrors the ``LiveMap/get(key:)`` method and returns the value associated with a key in the map.
264-
///
265-
/// - Parameter key: The key to retrieve the value for.
266-
/// - Returns: A ``LiveObject``, a primitive type (string, number, boolean, JSON-serializable object or array ,or binary data) or `nil` if the key doesn't exist in a map or the associated ``LiveObject`` has been deleted. Always `nil` if this map object is deleted.
267-
func get(key: String) -> LiveMapValue?
268-
269-
/// Returns the number of key-value pairs in the map.
270-
var size: Int { get }
271-
272-
/// Similar to the ``LiveMap/set(key:value:)`` method, but instead, it adds an operation to set a key in the map with the provided value to the current batch, to be sent in a single message to the Ably service.
273-
///
274-
/// This does not modify the underlying data of this object. Instead, the change is applied when
275-
/// the published operation is echoed back to the client and applied to the object.
276-
/// To get notified when object gets updated, use the ``LiveObject/subscribe(listener:)`` method.
277-
///
278-
/// - Parameters:
279-
/// - key: The key to set the value for.
280-
/// - value: The value to assign to the key.
281-
func set(key: String, value: LiveMapValue?)
282-
283-
/// Similar to the ``LiveMap/remove(key:)`` method, but instead, it adds an operation to remove a key from the map to the current batch, to be sent in a single message to the Ably service.
284-
///
285-
/// This does not modify the underlying data of this object. Instead, the change is applied when
286-
/// the published operation is echoed back to the client and applied to the object.
287-
/// To get notified when object gets updated, use the ``LiveObject/subscribe(listener:)`` method.
288-
///
289-
/// - Parameter key: The key to set the value for.
290-
func remove(key: String)
291-
}
292-
293-
/// A wrapper around the ``LiveCounter`` object that enables batching operations inside a ``BatchCallback``.
294-
public protocol BatchContextLiveCounter: AnyObject, Sendable {
295-
/// Returns the current value of the counter.
296-
var value: Double { get }
297-
298-
/// Similar to the ``LiveCounter/increment(amount:)`` method, but instead, it adds an operation to increment the counter value to the current batch, to be sent in a single message to the Ably service.
299-
///
300-
/// This does not modify the underlying data of this object. Instead, the change is applied when
301-
/// the published operation is echoed back to the client and applied to the object.
302-
/// To get notified when object gets updated, use the ``LiveObject/subscribe(listener:)`` method.
303-
///
304-
/// - Parameter amount: The amount by which to increase the counter value.
305-
func increment(amount: Double)
306-
307-
/// An alias for calling [`increment(-amount)`](doc:BatchContextLiveCounter/increment(amount:)).
308-
///
309-
/// - Parameter amount: The amount by which to decrease the counter value.
310-
func decrement(amount: Double)
311-
}
312-
313236
/// The `LiveMap` class represents a key-value map data structure, similar to a Swift `Dictionary`, where all changes are synchronized across clients in realtime.
314237
/// Conflicts in a LiveMap are automatically resolved with last-write-wins (LWW) semantics,
315238
/// meaning that if two clients update the same key in the map, the update with the most recent timestamp wins.

0 commit comments

Comments
 (0)