Package ch.rswk.meta.engine
Class MetaService
java.lang.Object
com.google.common.util.concurrent.AbstractIdleService
ch.rswk.meta.engine.AbstractEngineIdleService<MetaService.MetaServiceConfig>
ch.rswk.meta.engine.MetaService
- All Implemented Interfaces:
EngineServices.ConfigurableService<MetaService.MetaServiceConfig>,EngineServices.InfoProvidingService,com.google.common.util.concurrent.Service
@Singleton
public class MetaService
extends AbstractEngineIdleService<MetaService.MetaServiceConfig>
MetaService provides CRUD functionality for all meta model entities. Uses a
LuceneService instance to store the meta
entities.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordstatic final recordprivate static final recordprivate static final recordNested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, MetaService.CachedMetaAction> private final BackupServiceprivate static final Protocol.ErrorReplyFactoryprivate static final org.slf4j.Loggerprivate final LuceneServiceprivate static final com.fasterxml.jackson.databind.ObjectReaderprivate static final Protocol.ErrorReplyFactoryprivate static final Protocol.ErrorReplyFactoryprivate static final Protocol.ErrorReplyFactoryprivate final MetaSchemaprivate static final Protocol.ErrorReplyFactoryprivate com.codahale.metrics.Meterprivate final Map<String, MetaService.CachedMetaType> private static final Protocol.ErrorReplyFactoryprivate static final Protocol.ErrorReplyFactoryprivate com.codahale.metrics.Meterprivate static final Protocol.ErrorReplyFactoryprivate com.codahale.metrics.Meterprivate final MetaValidatorprivate static final Protocol.ErrorReplyFactoryprivate static final Protocol.ErrorReplyFactoryprivate com.codahale.metrics.Meterprivate com.codahale.metrics.MeterFields inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
runtime -
Constructor Summary
ConstructorsConstructorDescriptionMetaService(BackupService backupService, MetaService.MetaServiceConfig config, LuceneService luceneService, Set<MetaAction> metaActions, Set<MetaType> metaTypes, EngineRuntime runtime, MetaSchema schema, MetaValidator validator) -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.util.concurrent.ListenableFuture<Void> deleteRecursive(@Nullable String channel, @Nullable AtomicInteger counter, @Nullable Consumer<Meta> handler, SearchRequest request, MetaService service) private LuceneService.SearchResultexecuteLuceneSearch(LuceneService.LuceneContext context, @Nullable Function<LuceneService.LuceneContext, MetaService.MetaServiceSearchContext> queryProducer, SearchRequest request) private MetaService.PartialUpdateforgePartialUpdate(MetaObject existing, MetaObject update) getCachedAction(String actionId) getCachedType(String typeId) private MetaService.CachedMetaActionnewCachedMetaAction(MetaAction action) private MetaService.CachedMetaTypenewCachedMetaType(MetaType type) private org.apache.lucene.document.DocumentnewMetaDocument(Meta meta) private SearchReplynewSearchReply(SearchRequest request, LuceneService.SearchResult result) protected com.google.common.util.concurrent.ListenableFuture<WriteObjectUpdateReply> processUpdate(@Nullable String logId, WriteObjectUpdateRequest request) protected com.google.common.util.concurrent.ListenableFuture<WriteReply> processWrite(@Nullable String logId, String newMetaId, boolean writeLog, WriteRequest request) com.google.common.util.concurrent.ListenableFuture<SearchReply> search(SearchRequest request) com.google.common.util.concurrent.ListenableFuture<SearchReply> search2(SearchRequest request, org.apache.lucene.search.Query query, @Nullable org.apache.lucene.search.Sort sort) private com.google.common.util.concurrent.ListenableFuture<SearchReply> searchInternal(@Nullable Function<LuceneService.LuceneContext, MetaService.MetaServiceSearchContext> queryProducer, SearchRequest request) static com.google.common.util.concurrent.ListenableFuture<Void> searchRecursive(Executor executor, Function<SearchReply, com.google.common.util.concurrent.ListenableFuture<?>> replyConsumer, SearchRequest request, Function<SearchRequest, com.google.common.util.concurrent.ListenableFuture<SearchReply>> service) protected voidshutDown()protected voidstartUp()private static MetaLogTypetoLogType(WriteAction action) private Optional<ErrorReplyException> validateMeta(Meta meta) com.google.common.util.concurrent.ListenableFuture<WriteReply> write(WriteRequest request) private voidwriteLog(WriteAction action, @Nullable String channel, @Nullable com.fasterxml.jackson.databind.node.ObjectNode data, @Nullable String logId, Meta meta, String metaId, org.apache.lucene.index.IndexWriter writer) private voidwriteMeta(WriteAction action, @Nullable String channel, @Nullable com.fasterxml.jackson.databind.node.ObjectNode data, @Nullable org.apache.lucene.document.Document document, @Nullable String logId, Meta meta, boolean writeLog, org.apache.lucene.index.IndexWriter writer) com.google.common.util.concurrent.ListenableFuture<WriteObjectUpdateReply> Methods inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
configClass, configReference, onConfigWatcherNotification, serviceId, serviceNameMethods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.rswk.meta.engine.EngineServices.ConfigurableService
config, handleConfigWatcherNotification, onConfigChangedMethods inherited from interface ch.rswk.meta.engine.EngineServices.InfoProvidingService
getServiceInfo
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
ILLEGAL_TYPE_ERROR
-
META_READER
private static final com.fasterxml.jackson.databind.ObjectReader META_READER -
NO_META_ERROR
-
NO_OBJECT_FOR_UPDATE_ERROR
-
NO_QUERY_ERROR
-
SEARCH_ERROR
-
UPDATE_ERROR
-
UPDATE_WITHOUT_ID_ERROR
-
VALIDATION_ERROR
-
WRITE_ERROR
-
WRITE_LOG_ERROR
-
actionCache
-
backupService
-
luceneService
-
schema
-
typeCache
-
validator
-
searchMeter
private com.codahale.metrics.Meter searchMeter -
updateMeter
private com.codahale.metrics.Meter updateMeter -
validationErrorMeter
private com.codahale.metrics.Meter validationErrorMeter -
writeErrorMeter
private com.codahale.metrics.Meter writeErrorMeter -
writeMeter
private com.codahale.metrics.Meter writeMeter
-
-
Constructor Details
-
MetaService
@Inject public MetaService(BackupService backupService, MetaService.MetaServiceConfig config, @Named("Meta") LuceneService luceneService, Set<MetaAction> metaActions, Set<MetaType> metaTypes, EngineRuntime runtime, MetaSchema schema, MetaValidator validator)
-
-
Method Details
-
validateMeta
-
getCachedType
-
newCachedMetaAction
-
newCachedMetaType
-
deleteRecursive
public static com.google.common.util.concurrent.ListenableFuture<Void> deleteRecursive(@Nullable String channel, @Nullable AtomicInteger counter, @Nullable Consumer<Meta> handler, SearchRequest request, MetaService service) -
getCachedAction
-
processWrite
protected com.google.common.util.concurrent.ListenableFuture<WriteReply> processWrite(@Nullable String logId, String newMetaId, boolean writeLog, WriteRequest request) -
search
public com.google.common.util.concurrent.ListenableFuture<SearchReply> search(SearchRequest request) -
search2
public com.google.common.util.concurrent.ListenableFuture<SearchReply> search2(SearchRequest request, org.apache.lucene.search.Query query, @Nullable org.apache.lucene.search.Sort sort) -
searchInternal
private com.google.common.util.concurrent.ListenableFuture<SearchReply> searchInternal(@Nullable Function<LuceneService.LuceneContext, MetaService.MetaServiceSearchContext> queryProducer, SearchRequest request) -
executeLuceneSearch
private LuceneService.SearchResult executeLuceneSearch(LuceneService.LuceneContext context, @Nullable Function<LuceneService.LuceneContext, MetaService.MetaServiceSearchContext> queryProducer, SearchRequest request) throws IOException, org.apache.lucene.queryparser.flexible.core.QueryNodeException- Throws:
IOExceptionorg.apache.lucene.queryparser.flexible.core.QueryNodeException
-
newSearchReply
-
searchRecursive
public static com.google.common.util.concurrent.ListenableFuture<Void> searchRecursive(Executor executor, Function<SearchReply, com.google.common.util.concurrent.ListenableFuture<?>> replyConsumer, SearchRequest request, Function<SearchRequest, com.google.common.util.concurrent.ListenableFuture<SearchReply>> service) -
startUp
- Overrides:
startUpin classAbstractEngineIdleService<MetaService.MetaServiceConfig>- Throws:
Exception
-
shutDown
- Overrides:
shutDownin classAbstractEngineIdleService<MetaService.MetaServiceConfig>- Throws:
Exception
-
write
-
writeObjectUpdate
public com.google.common.util.concurrent.ListenableFuture<WriteObjectUpdateReply> writeObjectUpdate(WriteObjectUpdateRequest request) -
processUpdate
protected com.google.common.util.concurrent.ListenableFuture<WriteObjectUpdateReply> processUpdate(@Nullable String logId, WriteObjectUpdateRequest request) -
forgePartialUpdate
-
newMetaDocument
-
writeMeta
private void writeMeta(WriteAction action, @Nullable String channel, @Nullable com.fasterxml.jackson.databind.node.ObjectNode data, @Nullable org.apache.lucene.document.Document document, @Nullable String logId, Meta meta, boolean writeLog, org.apache.lucene.index.IndexWriter writer) -
writeLog
private void writeLog(WriteAction action, @Nullable String channel, @Nullable com.fasterxml.jackson.databind.node.ObjectNode data, @Nullable String logId, Meta meta, String metaId, org.apache.lucene.index.IndexWriter writer) -
toLogType
-