public static App Initialize(AppConfig config, Func<StartOptions, NancyOptions, IDisposable> hostFunc) { config.ThrowIfInvalid(); var poller = new LeaderInfoPoller(config.StorageAccount); var startOptions = new StartOptions(); startOptions.Urls.Add(config.InternalUri); startOptions.Urls.Add(config.PublicUri); var auth = LoadAuth.LoadFromStorageAccount(config.StorageAccount); AddSystemAccess(auth, config.StorageAccount.GetSysPassword()); var api = ApiImplementation.Create(config.StorageAccount, poller, auth); var nancyOptions = new NancyOptions { Bootstrapper = new NancyBootstrapper(api, new UserValidator(auth)) }; var nodeInfo = new LeaderInfo(config.InternalUri); var selector = new LeaderLock(config.StorageAccount, nodeInfo, api); var cts = new CancellationTokenSource(); // fire up leader and scheduler first var tasks = new List<Task> { selector.KeepTryingToAcquireLock(cts.Token), poller.KeepPollingForLeaderInfo(cts.Token), }; // bind the API var host = hostFunc(startOptions, nancyOptions); return new App(host, cts, tasks); }
ApiImplementation(ICloudFactory client, LeaderInfoPoller poller) { _client = client; _poller = poller; }
public static ApiImplementation Create(ICloudFactory account, LeaderInfoPoller poller, AuthData auth) { return new ApiImplementation(account, poller); }
public static ApiImplementation Create(ICloudFactory account, LeaderInfoPoller poller, AuthData auth) { return(new ApiImplementation(account, poller)); }