Пример #1
0
        public async Task <IActionResult> List()
        {
            IndexListDto result = new IndexListDto();

            foreach (var meta in indicesMeta.Items)
            {
                var id  = new EventStoreIndexManagerId(meta.GetContractId(), context.Tenant);
                var dto = await _projectionExplorer.ExploreAsync(id, typeof(EventStoreIndexStatus));

                EventStoreIndexStatusState state = dto?.State as EventStoreIndexStatusState;
                var metaIndex = new IndexMeta()
                {
                    IndexContractId = meta.GetContractId(),
                    IndexName       = meta.Name,
                };
                if (ReferenceEquals(null, state))
                {
                    metaIndex.Status = IndexStatus.NotPresent;
                }
                else
                {
                    metaIndex.Status = state.Status;
                }
                result.Indices.Add(metaIndex);
            }

            return(new OkObjectResult(new ResponseResult <IndexListDto>(result)));
        }
 public void Bootstrap()
 {
     foreach (var index in indexTypeContainer.Items)
     {
         foreach (var tenant in tenants.Tenants)
         {
             var id      = new EventStoreIndexManagerId(index.GetContractId(), tenant);
             var command = new RegisterIndex(id);
             publisher.Publish(command);
         }
     }
 }
Пример #3
0
        private async Task <IndexStatus> GetIndexStatusAsync <TIndex>() where TIndex : IEventStoreIndex
        {
            var id     = new EventStoreIndexManagerId(typeof(TIndex).GetContractId(), context.Tenant);
            var result = await projectionReader.GetAsync <EventStoreIndexStatus>(id).ConfigureAwait(false);

            if (result.IsSuccess)
            {
                return(result.Data.State.Status);
            }

            return(IndexStatus.NotPresent);
        }
Пример #4
0
        IndexStatus GetIndexStatus <TIndex>() where TIndex : IEventStoreIndex
        {
            var id     = new EventStoreIndexManagerId(typeof(TIndex).GetContractId(), context.Tenant);
            var result = projectionReader.Get <EventStoreIndexStatus>(id);

            if (result.IsSuccess)
            {
                return(result.Data.State.Status);
            }

            return(IndexStatus.NotPresent);
        }
Пример #5
0
 public void Bootstrap()
 {
     if (cronusHostOptions.ApplicationServicesEnabled)
     {
         foreach (var index in indexTypeContainer.Items)
         {
             foreach (var tenant in tenants.Tenants)
             {
                 var id      = new EventStoreIndexManagerId(index.GetContractId(), tenant);
                 var command = new RegisterIndex(id);
                 publisher.Publish(command);
             }
         }
     }
 }