com.r3corda.node.services.persistence / DataVendingService

# DataVendingService

`class DataVendingService : AbstractNodeService`

This class sets up network message handlers for requests from peers for data keyed by hash. It is a piece of simple glue that sits between the network layer and the database layer.

Note that in our data model, to be able to name a thing by hash automatically gives the power to request it. There are no access control lists. If you want to keep some data private, then you must be careful who you give its name to, and trust that they will not pass the name onwards. If someone suspects some data might exist but does not have its name, then the 256-bit search space theyd have to cover makes it physically impossible to enumerate, and as such the hash of a piece of data can be seen as a type of password allowing access to it.

Additionally, because nodes do not store invalid transactions, requesting such a transaction will always yield null.

### Types

NotifyTxRequestMessage | `data class NotifyTxRequestMessage : PartyRequestMessage`
NotifyTxResponseMessage | `data class NotifyTxResponseMessage`

### Constructors

<init> | `DataVendingService(net: MessagingService, services: ServiceHubInternal)` This class sets up network message handlers for requests from peers for data keyed by hash. It is a piece of simple glue that sits between the network layer and the database layer.

### Properties

storage | `val storage: StorageService`

### Inherited Properties

net | `val net: MessagingService`
networkMapCache | `val networkMapCache: NetworkMapCache`

### Inherited Functions

addMessageHandler | `fun <Q : ServiceRequestMessage, R : Any> addMessageHandler(topic: String, handler: (Q) -> R, exceptionConsumer: (Message, Exception) -> Unit): Unit` Register a handler for a message topic. In comparison to using net.addMessageHandler() this manages a lot of common boilerplate code. Exceptions are caught and passed to the provided consumer. If you just want a simple acknowledgement response with no content, use com.r3corda.core.messaging.Ack. `fun <Q : ServiceRequestMessage, R : Any> addMessageHandler(topic: String, handler: (Q) -> R): Unit` Register a handler for a message topic. In comparison to using net.addMessageHandler() this manages a lot of common boilerplate code. Exceptions are propagated to the messaging layer. If you just want a simple acknowledgement response with no content, use com.r3corda.core.messaging.Ack.

### Companion Object Properties

NOTIFY_TX_PROTOCOL_TOPIC | `val NOTIFY_TX_PROTOCOL_TOPIC: String` Topic for messages notifying a node of a new transaction
logger | `val logger: <ERROR CLASS>`