Skip to content

Commit ec5e928

Browse files
Add placeholder for spec's #publish method
Based on [1] at cb11ba8. Implementation deferred to #47. [1] ably/specification#353
1 parent 8fef76f commit ec5e928

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

Sources/AblyLiveObjects/Internal/CoreSDK.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ internal import AblyPlugin
55
///
66
/// This provides us with a mockable interface to ably-cocoa, and it also allows internal components and their tests not to need to worry about some of the boring details of how we bridge Swift types to AblyPlugin's Objective-C API (i.e. boxing).
77
internal protocol CoreSDK: AnyObject, Sendable {
8-
func sendObject(objectMessages: [OutboundObjectMessage]) async throws(InternalError)
8+
/// Implements the internal `#publish` method of RTO15.
9+
func publish(objectMessages: [OutboundObjectMessage]) async throws(InternalError)
910

1011
/// Returns the current state of the Realtime channel that this wraps.
1112
var channelState: ARTRealtimeChannelState { get }
@@ -28,7 +29,8 @@ internal final class DefaultCoreSDK: CoreSDK {
2829

2930
// MARK: - CoreSDK conformance
3031

31-
internal func sendObject(objectMessages: [OutboundObjectMessage]) async throws(InternalError) {
32+
internal func publish(objectMessages: [OutboundObjectMessage]) async throws(InternalError) {
33+
// TODO: Implement the full spec of RTO15 (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/47)
3234
try await DefaultInternalPlugin.sendObject(
3335
objectMessages: objectMessages,
3436
channel: channel,

Sources/AblyLiveObjects/Internal/InternalDefaultRealtimeObjects.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPool
206206
// MARK: - Sending `OBJECT` ProtocolMessage
207207

208208
// This is currently exposed so that we can try calling it from the tests in the early days of the SDK to check that we can send an OBJECT ProtocolMessage. We'll probably make it private later on.
209-
internal func testsOnly_sendObject(objectMessages: [OutboundObjectMessage], coreSDK: CoreSDK) async throws(InternalError) {
210-
try await coreSDK.sendObject(objectMessages: objectMessages)
209+
internal func testsOnly_publish(objectMessages: [OutboundObjectMessage], coreSDK: CoreSDK) async throws(InternalError) {
210+
try await coreSDK.publish(objectMessages: objectMessages)
211211
}
212212

213213
// MARK: - Testing

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ internal final class PublicDefaultRealtimeObjects: RealtimeObjects {
7575
proxied.testsOnly_receivedObjectProtocolMessages
7676
}
7777

78-
internal func testsOnly_sendObject(objectMessages: [OutboundObjectMessage]) async throws(InternalError) {
79-
try await proxied.testsOnly_sendObject(objectMessages: objectMessages, coreSDK: coreSDK)
78+
internal func testsOnly_publish(objectMessages: [OutboundObjectMessage]) async throws(InternalError) {
79+
try await proxied.testsOnly_publish(objectMessages: objectMessages, coreSDK: coreSDK)
8080
}
8181

8282
internal var testsOnly_receivedObjectSyncProtocolMessages: AsyncStream<[InboundObjectMessage]> {

Tests/AblyLiveObjectsTests/AblyLiveObjectsTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct AblyLiveObjectsTests {
9090
// (This objectId comes from copying that which was given in an expected value in an error message from Realtime)
9191
let realtimeCreatedMapObjectID = "map:iC4Nq8EbTSEmw-_tDJdVV8HfiBvJGpZmO_WbGbh0_-4@\(currentAblyTimestamp)"
9292

93-
try await channel.testsOnly_nonTypeErasedObjects.testsOnly_sendObject(objectMessages: [
93+
try await channel.testsOnly_nonTypeErasedObjects.testsOnly_publish(objectMessages: [
9494
OutboundObjectMessage(
9595
operation: .init(
9696
action: .known(.mapCreate),
@@ -110,7 +110,7 @@ struct AblyLiveObjectsTests {
110110
// 7. Now, send an invalid OBJECT ProtocolMessage to check that ably-cocoa correctly reports on its NACK.
111111
let invalidObjectThrownError = try await #require(throws: ARTErrorInfo.self) {
112112
do throws(InternalError) {
113-
try await channel.testsOnly_nonTypeErasedObjects.testsOnly_sendObject(objectMessages: [
113+
try await channel.testsOnly_nonTypeErasedObjects.testsOnly_publish(objectMessages: [
114114
.init(),
115115
])
116116
} catch {

Tests/AblyLiveObjectsTests/Mocks/MockCoreSDK.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class MockCoreSDK: CoreSDK {
1111
_channelState = channelState
1212
}
1313

14-
func sendObject(objectMessages _: [AblyLiveObjects.OutboundObjectMessage]) async throws(AblyLiveObjects.InternalError) {
14+
func publish(objectMessages _: [AblyLiveObjects.OutboundObjectMessage]) async throws(AblyLiveObjects.InternalError) {
1515
protocolRequirementNotImplemented()
1616
}
1717

0 commit comments

Comments
 (0)