mirror of
https://github.com/corda/corda.git
synced 2025-06-18 07:08:15 +00:00
[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:
@ -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
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user