示例#1
0
 public Follower(ILogger logger,
                 IClientService clientService,
                 ResourceGroupStore store)
 {
     this.logger        = logger;
     this.clientService = clientService;
     this.store         = store;
 }
示例#2
0
 public Coordinator(IRebalancerLogger logger,
                    IResourceService resourceService,
                    IClientService clientService,
                    ResourceGroupStore store)
 {
     this.logger          = logger;
     this.resourceService = resourceService;
     this.clientService   = clientService;
     this.store           = store;
     resources            = new List <string>();
     clients = new List <Guid>();
 }
        public SqlServerProvider(string connectionString,
                                 ILogger logger                   = null,
                                 ILeaseService leaseService       = null,
                                 IResourceService resourceService = null,
                                 IClientService clientService     = null)
        {
            this.connectionString = connectionString;
            this.store            = new ResourceGroupStore();

            if (logger == null)
            {
                this.logger = new NullLogger();
            }
            else
            {
                this.logger = logger;
            }

            if (leaseService == null)
            {
                this.leaseService = new LeaseService(this.connectionString, this.logger);
            }
            else
            {
                this.leaseService = leaseService;
            }

            if (resourceService == null)
            {
                this.resourceService = new ResourceService(this.connectionString);
            }
            else
            {
                this.resourceService = resourceService;
            }

            if (clientService == null)
            {
                this.clientService = new ClientService(this.connectionString);
            }
            else
            {
                this.clientService = clientService;
            }

            this.clientId    = Guid.NewGuid();
            this.coordinator = new Coordinator(this.logger, this.resourceService, this.clientService, this.store);
            this.follower    = new Follower(this.logger, this.clientService, this.store);
        }