-
Notifications
You must be signed in to change notification settings - Fork 42
[ECO-5426][LiveObjects] Implement object sync / operation #1137
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
db8d5d7
[ECO-5426][ECO-5439] Initialize live objects foundation with core int…
sacOO7 e5be483
[ECO-5426][ECO-5439] Implement object utilities and validation framework
sacOO7 f8fc694
[ECO-5426][ECO-5439] Establish plugin architecture and live objects core
sacOO7 968c91b
[ECO-5426][ECO-5439] Implement base live object with comprehensive te…
sacOO7 b8f3353
[ECO-5426][ECO-5439] Design object message structure with validation …
sacOO7 2f5d65c
[ECO-5426][ECO-5439] Establish comprehensive test infrastructure
sacOO7 34c45e2
[ECO-5426][ECO-5439] Implement thread-safe objects pool with lifecycl…
sacOO7 42f96ba
[ECO-5426][ECO-5439] Create objects manager for sync and operation pr…
sacOO7 36537cc
[ECO-5426][ECO-5439] Implement sync tracking system with state transi…
sacOO7 1059f78
[ECO-5426][ECO-5439] Design LiveMap entry system with test fixtures
sacOO7 05e3517
[ECO-5426][ECO-5439] Implement LiveMap core functionality and operations
sacOO7 7b97349
[ECO-5426][ECO-5439] Create LiveMap manager for advanced operation pr…
sacOO7 a664865
[ECO-5426][ECO-5439] Implement LiveCounter with atomic operations
sacOO7 2ba1e32
[ECO-5426][ECO-5439] Create LiveCounter manager for operation handling
sacOO7 cba94eb
[ECO-5426][ECO-5439] Complete DefaultLiveObjects integration with tes…
sacOO7 940059c
[ECO-5426][ECO-5439] Implement JSON serialization with Gson integration
sacOO7 aba0e2c
[ECO-5426][ECO-5439] Create MessagePack serialization system
sacOO7 56021a6
[ECO-5426][ECO-5439] Implement message serialization and size validation
sacOO7 b59ea60
[ECO-5426][ECO-5439] Integrate live objects with realtime channel system
sacOO7 34449c7
[ECO-5426][ECO-5439] Renamed LiveObjectTest to RealtimeObjectsTest
sacOO7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
live-objects/src/main/kotlin/io/ably/lib/objects/ObjectId.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| package io.ably.lib.objects | ||
|
|
||
| import io.ably.lib.objects.type.ObjectType | ||
|
|
||
| internal class ObjectId private constructor( | ||
| internal val type: ObjectType, | ||
| private val hash: String, | ||
| private val timestampMs: Long | ||
| ) { | ||
| /** | ||
| * Converts ObjectId to string representation. | ||
| */ | ||
| override fun toString(): String { | ||
| return "${type.value}:$hash@$timestampMs" | ||
| } | ||
|
|
||
| companion object { | ||
| /** | ||
| * Creates ObjectId instance from hashed object id string. | ||
| */ | ||
| fun fromString(objectId: String): ObjectId { | ||
| if (objectId.isEmpty()) { | ||
| throw objectError("Invalid object id: $objectId") | ||
| } | ||
|
|
||
| // Parse format: type:hash@msTimestamp | ||
| val parts = objectId.split(':') | ||
| if (parts.size != 2) { | ||
| throw objectError("Invalid object id: $objectId") | ||
| } | ||
|
|
||
| val (typeStr, rest) = parts | ||
|
|
||
| val type = when (typeStr) { | ||
| "map" -> ObjectType.Map | ||
| "counter" -> ObjectType.Counter | ||
| else -> throw objectError("Invalid object type in object id: $objectId") | ||
| } | ||
|
|
||
| val hashAndTimestamp = rest.split('@') | ||
| if (hashAndTimestamp.size != 2) { | ||
| throw objectError("Invalid object id: $objectId") | ||
| } | ||
|
|
||
| val hash = hashAndTimestamp[0] | ||
|
|
||
| if (hash.isEmpty()) { | ||
| throw objectError("Invalid object id: $objectId") | ||
| } | ||
|
|
||
| val msTimestampStr = hashAndTimestamp[1] | ||
|
|
||
| val msTimestamp = try { | ||
| msTimestampStr.toLong() | ||
| } catch (e: NumberFormatException) { | ||
| throw objectError("Invalid object id: $objectId", e) | ||
| } | ||
|
|
||
| return ObjectId(type, hash, msTimestamp) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.