[EG-503] Spent state audit tool (#6107)

* [EG-503] Spent state audit tool

Fixes

* Refinements to notary query interfaces. Feature complete.

* EG-503: Introduce optional `notaryService` in `ServiceHubCoreInternal`

* Remove redundant logic following change to use extensions API

Co-authored-by: Viktor Kolomeyko <viktor.kolomeyko@r3.com>
This commit is contained in:
Ramzi El-Yafi
2020-04-16 16:05:21 +01:00
committed by GitHub
parent 27ea570fbb
commit 6a07284324
4 changed files with 40 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package net.corda.core.internal
import co.paralleluniverse.fibers.Suspendable
import net.corda.core.DeleteForDJVM
import net.corda.core.internal.notary.NotaryService
import net.corda.core.node.ServiceHub
import net.corda.core.node.StatesToRecord
import java.util.concurrent.ExecutorService
@ -14,6 +15,11 @@ interface ServiceHubCoreInternal : ServiceHub {
val attachmentTrustCalculator: AttachmentTrustCalculator
/**
* Optional `NotaryService` which will be `null` for all non-Notary nodes.
*/
val notaryService: NotaryService?
fun createTransactionsResolver(flow: ResolveTransactionsFlow): TransactionsResolver
}

View File

@ -14,6 +14,19 @@ abstract class NotaryService : SingletonSerializeAsToken() {
abstract val services: ServiceHub
abstract val notaryIdentityKey: PublicKey
/**
* Interfaces for the request and result formats of queries supported by notary services. To
* implement a new query, you must:
*
* - Define data classes which implement the [Query.Request] and [Query.Result] interfaces
* - Add corresponding handling for the new classes within the notary service implementations
* that you want to support the query.
*/
interface Query {
interface Request
interface Result
}
abstract fun start()
abstract fun stop()
@ -22,4 +35,18 @@ abstract class NotaryService : SingletonSerializeAsToken() {
* @param otherPartySession client [Party] making the request
*/
abstract fun createServiceFlow(otherPartySession: FlowSession): FlowLogic<Void?>
/**
* Processes a [Query.Request] and returns a [Query.Result].
*
* Note that this always throws an [UnsupportedOperationException] to handle notary
* implementations that do not support this functionality. This must be overridden by
* notary implementations wishing to support query functionality.
*
* Overrides of this function may themselves still throw an [UnsupportedOperationException],
* if they do not support specific query implementations
*/
open fun processQuery(query: Query.Request): Query.Result {
throw UnsupportedOperationException("Notary has not implemented query support")
}
}