예제 #1
0
 public static IRpcClientBuilder UseServer(this IRpcClientBuilder builder, string remoteAddress)
 {
     Preconditions.CheckArgument(!string.IsNullOrEmpty(remoteAddress), "服务器地址不能为空");
     builder.UseSetting("DefaultServerAddress", remoteAddress);
     return(builder);
 }
예제 #2
0
 private PeriodPattern(IPattern <Period> pattern)
 {
     this.pattern = Preconditions.CheckNotNull(pattern, nameof(pattern));
 }
예제 #3
0
 public RetryingServiceClient(IServiceClient underlying)
 {
     this.underlying = Preconditions.CheckNotNull(underlying, nameof(underlying));
 }
예제 #4
0
 public SchedulePayload setName(string name)
 {
     Preconditions.checkArgument(StringUtil.IsValidName(name), (object)"The name must be the right format.");
     this.name = name;
     return(this);
 }
예제 #5
0
 public RetryingSinkFactory(ISinkFactory <T> underlying, RetryPolicy retryPolicy)
 {
     this.underlying  = Preconditions.CheckNotNull(underlying, nameof(underlying));
     this.retryPolicy = Preconditions.CheckNotNull(retryPolicy, nameof(retryPolicy));
 }
예제 #6
0
 public Task <Option <ServiceIdentity> > GetServiceIdentity(string deviceId, string moduleId)
 {
     Preconditions.CheckNonWhiteSpace(deviceId, nameof(deviceId));
     Preconditions.CheckNonWhiteSpace(moduleId, nameof(moduleId));
     return(this.GetServiceIdentity($"{deviceId}/{moduleId}"));
 }
예제 #7
0
 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));
        }
예제 #10
0
 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));
        }
예제 #12
0
 /// <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));
 }
예제 #13
0
 public long ReadHyper()
 {
     Preconditions.CheckState(state == XDR.State.Reading);
     return(buf.GetLong());
 }
예제 #14
0
 public bool ReadBoolean()
 {
     Preconditions.CheckState(state == XDR.State.Reading);
     return(buf.GetInt() != 0);
 }
예제 #15
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.");
 }
예제 #16
0
 /// <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;
 }
예제 #17
0
 /// <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);
 }
예제 #18
0
 /// <summary>
 /// Sets the <see cref="BitmapPool"/> params.
 /// </summary>
 public Builder SetBitmapPoolParams(PoolParams bitmapPoolParams)
 {
     _bitmapPoolParams = Preconditions.CheckNotNull(bitmapPoolParams);
     return(this);
 }
예제 #19
0
 public StoredServiceIdentity(ServiceIdentity serviceIdentity)
     : this(Preconditions.CheckNotNull(serviceIdentity, nameof(serviceIdentity)).Id, serviceIdentity, DateTime.UtcNow)
 {
 }
예제 #20
0
 /// <summary>
 /// Sets the <see cref="BitmapPool"/> stats tracker.
 /// </summary>
 public Builder SetBitmapPoolStatsTracker(
     PoolStatsTracker bitmapPoolStatsTracker)
 {
     _bitmapPoolStatsTracker = Preconditions.CheckNotNull(bitmapPoolStatsTracker);
     return(this);
 }
예제 #21
0
 StoredServiceIdentity(string id, ServiceIdentity serviceIdentity, DateTime timestamp)
 {
     this.ServiceIdentity = Option.Maybe(serviceIdentity);
     this.Id        = Preconditions.CheckNotNull(id);
     this.Timestamp = timestamp;
 }
예제 #22
0
 /// <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));
 }
예제 #24
0
 /// <summary>
 /// Sets the small <see cref="GenericByteArrayPool"/> params.
 /// </summary>
 public Builder SetSmallByteArrayPoolParams(PoolParams commonByteArrayPoolParams)
 {
     _smallByteArrayPoolParams = Preconditions.CheckNotNull(commonByteArrayPoolParams);
     return(this);
 }
예제 #25
0
 protected BaseMessageSource(string source)
 {
     this.Source = AppendSingleTrailingSlash(Preconditions.CheckNotNull(source));
 }
예제 #26
0
 public DockerRuntimeInfo(string type, DockerRuntimeConfig config)
 {
     Preconditions.CheckArgument(type?.Equals("docker") ?? false);
     this.Config = config ?? new DockerRuntimeConfig(string.Empty, string.Empty);
 }
예제 #27
0
 public Exchange(string name)
 {
     Preconditions.CheckNotNull(name, "name");
     Name = name;
 }
예제 #28
0
 public void Validate()
 {
     Preconditions.NotNegative(Limit, nameof(Limit));
     Preconditions.Exclusive(new[] { Before, After, Around }, new[] { nameof(Before), nameof(After), nameof(Around) });
 }
예제 #29
0
 /// <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);
 }
예제 #30
0
 public HttpChunkedStreamReader(HttpBufferedStream stream)
 {
     this.stream = Preconditions.CheckNotNull(stream, nameof(stream));
 }