Skip to content

Clarify clearTimeserial must be reset when LiveMap is reset#486

Open
lawrence-forooghian wants to merge 1 commit into
mainfrom
liveobjects-clarify-reset-clearTimeserial
Open

Clarify clearTimeserial must be reset when LiveMap is reset#486
lawrence-forooghian wants to merge 1 commit into
mainfrom
liveobjects-clarify-reset-clearTimeserial

Conversation

@lawrence-forooghian
Copy link
Copy Markdown
Collaborator

When resetting an existing LiveMap's data you are meant to also reset its clearTimeserial (as JS / Swift / Kotlin implementations all do). This was never very clear in the spec and 4cec279 made it even less clear. So, define an explicit "reset data for an existing LiveObject" procedure and defer to it.

When resetting an existing LiveMap's data you are meant to also reset
its clearTimeserial (as JS / Swift / Kotlin implementations all do).
This was never very clear in the spec and 4cec279 made it even less
clear. So, define an explicit "reset data for an existing LiveObject"
procedure and defer to it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- `(RTLC4)` A new empty `LiveCounter` can be created with the following values:
- `(RTLC4a)` `objectId` is passed into the constructor and set upon creation
- `(RTLC4b)` `data` is set to 0
- `(RTLC17)` The data of a `LiveCounter` can be reset to that of a new empty `LiveCounter` as follows:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think reset of a LiveCounter is a thing

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The spec already (i.e. pre-this-PR) resets a LiveCounter's data as part of the RTLO4e tombstone procedure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok, why? Unlike a map, there's no space saving if you reset a LiveCounter. Is it just for consistency then?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure to be honest — it's what ably-js does. Possible reasons would be consistency or a design decision that if a user has a reference to a deleted LiveCounter then when they call value() on it it should return 0, but I'm just speculating.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

2 participants