public abstract class AbstractEvalOpProcessor extends Object implements OpProcessor
OpProcessor
implementation that helps with operations that deal
with script evaluation functions.Constructor and Description |
---|
AbstractEvalOpProcessor() |
Modifier and Type | Method and Description |
---|---|
protected void |
evalOpInternal(Context context,
Supplier<GremlinExecutor> gremlinExecutorSupplier,
Supplier<Bindings> bindingsSupplier)
A generalized implementation of the "eval" operation.
|
abstract ThrowingConsumer<Context> |
getEvalOp()
Provides an operation for evaluating a Gremlin script.
|
protected void |
handleIterator(Context context,
Iterator itty)
|
ThrowingConsumer<Context> |
select(Context ctx)
Given the context (which contains the RequestMessage), return back a Consumer function that will be
executed with the context.
|
protected Optional<ThrowingConsumer<Context>> |
validateEvalMessage(RequestMessage message) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
public abstract ThrowingConsumer<Context> getEvalOp()
public ThrowingConsumer<Context> select(Context ctx) throws OpProcessorException
OpProcessor
select
in interface OpProcessor
OpProcessorException
protected Optional<ThrowingConsumer<Context>> validateEvalMessage(RequestMessage message) throws OpProcessorException
OpProcessorException
protected void evalOpInternal(Context context, Supplier<GremlinExecutor> gremlinExecutorSupplier, Supplier<Bindings> bindingsSupplier) throws OpProcessorException
ResponseMessage
objects down the Netty pipeline. It also handles script timeouts,
iteration timeouts, metrics and building bindings. Note that result iteration is delegated to the
handleIterator(org.apache.tinkerpop.gremlin.server.Context, java.util.Iterator)
method, so those extending this class could override that method for better control
over result iteration.context
- The current Gremlin Server Context
gremlinExecutorSupplier
- A function that returns the GremlinExecutor
to use in executing the
script evaluation.bindingsSupplier
- A function that returns the Bindings
to provide to the
GremlinExecutor.eval(java.lang.String)
method.OpProcessorException
protected void handleIterator(Context context, Iterator itty) throws TimeoutException
evalOpInternal(org.apache.tinkerpop.gremlin.server.Context, java.util.function.Supplier<org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor>, java.util.function.Supplier<javax.script.Bindings>)
when iterating a result set. Implementers should respect the
Settings.serializedResponseTimeout
configuration and break the serialization process if
it begins to take too long to do so, throwing a TimeoutException
in such
cases.context
- The Gremlin Server Context
object containing settings, request message, etc.itty
- The result to iteratorTimeoutException
- if the time taken to serialize the entire result set exceeds the allowable time.Copyright © 2013–2015 Apache Software Foundation. All rights reserved.