예제 #1
0
        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");
        }
예제 #2
0
        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
                        }
                    });
                }
            }
        }