internal Task <Result <MachineMapping> > RegisterMachineAsync(OperationContext context, MachineLocation machineLocation) { Contract.Requires(machineLocation.IsValid, $"Specified machine location `{machineLocation}` can't be registered because it is invalid"); if (_configuration.DistributedContentConsumerOnly) { return(Task.FromResult(Result.Success(new MachineMapping(machineLocation, MachineId.Invalid)))); } return(_storage.RegisterMachineAsync(context, machineLocation)); }
public async Task <Result <MachineMapping> > RegisterMachineAsync(OperationContext context, MachineLocation machineLocation) { var pr = await _primary.RegisterMachineAsync(context, machineLocation); if (!pr.Succeeded) { return(pr); } var mapping = pr.Value !; var sr = await _secondary.ForceRegisterMachineAsync(context, mapping); if (!sr.Succeeded) { return(Result.FromError <MachineMapping>(sr)); } return(Result.Success(mapping)); }