Interface Request<R extends Response>
- Type Parameters:
R- theResponsetype
- All Superinterfaces:
Composable
- All Known Implementing Classes:
Delete,DeletePrefix,Get,GetPrefix,Put,Transaction
There are 5 primitive requests: Get, GetPrefix, Put, Delete,
and DeletePrefix; and one complex request, Transaction.
Due to the hierarchical nature of Transactions, Requests are responsible for
handling their own Responses. In most cases the in-response handling is implemented
as a simple storage mechanism, to be hierarchically read out after the top-level response has
been fully handled. The one exception is Transaction, which delegates out its
sub-responses as applicable.
Requests are meant to be Composable. As such, requests can be built up very complex
from these simple building blocks. It takes care to build them up in a maintainable way. To help
provide insight around requests (complex, or not), the requests can be described via
describe(). While describe is primarily meant to aid in the development or
debugging process around requests, it might be reasonable to pass the described request to a
technical user for verification before execution.
Atomicity, as provided via the Transaction construct, is the responsibility of the
caller.
Requests are executed through a KVClient.
KVClient implementations are responsible for building their own implementation
specific requests, but are not expecting to extend the Request interfaces. The visitor
pattern, enabled through traverse(RequestVisitor), provides the logic necessary for
implementations to walk the request structure.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.kv.Composable
Composable.Empty -
Method Summary
Modifier and TypeMethodDescriptiondescribe()An unfiltered description of the Request.Equivalent toreturn Collections.singletonList(this);Should only be called afterhasResponse()is true.booleanvoidtraverse(@NotNull RequestVisitor visitor) Invokes the appropriately typedRequestVisitormethod that corresponds to the concrete type of thisRequest.Methods inherited from interface io.deephaven.kv.Composable
isEmpty, traverseAll
-
Method Details
-
getOperations
Equivalent toreturn Collections.singletonList(this);- Specified by:
getOperationsin interfaceComposable
-
describe
String describe()An unfiltered description of the Request. Meant to be used for debugging and development purposes. -
hasResponse
boolean hasResponse()- Returns:
- true iff the response has been set
-
getResponse
R getResponse()Should only be called afterhasResponse()is true.- Returns:
- the response
-
traverse
Invokes the appropriately typedRequestVisitormethod that corresponds to the concrete type of thisRequest.Thus, all implementations are essentially
visitor.visit((ConcreteType)this).- Parameters:
visitor- the visitor
-