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 record
static final record
static final record
private static final record
private static final record
Nested 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 BackupService
private static final Protocol.ErrorReplyFactory
private static final org.slf4j.Logger
private final LuceneService
private static final com.fasterxml.jackson.databind.ObjectReader
private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private final MetaSchema
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private final Map
<String, MetaService.CachedMetaType> private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private final MetaValidator
private static final Protocol.ErrorReplyFactory
private static final Protocol.ErrorReplyFactory
private com.codahale.metrics.Meter
private com.codahale.metrics.Meter
Fields 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.SearchResult
executeLuceneSearch
(LuceneService.LuceneContext context, @Nullable Function<LuceneService.LuceneContext, MetaService.MetaServiceSearchContext> queryProducer, SearchRequest request) private MetaService.PartialUpdate
forgePartialUpdate
(MetaObject existing, MetaObject update) getCachedAction
(String actionId) getCachedType
(String typeId) private MetaService.CachedMetaAction
newCachedMetaAction
(MetaAction action) private MetaService.CachedMetaType
newCachedMetaType
(MetaType type) private org.apache.lucene.document.Document
newMetaDocument
(Meta meta) private SearchReply
newSearchReply
(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 void
shutDown()
protected void
startUp()
private static MetaLogType
toLogType
(WriteAction action) private Optional
<ErrorReplyException> validateMeta
(Meta meta) com.google.common.util.concurrent.ListenableFuture
<WriteReply> write
(WriteRequest request) 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) 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) com.google.common.util.concurrent.ListenableFuture
<WriteObjectUpdateReply> Methods inherited from class ch.rswk.meta.engine.AbstractEngineIdleService
configClass, configReference, onConfigWatcherNotification, serviceId, serviceName
Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.rswk.meta.engine.EngineServices.ConfigurableService
config, handleConfigWatcherNotification, onConfigChanged
Methods 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:
IOException
org.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:
startUp
in classAbstractEngineIdleService<MetaService.MetaServiceConfig>
- Throws:
Exception
-
shutDown
- Overrides:
shutDown
in 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
-