Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Implements SyncMap<K, V> following the existing SyncSet and SyncValue patterns to enable automatic synchronization of map data structures across all connected servers.

API Layer

  • SyncMap<K, V> interface extending fastutil's Object2ObjectMap
  • Factory methods supporting both StreamCodec and Kotlinx Serialization
  • Listener API: SyncMapListener<K, V> = (key: K, oldValue: V?, newValue: V?) -> Unit

Core Implementation

  • SyncMapImpl<K, V> with ConcurrentHashMap backing and atomic change counters
  • SyncMapDeltaPacket for incremental put/remove operations (bidirectional)
  • ClientboundBatchSyncMapPacket for initial full synchronization
  • Change ID tracking prevents out-of-order updates

Integration

  • Server broadcasts map changes to all clients (excluding sender)
  • Client applies remote changes and sends local changes to server
  • Registered in RunningProtocols and SynchronizingProtocols
  • Wired into batch sync tasks for initial connection handshake

Usage

val playerScores = SyncMap<String, Int>("player_scores")

playerScores.subscribe { key, oldValue, newValue ->
    log.info("Score changed: $key $oldValue -> $newValue")
}

playerScores["player1"] = 100  // Automatically syncs to all servers
val score = playerScores["player1"]
playerScores.remove("player1")  // Automatically syncs removal

Files: 18 changed, 712 insertions

  • 5 new files (SyncMap.kt, SyncMapImpl.kt, 2 packets, test)
  • 13 modified (registries, protocols, packet listeners on server/client)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • repo.slne.dev
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4G -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.3-bin/cv11ve7ro1n3o1j4so8xd9n66/gradle-8.14.3/lib/gradle-daemon-main-8.14.3.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>SyncMap</issue_title>
<issue_description>Eine Sync Map, wie es auch SyncSets und SyncValues gibt.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 21, 2025 19:51
Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
…ocols

Co-authored-by: twisti-dev <76837088+twisti-dev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sync map functionality similar to sync sets and sync values Add SyncMap for bidirectional map synchronization across cloud network Nov 21, 2025
Copilot AI requested a review from twisti-dev November 21, 2025 19:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

SyncMap

2 participants