Skip to content

refactor: History encoder#425

Merged
elementbound merged 22 commits intomainfrom
refactor/history-encoder
Mar 3, 2025
Merged

refactor: History encoder#425
elementbound merged 22 commits intomainfrom
refactor/history-encoder

Conversation

@elementbound
Copy link
Copy Markdown
Contributor

@elementbound elementbound commented Feb 27, 2025

Refs #358

@elementbound elementbound force-pushed the refactor/history-encoder branch from 8f7a7dc to 3ab740a Compare March 1, 2025 13:48
@elementbound elementbound marked this pull request as ready for review March 2, 2025 19:22
@elementbound elementbound requested a review from DustieDog March 2, 2025 19:22
Copy link
Copy Markdown
Collaborator

@DustieDog DustieDog left a comment

Choose a reason for hiding this comment

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

Vest wasn't reviewed, commented other files as needed.

extends RefCounted
class_name _DiffHistoryEncoder

var sanitize: bool = true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What're your thoughts on renaming to sanitized or is_sanitized? Same for passthrough-history-encoder and redundant-history-encoder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't use passive language, since sanitize is not something being done to the class, but something done by the class. Then again, I don't see a case where we wouldn't want to sanitize, let me get rid of that toggle.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Passthrough feels unclear to me here. What's your thoughts on FullHistoryEncoder to contrast DiffHisteryEncoder? Open to other suggestions as well.

return result

# Returns earliest new tick as int, or null
func apply(tick: int, snapshots: Array[_PropertySnapshot], sender: int = 0):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Having _RedundantHistoryEncoder.apply() have a different return signature to _PassthroughHistoryEncoder.apply() and _DiffHistoryEncoder.apply() feels inconsistent. Ideas?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same with the rest of their signatures - I've intentionally didn't bring them under a shared base class. An option is to have a separate get_earliest_updated() method or similar, though I wouldn't force consistency here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cool, where it's internal I'm fine leaving them mismatched for now.


# Returns earliest new tick as int, or null
func apply(tick: int, snapshots: Array[_PropertySnapshot], sender: int = 0):
var earliest_new_tick = null
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thoughts on using -1 as the default return value?

@elementbound elementbound merged commit ee2a985 into main Mar 3, 2025
1 check passed
@elementbound elementbound deleted the refactor/history-encoder branch March 3, 2025 21:31
elementbound added a commit that referenced this pull request Mar 5, 2025
elementbound added a commit that referenced this pull request Mar 5, 2025
Reverting until #358 has taken its final form. 

Closes #428 

This reverts commit ee2a985.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants