public FetchResult <bool> EditIndex(IndexConfig indexConfig) { if (IsDisposing) { return(ManagementIsDisposing <bool>()); } lock (syncLock) { indexConfig.TrimValues(); if (ValidToEdit(indexConfig, out var message, out var needDisposeAndRemovedWrapper) && needDisposeAndRemovedWrapper != null) { ConfigMaintainer.EditIndexConfig(indexConfig); needDisposeAndRemovedWrapper.Dispose(); MaintainerPool.TryUpdate(indexConfig.Pk, new IndexMaintainerWrapper(indexConfig, CodeIndexConfiguration, Log), needDisposeAndRemovedWrapper); Log.LogInformation($"Edit Index Config {indexConfig} Successful"); return(new FetchResult <bool> { Result = true, Status = new Status { Success = true } }); }
void InitializeMaintainerPool() { var allConfigs = ConfigMaintainer.GetConfigs(); Log.LogInformation("Initialize Maintainer Pool Start"); foreach (var config in allConfigs) { MaintainerPool.TryAdd(config.Pk, new IndexMaintainerWrapper(config, CodeIndexConfiguration, Log)); } Log.LogInformation("Initialize Maintainer Pool Finished"); }
public FetchResult <IndexConfigForView[]> GetIndexViewList() { if (IsDisposing) { return(ManagementIsDisposing <IndexConfigForView[]>()); } return(new FetchResult <IndexConfigForView[]> { Result = MaintainerPool.Where(u => validStatusForSearching.Contains(u.Value.Status)).Select(u => IndexConfigForView.GetIndexConfigForView(u.Value.IndexConfig)).ToArray(), Status = new Status { Success = true } }); }
public FetchResult <IndexStatusInfo[]> GetIndexList() { if (IsDisposing) { return(ManagementIsDisposing <IndexStatusInfo[]>()); } return(new FetchResult <IndexStatusInfo[]> { Result = MaintainerPool.Select(u => new IndexStatusInfo(u.Value.Status, u.Value.IndexConfig)).ToArray(), Status = new Status { Success = true } }); }
public IndexConfigForView GetIndexView(Guid pk) { if (IsDisposing) { return(new IndexConfigForView()); } IndexConfigForView indexConfigForView; if (MaintainerPool.TryGetValue(pk, out var wrapper)) { indexConfigForView = IndexConfigForView.GetIndexConfigForView(wrapper.IndexConfig); } else { indexConfigForView = new IndexConfigForView(); } return(indexConfigForView); }
public FetchResult <bool> AddIndex(IndexConfig indexConfig) { if (IsDisposing) { return(ManagementIsDisposing <bool>()); } lock (syncLock) { indexConfig.TrimValues(); if (ValidToAdd(indexConfig, out var message)) { ConfigMaintainer.AddIndexConfig(indexConfig); MaintainerPool.TryAdd(indexConfig.Pk, new IndexMaintainerWrapper(indexConfig, CodeIndexConfiguration, Log)); Log.LogInformation($"Add Index Config {indexConfig} Successful"); return(new FetchResult <bool> { Result = true, Status = new Status { Success = true } }); } else { return(new FetchResult <bool> { Result = false, Status = new Status { StatusDesc = message, Success = false } }); } } }