public static IRpcClientBuilder UseServer(this IRpcClientBuilder builder, string remoteAddress) { Preconditions.CheckArgument(!string.IsNullOrEmpty(remoteAddress), "服务器地址不能为空"); builder.UseSetting("DefaultServerAddress", remoteAddress); return(builder); }
private PeriodPattern(IPattern <Period> pattern) { this.pattern = Preconditions.CheckNotNull(pattern, nameof(pattern)); }
public RetryingServiceClient(IServiceClient underlying) { this.underlying = Preconditions.CheckNotNull(underlying, nameof(underlying)); }
public SchedulePayload setName(string name) { Preconditions.checkArgument(StringUtil.IsValidName(name), (object)"The name must be the right format."); this.name = name; return(this); }
public RetryingSinkFactory(ISinkFactory <T> underlying, RetryPolicy retryPolicy) { this.underlying = Preconditions.CheckNotNull(underlying, nameof(underlying)); this.retryPolicy = Preconditions.CheckNotNull(retryPolicy, nameof(retryPolicy)); }
public Task <Option <ServiceIdentity> > GetServiceIdentity(string deviceId, string moduleId) { Preconditions.CheckNonWhiteSpace(deviceId, nameof(deviceId)); Preconditions.CheckNonWhiteSpace(moduleId, nameof(moduleId)); return(this.GetServiceIdentity($"{deviceId}/{moduleId}")); }
public StoredServiceIdentity(string id) : this(Preconditions.CheckNotNull(id, nameof(id)), null, DateTime.UtcNow) { }
/// <inheritdoc/> public Task <string> GetCustomDataObjectRawAsync(string objectName, string?queryString = null, CancellationToken cancellationToken = default) { Preconditions.NotNullOrEmpty(objectName, nameof(objectName)); return(GetRawAsync(objectName, queryString, nameof(GetCustomDataObjectRawAsync), objectName, cancellationToken)); }
/// <inheritdoc/> public Task DeleteCustomDataObjectAsync(string objectName, CancellationToken cancellationToken = default) { Preconditions.NotNullOrEmpty(objectName, nameof(objectName)); return(DeleteAsync(objectName, null, cancellationToken)); }
public int ReadInt() { Preconditions.CheckState(state == XDR.State.Reading); return(buf.GetInt()); }
/// <inheritdoc/> public Task <CustomDataObject> GetCustomDataObjectAsync(string objectName, CancellationToken cancellationToken = default) { Preconditions.NotNullOrEmpty(objectName, nameof(objectName)); return(GetAsync <CustomDataObject>(objectName, null, nameof(GetCustomDataObjectAsync), objectName, cancellationToken)); }
/// <summary>Write an XDR message to a UDP ChannelBuffer</summary> public static ChannelBuffer WriteMessageUdp(XDR response) { Preconditions.CheckState(response.state == XDR.State.Reading); // TODO: Investigate whether making a copy of the buffer is necessary. return(ChannelBuffers.CopiedBuffer(response.buf)); }
public long ReadHyper() { Preconditions.CheckState(state == XDR.State.Reading); return(buf.GetLong()); }
public bool ReadBoolean() { Preconditions.CheckState(state == XDR.State.Reading); return(buf.GetInt() != 0); }
/// <summary> /// Initializes a new instance of <c>CompositeChannelCredentials</c> class. /// The resulting credentials object will be composite of all the credentials specified as parameters. /// </summary> /// <param name="channelCredentials">channelCredentials to compose</param> /// <param name="callCredentials">channelCredentials to compose</param> public CompositeChannelCredentials(ChannelCredentials channelCredentials, CallCredentials callCredentials) { this.channelCredentials = Preconditions.CheckNotNull(channelCredentials); this.callCredentials = Preconditions.CheckNotNull(callCredentials); Preconditions.CheckArgument(channelCredentials.IsComposable, "Supplied channel credentials do not allow composition."); }
/// <summary> /// Constructor only called from other parts of Noda Time - trusted to be the range [0, NanosecondsPerDay). /// </summary> internal LocalTime([Trusted] long nanoseconds) { Preconditions.DebugCheckArgumentRange(nameof(nanoseconds), nanoseconds, 0, NanosecondsPerDay - 1); this.nanoseconds = nanoseconds; }
/// <summary> /// Wraps instance of <c>CallCredentials</c> as <c>ChannelCredentials</c>. /// </summary> /// <param name="callCredentials">credentials to wrap</param> public WrappedCallCredentials(CallCredentials callCredentials) { this.callCredentials = Preconditions.CheckNotNull(callCredentials); }
/// <summary> /// Sets the <see cref="BitmapPool"/> params. /// </summary> public Builder SetBitmapPoolParams(PoolParams bitmapPoolParams) { _bitmapPoolParams = Preconditions.CheckNotNull(bitmapPoolParams); return(this); }
public StoredServiceIdentity(ServiceIdentity serviceIdentity) : this(Preconditions.CheckNotNull(serviceIdentity, nameof(serviceIdentity)).Id, serviceIdentity, DateTime.UtcNow) { }
/// <summary> /// Sets the <see cref="BitmapPool"/> stats tracker. /// </summary> public Builder SetBitmapPoolStatsTracker( PoolStatsTracker bitmapPoolStatsTracker) { _bitmapPoolStatsTracker = Preconditions.CheckNotNull(bitmapPoolStatsTracker); return(this); }
StoredServiceIdentity(string id, ServiceIdentity serviceIdentity, DateTime timestamp) { this.ServiceIdentity = Option.Maybe(serviceIdentity); this.Id = Preconditions.CheckNotNull(id); this.Timestamp = timestamp; }
/// <summary> /// Sets the <see cref="NativeMemoryChunkPool"/> params. /// </summary> public Builder SetNativeMemoryChunkPoolParams(PoolParams nativeMemoryChunkPoolParams) { _nativeMemoryChunkPoolParams = Preconditions.CheckNotNull(nativeMemoryChunkPoolParams); return(this); }
public WindowsFirewallOfflineController(string networkInterfaceName) { this.networkInterfaceName = Preconditions.CheckNonWhiteSpace(networkInterfaceName, nameof(networkInterfaceName)); }
/// <summary> /// Sets the small <see cref="GenericByteArrayPool"/> params. /// </summary> public Builder SetSmallByteArrayPoolParams(PoolParams commonByteArrayPoolParams) { _smallByteArrayPoolParams = Preconditions.CheckNotNull(commonByteArrayPoolParams); return(this); }
protected BaseMessageSource(string source) { this.Source = AppendSingleTrailingSlash(Preconditions.CheckNotNull(source)); }
public DockerRuntimeInfo(string type, DockerRuntimeConfig config) { Preconditions.CheckArgument(type?.Equals("docker") ?? false); this.Config = config ?? new DockerRuntimeConfig(string.Empty, string.Empty); }
public Exchange(string name) { Preconditions.CheckNotNull(name, "name"); Name = name; }
public void Validate() { Preconditions.NotNegative(Limit, nameof(Limit)); Preconditions.Exclusive(new[] { Before, After, Around }, new[] { nameof(Before), nameof(After), nameof(Around) }); }
/// <summary> /// Initializes a new instance of <c>CompositeCallCredentials</c> class. /// The resulting credentials object will be composite of all the credentials specified as parameters. /// </summary> /// <param name="credentials">credentials to compose</param> public CompositeCallCredentials(params CallCredentials[] credentials) { Preconditions.CheckArgument(credentials.Length >= 2, "Composite credentials object can only be created from 2 or more credentials."); this.credentials = new List <CallCredentials>(credentials); }
public HttpChunkedStreamReader(HttpBufferedStream stream) { this.stream = Preconditions.CheckNotNull(stream, nameof(stream)); }