Пример #1
0
        internal static InfluxDBClient Create(IInfluxDBHttpClient httpClient, string database, string retentionPolicy,
                                              Action <Exception> errorCallback,
                                              int initialBufferSize,
                                              int maxBufferSize,
                                              TimeSpan?forceFlushInterval)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }
            if (string.IsNullOrEmpty(database))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(database));
            }

            var cts      = new CancellationTokenSource();
            var instance = new InfluxDBClient(httpClient, database, retentionPolicy, errorCallback, initialBufferSize, maxBufferSize, cts, forceFlushInterval);

            return(instance);
        }
Пример #2
0
 /// <summary>
 /// Builds and starts the <see cref="IInfluxDBClient"/>.
 /// </summary>
 /// <returns>The client.</returns>
 public IInfluxDBClient Build()
 {
     return(InfluxDBClient.Create(_httpClient, _database, _retentionPolicy, _errorCallback, _initialBufferSize, _maxBufferSize, _forceFlushInterval));
 }