Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages: Add new message fields to message spec #210

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

splindsay-92
Copy link
Contributor

@splindsay-92 splindsay-92 commented Oct 10, 2024

Updated Message class in the textile/features.textile file to support new message fields related to materialisation.

Additions to the Message class:

  • Added the action field to represent the type of the message, using the MessageAction enum. (
  • Introduced the serial field to store the serial number of the message.
  • Added refSerial and refType fields for messages that reference other messages.
  • Included updatedAt and updateSerial fields to track the update and deletion ordering.
  • Added the operation field, which is a object containing optional fields such as clientId, description, and metadata.

@splindsay-92 splindsay-92 changed the title materialization: Add new message fields to message spec Messages: Add new message fields to message spec Oct 10, 2024
textile/features.textile Outdated Show resolved Hide resolved
textile/features.textile Outdated Show resolved Hide resolved
@splindsay-92 splindsay-92 force-pushed the materialisation/support-new-message-fields branch from 32a69df to 151d71f Compare October 18, 2024 13:43
@splindsay-92 splindsay-92 force-pushed the materialisation/support-new-message-fields branch from 151d71f to ec04d4e Compare October 23, 2024 12:26
@splindsay-92 splindsay-92 force-pushed the materialisation/support-new-message-fields branch from ec04d4e to bf88949 Compare October 25, 2024 13:35
@splindsay-92 splindsay-92 force-pushed the materialisation/support-new-message-fields branch from bf88949 to cc0073d Compare October 25, 2024 17:22
textile/features.textile Outdated Show resolved Hide resolved
textile/features.textile Outdated Show resolved Hide resolved
textile/features.textile Outdated Show resolved Hide resolved
textile/features.textile Outdated Show resolved Hide resolved
textile/features.textile Outdated Show resolved Hide resolved
textile/features.textile Outdated Show resolved Hide resolved
** @(TM2M)@ @refType@ string - if the @refSerial@ is set, this must be set. If describes the type of the reference.
** @(TM2N)@ @updatedAt@ time in milliseconds since epoch. If a message received from Ably has the @action@ field set to "MESSAGE_UPDATE" then the @updatedAt@ field must be set to the time the message was updated.
** @(TM2O)@ @deletedAt@ time in milliseconds since epoch. If a message received from Ably has the @action@ field set to "MESSAGE_DELETE" then the @deleteAt@ field must be set to the time the message was deleted.
** @(TM2P)@ @operation@ operation is an JSON-encodable object that contains the following `optional` fields;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we'd need to make this a JsonObject. It's a well-defined optional substruct of the Message with three known fields, why shouldn't the library expose it accordingly? (In JS there might not be a difference (other than the typings), it could just be a plain object, but eg in java this would be much more usable as a MessageOperation class or whatever vs a JSONObject)

textile/features.textile Outdated Show resolved Hide resolved
@splindsay-92 splindsay-92 force-pushed the materialisation/support-new-message-fields branch from cc0073d to b25f641 Compare October 31, 2024 10:25
…documentation

- Added @action@ enum field in the message structure, which specifies the type of the message action. It includes a series of predefined actions (CREATE, UPDATE, DELETE, etc.).
- Added additional fields `serial`, `refSerial`, `refType`, `updatedAt`, `deletedAt`, and `operation` to the Message data type.
- Update the Message class to reflect the new members.
- Added section on REST and Realtime publish that now requires the message action field to be set on publish.
@splindsay-92 splindsay-92 force-pushed the materialisation/support-new-message-fields branch from b25f641 to edaf89c Compare October 31, 2024 10:39
…documentation

- Added @action@ enum field in the message structure, which specifies the type of the message action. It includes a series of predefined actions (CREATE, UPDATE, DELETE, etc.).
- Added additional fields `serial`, `refSerial`, `refType`, `updatedAt`, `updateSerial`, and `operation` to the Message data type.
- Update the Message class to reflect the new members.
Copy link
Member

@SimonWoolf SimonWoolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a couple small further changes, but pre-approving after you make those.

*** @(TM2N2)@ @description@ string
*** @(TM2N3)@ @metadata@ object - used to contain any arbitrary key value pairs of type string.
** @(TM2O)@ @updatedAt@ time in milliseconds since epoch at which an operation occurred. This field is always populated on messages received with an @action@ of @MESSAGE_UPDATE@ or @MESSAGE_DELETE@..
** @(TM2P)@ @updateSerial@ string - an opaque string that uniquely identifies the operation. This field is always populated on messages received with an @action@ of @MESSAGE_UPDATE@ or @MESSAGE_DELETE@.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the spec uses the convention that the letters in spec items other than the initial section name (eg the p in TM2p) is lowercase
  • you reference a TM5 from the IDL that lists the actions, where is it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants