public async Task <OccupyInstanceResult> OccupyAsync(OccupyInstance command, CancellationToken cancellationToken) { _currentState = await _currentState.OccupyAsync(this, command, cancellationToken); await repository.SetInstanceStateAsync(_currentState.State, cancellationToken); var serviceName = await repository.GetServiceUriAsync(cancellationToken); return(new OccupyInstanceResult(serviceName)); }
public async Task ExecuteAsync(VacateInstance command, CancellationToken cancellationToken) { var serviceUri = await repository.GetServiceUriAsync(cancellationToken); await serviceInstance.VacateAsync(serviceUri); await repository.UnsetServiceInstanceName(cancellationToken); await deleteService.ExecuteAsync(new DeleteService(serviceUri), cancellationToken); }
public async Task <OccupyInstanceResult> ExecuteAsync(OccupyInstance command, CancellationToken cancellationToken) { Uri serviceUri = await repository.GetServiceUriAsync(cancellationToken); await instanceProxy.OccupyAsync(serviceUri, command.InstanceId, command.InstanceName); await Task.WhenAll( repository.SetServiceInstanceName(command.InstanceName, cancellationToken), repository.SetPartitionIdAsync(command.PartitionId, cancellationToken), repository.SetServiceLastActiveAsync(DateTime.UtcNow, cancellationToken) ); return(new OccupyInstanceResult(serviceUri)); }
public async Task ExecuteAsync(RemoveInstance command, CancellationToken cancellationToken) { var serviceUri = await repository.GetServiceUriAsync(cancellationToken); await serviceInstance.DeleteAsync(serviceUri, cancellationToken); }