mirror of
https://github.com/corda/corda.git
synced 2025-06-18 15:18:16 +00:00
Merged in andrius-rename-bits (pull request #508)
This commit is contained in:
@ -37,7 +37,7 @@ abstract class AbstractNodeService(val services: ServiceHubInternal) : Singleton
|
||||
val response = handler(request)
|
||||
// If the return type R is Unit, then do not send a response
|
||||
if (response.javaClass != Unit.javaClass) {
|
||||
val msg = net.createMessage(topic, request.sessionID, response.serialize().bits)
|
||||
val msg = net.createMessage(topic, request.sessionID, response.serialize().bytes)
|
||||
net.send(msg, request.replyTo)
|
||||
}
|
||||
} catch(e: Exception) {
|
||||
|
@ -426,10 +426,10 @@ class NodeMessagingClient(override val config: NodeConfiguration,
|
||||
var dispatcher: RPCDispatcher? = null
|
||||
|
||||
private fun createRPCDispatcher(ops: RPCOps, userService: RPCUserService) = object : RPCDispatcher(ops, userService) {
|
||||
override fun send(bits: SerializedBytes<*>, toAddress: String) {
|
||||
override fun send(data: SerializedBytes<*>, toAddress: String) {
|
||||
state.locked {
|
||||
val msg = session!!.createMessage(false).apply {
|
||||
writeBodyBufferBytes(bits.bits)
|
||||
writeBodyBufferBytes(data.bytes)
|
||||
// Use the magic deduplication property built into Artemis as our message identity too
|
||||
putStringProperty(HDR_DUPLICATE_DETECTION_ID, SimpleString(UUID.randomUUID().toString()))
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ abstract class RPCDispatcher(val ops: RPCOps, val userService: RPCUserService) {
|
||||
send(responseBits, replyTo)
|
||||
}
|
||||
|
||||
abstract fun send(bits: SerializedBytes<*>, toAddress: String)
|
||||
abstract fun send(data: SerializedBytes<*>, toAddress: String)
|
||||
|
||||
fun start(rpcConsumer: ClientConsumer, rpcNotificationConsumer: ClientConsumer?, onExecutor: AffinityExecutor) {
|
||||
rpcNotificationConsumer?.setMessageHandler { msg ->
|
||||
|
@ -110,7 +110,7 @@ open class InMemoryNetworkMapCache : SingletonSerializeAsToken(), NetworkMapCach
|
||||
try {
|
||||
val req = message.data.deserialize<NetworkMapService.Update>()
|
||||
val ackMessage = net.createMessage(NetworkMapService.PUSH_ACK_PROTOCOL_TOPIC, DEFAULT_SESSION_ID,
|
||||
NetworkMapService.UpdateAcknowledge(req.mapVersion, net.myAddress).serialize().bits)
|
||||
NetworkMapService.UpdateAcknowledge(req.mapVersion, net.myAddress).serialize().bytes)
|
||||
net.send(ackMessage, req.replyTo)
|
||||
processUpdatePush(req)
|
||||
} catch(e: NodeMapError) {
|
||||
|
@ -199,7 +199,7 @@ abstract class AbstractNetworkMapService
|
||||
// TODO: Once we have a better established messaging system, we can probably send
|
||||
// to a MessageRecipientGroup that nodes join/leave, rather than the network map
|
||||
// service itself managing the group
|
||||
val update = NetworkMapService.Update(wireReg, mapVersion, net.myAddress).serialize().bits
|
||||
val update = NetworkMapService.Update(wireReg, mapVersion, net.myAddress).serialize().bytes
|
||||
val message = net.createMessage(NetworkMapService.PUSH_PROTOCOL_TOPIC, DEFAULT_SESSION_ID, update)
|
||||
|
||||
subscribers.locked {
|
||||
@ -333,7 +333,7 @@ class NodeRegistration(val node: NodeInfo, val serial: Long, val type: AddOrRemo
|
||||
*/
|
||||
fun toWire(privateKey: PrivateKey): WireNodeRegistration {
|
||||
val regSerialized = this.serialize()
|
||||
val regSig = privateKey.signWithECDSA(regSerialized.bits, node.legalIdentity.owningKey.singleKey)
|
||||
val regSig = privateKey.signWithECDSA(regSerialized.bytes, node.legalIdentity.owningKey.singleKey)
|
||||
|
||||
return WireNodeRegistration(regSerialized, regSig)
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ class RaftUniquenessProvider(storagePath: Path, myAddress: HostAndPort, clusterA
|
||||
*/
|
||||
private fun encode(items: List<Pair<StateRef, UniquenessProvider.ConsumingTx>>): Map<String, ByteArray> {
|
||||
fun StateRef.encoded() = "$txhash:$index"
|
||||
return items.map { it.first.encoded() to it.second.serialize().bits }.toMap()
|
||||
return items.map { it.first.encoded() to it.second.serialize().bytes }.toMap()
|
||||
}
|
||||
|
||||
private fun decode(items: Map<String, ByteArray>): Map<StateRef, UniquenessProvider.ConsumingTx> {
|
||||
|
@ -52,7 +52,7 @@ class JDBCHashMap<K : Any, V : Any>(tableName: String,
|
||||
fun bytesToBlob(value: SerializedBytes<*>, finalizables: MutableList<() -> Unit>): Blob {
|
||||
val blob = TransactionManager.current().connection.createBlob()
|
||||
finalizables += { blob.free() }
|
||||
blob.setBytes(1, value.bits)
|
||||
blob.setBytes(1, value.bytes)
|
||||
return blob
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ object JsonSupport {
|
||||
|
||||
object NodeInfoSerializer : JsonSerializer<NodeInfo>() {
|
||||
override fun serialize(value: NodeInfo, gen: JsonGenerator, serializers: SerializerProvider) {
|
||||
gen.writeString(Base58.encode(value.serialize().bits))
|
||||
gen.writeString(Base58.encode(value.serialize().bytes))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user