Add non-validating Raft notary

This commit is contained in:
Andrius Dagys 2017-03-31 11:08:57 +01:00
parent fcdcb0bdcf
commit 846d9caa09
3 changed files with 22 additions and 1 deletions

View File

@ -448,6 +448,7 @@ abstract class AbstractNode(open val configuration: NodeConfiguration,
return when (type) {
SimpleNotaryService.type -> SimpleNotaryService(services, timestampChecker, uniquenessProvider)
ValidatingNotaryService.type -> ValidatingNotaryService(services, timestampChecker, uniquenessProvider)
RaftNonValidatingNotaryService.type -> RaftNonValidatingNotaryService(services, timestampChecker, uniquenessProvider as RaftUniquenessProvider)
RaftValidatingNotaryService.type -> RaftValidatingNotaryService(services, timestampChecker, uniquenessProvider as RaftUniquenessProvider)
BFTNonValidatingNotaryService.type -> with(configuration as FullNodeConfiguration) {
val nodeId = notaryNodeId ?: throw IllegalArgumentException("notaryNodeId value must be specified in the configuration")

View File

@ -25,6 +25,7 @@ import net.corda.node.services.messaging.NodeMessagingClient
import net.corda.node.services.transactions.PersistentUniquenessProvider
import net.corda.node.services.transactions.RaftUniquenessProvider
import net.corda.node.services.transactions.RaftValidatingNotaryService
import net.corda.node.services.transactions.RaftNonValidatingNotaryService
import net.corda.node.utilities.AddressUtils
import net.corda.node.utilities.AffinityExecutor
import net.corda.nodeapi.ArtemisMessagingComponent.NetworkMapAddress
@ -194,7 +195,7 @@ class Node(override val configuration: FullNodeConfiguration,
override fun makeUniquenessProvider(type: ServiceType): UniquenessProvider {
return when (type) {
RaftValidatingNotaryService.type -> with(configuration) {
RaftValidatingNotaryService.type, RaftNonValidatingNotaryService.type -> with(configuration) {
RaftUniquenessProvider(baseDirectory, notaryNodeAddress!!, notaryClusterAddresses, database, configuration)
}
else -> PersistentUniquenessProvider()

View File

@ -0,0 +1,19 @@
package net.corda.node.services.transactions
import net.corda.core.crypto.Party
import net.corda.core.node.services.TimestampChecker
import net.corda.flows.NonValidatingNotaryFlow
import net.corda.node.services.api.ServiceHubInternal
/** A non-validating notary service operated by a group of mutually trusting parties, uses the Raft algorithm to achieve consensus. */
class RaftNonValidatingNotaryService(services: ServiceHubInternal,
val timestampChecker: TimestampChecker,
val uniquenessProvider: RaftUniquenessProvider) : NotaryService(services) {
companion object {
val type = SimpleNotaryService.type.getSubType("raft")
}
override fun createFlow(otherParty: Party): NonValidatingNotaryFlow {
return NonValidatingNotaryFlow(otherParty, timestampChecker, uniquenessProvider)
}
}