@PublicSpi public abstract class PersistedQuerySupport extends java.lang.Object implements PreparsedDocumentProvider
PersistedQueryCache
implementation.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PERSISTED_QUERY_MARKER
In order for
ExecutionInput.getQuery() to never be null, use this to mark
them so that invariant can be satisfied while assuming that the persisted query id is elsewhere |
Constructor and Description |
---|
PersistedQuerySupport(PersistedQueryCache persistedQueryCache) |
Modifier and Type | Method and Description |
---|---|
PreparsedDocumentEntry |
getDocument(ExecutionInput executionInput,
java.util.function.Function<ExecutionInput,PreparsedDocumentEntry> parseAndValidateFunction)
This is called to get a "cached" pre-parsed query and if its not present, then the "parseAndValidateFunction"
can be called to parse and validate the query.
|
protected abstract java.util.Optional<java.lang.Object> |
getPersistedQueryId(ExecutionInput executionInput)
This method is required for concrete types to work out the query id (often a hash) that should be used to look
up the persisted query in the cache.
|
protected PreparsedDocumentEntry |
mkMissingError(PersistedQueryNotFound persistedQueryNotFound)
Allows you to customize the graphql error that is sent back on a missing persistend query
|
public static final java.lang.String PERSISTED_QUERY_MARKER
ExecutionInput.getQuery()
to never be null, use this to mark
them so that invariant can be satisfied while assuming that the persisted query id is elsewherepublic PersistedQuerySupport(PersistedQueryCache persistedQueryCache)
public PreparsedDocumentEntry getDocument(ExecutionInput executionInput, java.util.function.Function<ExecutionInput,PreparsedDocumentEntry> parseAndValidateFunction)
PreparsedDocumentProvider
Note - the "parseAndValidateFunction" MUST be called if you dont have a per parsed version of the query because it not only parses
and validates the query, it invokes Instrumentation
calls as well for parsing and validation.
if you dont make a call back on this then these wont happen.
getDocument
in interface PreparsedDocumentProvider
executionInput
- The ExecutionInput
containing the queryparseAndValidateFunction
- If the query has not be pre-parsed, this function MUST be called to parse and validate itPreparsedDocumentEntry
protected abstract java.util.Optional<java.lang.Object> getPersistedQueryId(ExecutionInput executionInput)
executionInput
- the execution inputprotected PreparsedDocumentEntry mkMissingError(PersistedQueryNotFound persistedQueryNotFound)
persistedQueryNotFound
- the missing persistent query exception