orbit.client.net.LocalNode.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of orbit-client Show documentation
Show all versions of orbit-client Show documentation
Orbit is a system to make building highly scalable realtime services easier.
/*
Copyright (C) 2015 - 2019 Electronic Arts Inc. All rights reserved.
This file is part of the Orbit Project .
See license in LICENSE.
*/
package orbit.client.net
import orbit.client.OrbitClientConfig
import orbit.shared.mesh.NodeCapabilities
import orbit.shared.mesh.NodeInfo
import orbit.util.concurrent.atomicSet
import java.util.concurrent.atomic.AtomicReference
internal class LocalNode(config: OrbitClientConfig) {
private val ref = AtomicReference(
NodeData(config.grpcEndpoint, config.namespace)
)
val status get() = ref.get()!!
fun manipulate(body: (NodeData) -> NodeData) = ref.atomicSet(body)!!
}
internal data class NodeData(
val grpcEndpoint: String,
val namespace: String,
val nodeInfo: NodeInfo? = null,
val capabilities: NodeCapabilities? = null,
val clientState: ClientState = ClientState.IDLE
)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy