Exemplo n.º 1
0
        // Returns existing or creates new
        public async Task <Result <MdFileStream> > CreateFile(FileSystemPath path)
        {
            if (!_path.IsParentOf(path))
            {
                return(new InvalidOperation <MdFileStream>("Incorrect path"));
            }
            if (!path.IsFile)
            {
                return(new InvalidOperation <MdFileStream>("Path is not a file"));
            }

            var fileResult = await FindFileAsync(path);

            if (fileResult.HasValue)
            {
                return(Result.OK(fileResult.Value));
            }

            await AddOrLoad(FILE_INFO_KEY);

            var md = await MdAccess.CreateAsync(0);

            var info    = SetupFileInfo(path, md);
            var value   = new StoredValue(info);
            var pointer = await _dataTreeCache[FILE_INFO_KEY].AddAsync(path.Path, value);

            if (!pointer.HasValue)
            {
                return(Result.Fail <MdFileStream>(pointer.ErrorCode.Value, pointer.ErrorMsg));
            }
            await _indexer.IndexAsync(path.Path, pointer.Value);

            //ScheduleIndexing(path, pointer.Value);
            return(Result.OK(new MdFileStream(info)));
        }
 public TransactionReceiptSearchIndexProcessorHandler(
     IIndexer <TransactionReceiptVO> eventIndexer,
     Func <TransactionReceiptVO, bool> criteria) :
     base((eventLog) => eventIndexer.IndexAsync(eventLog), criteria)
 {
     Indexer = eventIndexer;
 }
 public TransactionReceiptSearchIndexProcessorHandler(
     IIndexer <TransactionReceiptVO> indexer,
     Func <TransactionReceiptVO, Task <bool> > asyncCriteria) :
     base((eventLog) => indexer.IndexAsync(eventLog), asyncCriteria)
 {
     Indexer = indexer;
 }
Exemplo n.º 4
0
 public FilterLogSearchIndexProcessorHandler(
     IIndexer <FilterLog> eventIndexer,
     Func <FilterLog, bool> criteria) :
     base((eventLog) => eventIndexer.IndexAsync(eventLog), criteria)
 {
     EventIndexer = eventIndexer;
 }
 public EventLogSearchIndexProcessorHandler(
     IIndexer <EventLog <TEventDTO> > eventIndexer,
     Func <EventLog <TEventDTO>, bool> eventCriteria) :
     base((eventLog) => eventIndexer.IndexAsync(eventLog), eventCriteria)
 {
     EventIndexer = eventIndexer;
 }
 public FunctionMessageSearchIndexProcessorHandler(
     IIndexer <TransactionForFunctionVO <TFunctionMessage> > indexer,
     Func <TransactionForFunctionVO <TFunctionMessage>, bool> criteria) :
     base((functionCall) => indexer.IndexAsync(functionCall), criteria)
 {
     Indexer = indexer;
 }
Exemplo n.º 7
0
 public static ProcessorHandler <TSource> CreateProcessorHandler <TSource>(
     this IIndexer <TSource> indexer,
     Func <TSource, Task <bool> > criteria)
     where TSource : class, new()
 {
     return(new ProcessorHandler <TSource>((x) => indexer.IndexAsync(x), criteria));
 }
        /// <summary>
        /// Initializes the Azure Indexer.
        /// </summary>
        public void Initialize(CancellationToken cancellationToken)
        {
            this._logger.LogTrace("()");

            this._indexer.Initialize(cancellationToken).GetAwaiter().GetResult();

            this._asyncLoopFactory.Run($"Indexer",
                                       async token => await _indexer.IndexAsync(cancellationToken).ConfigureAwait(false),
                                       cancellationToken,
                                       TimeSpans.RunOnce,
                                       TimeSpans.FiveSeconds);

            this._logger.LogTrace("(-)");
        }
 public TransactionReceiptSearchIndexProcessorHandler(
     IIndexer <TransactionReceiptVO> indexer) :
     base((eventLog) => indexer.IndexAsync(eventLog))
 {
     Indexer = indexer;
 }
Exemplo n.º 10
0
 public FilterLogSearchIndexProcessorHandler(
     IIndexer <FilterLog> eventIndexer) :
     base((eventLog) => eventIndexer.IndexAsync(eventLog))
 {
     EventIndexer = eventIndexer;
 }
 public FunctionMessageSearchIndexProcessorHandler(
     IIndexer <TransactionForFunctionVO <TFunctionMessage> > indexer) :
     base((functionCall) => indexer.IndexAsync(functionCall))
 {
     Indexer = indexer;
 }
 public EventLogSearchIndexProcessorHandler(
     IIndexer <EventLog <TEventDTO> > eventIndexer) :
     base((eventLog) => eventIndexer.IndexAsync(eventLog))
 {
     EventIndexer = eventIndexer;
 }
Exemplo n.º 13
0
 public static ProcessorHandler <TSource> CreateProcessorHandler <TSource>(
     this IIndexer <TSource> indexer)
     where TSource : class, new()
 {
     return(new ProcessorHandler <TSource>((x) => indexer.IndexAsync(x)));
 }