public class MetricInstrumentedIndexProvider extends Object implements IndexProvider
| Modifier and Type | Field and Description |
|---|---|
static String |
M_CALLS |
static String |
M_EXCEPTIONS |
static String |
M_MIXED_COUNT_QUERY |
static String |
M_MUTATE |
static String |
M_QUERY |
static String |
M_RAW_QUERY |
static String |
M_RESTORE |
static String |
M_TIME |
static String |
M_TOTALS |
static List<String> |
OPERATION_NAMES |
REPLACEMENT_CHAR| Constructor and Description |
|---|
MetricInstrumentedIndexProvider(IndexProvider indexProvider,
String prefix) |
| Modifier and Type | Method and Description |
|---|---|
BaseTransactionConfigurable |
beginTransaction(BaseTransactionConfig config)
Returns a transaction handle for a new index transaction.
|
void |
clearStorage()
Clears the index and removes all entries in all stores.
|
void |
close()
Closes the index
|
boolean |
exists()
Checks whether the index exists.
|
IndexFeatures |
getFeatures()
The features of this index
|
String |
mapKey2Field(String key,
KeyInformation information)
Adjusts the name of the key so that it is a valid field name that can be used in the index.
|
void |
mutate(Map<String,Map<String,IndexMutation>> mutations,
KeyInformation.IndexRetriever information,
BaseTransaction tx)
Mutates the index (adds and removes fields or entire documents)
|
Stream<String> |
query(IndexQuery query,
KeyInformation.IndexRetriever information,
BaseTransaction tx)
Executes the given query against the index.
|
Stream<RawQuery.Result<String>> |
query(RawQuery query,
KeyInformation.IndexRetriever information,
BaseTransaction tx)
Executes the given raw query against the index
|
Long |
queryCount(IndexQuery query,
KeyInformation.IndexRetriever information,
BaseTransaction tx) |
void |
register(String store,
String key,
KeyInformation information,
BaseTransaction tx)
This method registers a new key for the specified index store with the given data type.
|
void |
restore(Map<String,Map<String,List<IndexEntry>>> documents,
KeyInformation.IndexRetriever information,
BaseTransaction tx)
Restores the index to the state of the primary data store as given in the
documents variable. |
boolean |
supports(KeyInformation information)
Whether the index supports indexing a key with the given information
|
boolean |
supports(KeyInformation information,
JanusGraphPredicate janusgraphPredicate)
Whether the index supports executing queries with the given predicate against a key with the given information
|
Long |
totals(RawQuery query,
KeyInformation.IndexRetriever information,
BaseTransaction tx)
Executes the given raw query against the index and returns the total hits.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckKeyValiditypublic static final String M_MUTATE
public static final String M_RESTORE
public static final String M_QUERY
public static final String M_MIXED_COUNT_QUERY
public static final String M_RAW_QUERY
public static final String M_TOTALS
public static final String M_CALLS
public static final String M_TIME
public static final String M_EXCEPTIONS
public MetricInstrumentedIndexProvider(IndexProvider indexProvider, String prefix)
public void register(String store, String key, KeyInformation information, BaseTransaction tx) throws BackendException
IndexProviderregister in interface IndexProviderstore - Index storekey - New key to registerinformation - Information on the key to registertx - enclosing transactionBackendExceptionpublic void mutate(Map<String,Map<String,IndexMutation>> mutations, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException
IndexProvidermutate in interface IndexProvidermutations - Updates to the index. First map contains all the mutations for each store. The inner map contains
all changes for each document in an IndexMutation.information - Information on the keys used in the mutation accessible through KeyInformation.IndexRetriever.tx - Enclosing transactionBackendExceptionIndexMutationpublic void restore(Map<String,Map<String,List<IndexEntry>>> documents, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException
IndexProviderdocuments variable. When this method returns, the index records
for the given documents exactly matches the provided data. Unlike IndexProvider.mutate(java.util.Map, KeyInformation.IndexRetriever, BaseTransaction)
this method does not do a delta-update, but entirely replaces the documents with the provided data or deletes them if the document content is empty.restore in interface IndexProviderdocuments - The outer map maps stores to documents, the inner contains the documents mapping document ids to the document content which is a
list of IndexEntry. If that list is empty, that means this document should not exist and ought to be deleted.information - Information on the keys used in the mutation accessible through KeyInformation.IndexRetriever.tx - Enclosing transactionBackendExceptionpublic Long queryCount(IndexQuery query, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException
queryCount in interface IndexProviderBackendExceptionpublic Stream<String> query(IndexQuery query, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException
IndexProviderquery in interface IndexProviderquery - Query to executeinformation - Information on the keys used in the query accessible through KeyInformation.IndexRetriever.tx - Enclosing transactionBackendExceptionIndexQuerypublic Stream<RawQuery.Result<String>> query(RawQuery query, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException
IndexProviderquery in interface IndexProviderquery - Query to executeinformation - Information on the keys used in the query accessible through KeyInformation.IndexRetriever.tx - Enclosing transactionBackendExceptionRawQuerypublic Long totals(RawQuery query, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException
IndexProvidertotals in interface IndexProviderquery - Query to executeinformation - Information on the keys used in the query accessible through KeyInformation.IndexRetriever.tx - Enclosing transactionBackendExceptionRawQuerypublic BaseTransactionConfigurable beginTransaction(BaseTransactionConfig config) throws BackendException
IndexProviderbeginTransaction in interface IndexProviderBackendExceptionpublic void close()
throws BackendException
IndexProviderclose in interface IndexProviderBackendExceptionpublic void clearStorage()
throws BackendException
IndexProviderclearStorage in interface IndexProviderBackendExceptionpublic boolean exists()
throws BackendException
IndexProviderexists in interface IndexProviderBackendExceptionpublic boolean supports(KeyInformation information, JanusGraphPredicate janusgraphPredicate)
IndexInformationsupports in interface IndexInformationpublic boolean supports(KeyInformation information)
IndexInformationsupports in interface IndexInformationpublic String mapKey2Field(String key, KeyInformation information)
IndexInformationNote, that mapped field names (either configured on a per key basis or through a global configuration) are not adjusted and handed to the index verbatim.
mapKey2Field in interface IndexInformationpublic IndexFeatures getFeatures()
IndexInformationgetFeatures in interface IndexInformationCopyright © 2012–2023. All rights reserved.