public InfluxTypedStorage(Uri endpoint, string database, string username, string password, IConcurrencyControl concurrency, IKeyConverter <TKey> keyConverter, ITypedKeyStorage <TKey, TMeasureType> typeStorage) { _client = new InfluxClient(endpoint, username, password); _database = database; _client.DefaultQueryOptions.Precision = TimestampPrecision.Nanosecond; _client.DefaultWriteOptions.Precision = TimestampPrecision.Nanosecond; _keyConverter = keyConverter; _cc = concurrency; _typeStorage = typeStorage; _defaultSelection = new[] { new StorageSelection <TKey, TEntry, IStorage <TKey, TEntry> >(this) }; }
public AggregationTsdbClient(IStorageSelector <TKey, TEntry> storageSelector, ITypedKeyStorage <TKey, TMeasureType> typedKeyStorage, ITsdbLogger logger) { _typedKeyStorage = typedKeyStorage; _storageSelector = storageSelector; _logger = logger; }
public static async Task <IEnumerable <ITypedKey <TKey, TMeasureType> > > GetTaggedKeysOrThrowAsync <TKey, TMeasureType>(this ITypedKeyStorage <TKey, TMeasureType> storage, IEnumerable <TKey> keys) where TMeasureType : IMeasureType { keys = keys.ToList(); // only iterate once var typedKeys = await storage.GetTaggedKeysAsync(keys).ConfigureAwait(false); var typedKeyDictionary = typedKeys.ToDictionary(x => x.Key); foreach (var key in keys) { ITypedKey <TKey, TMeasureType> typedKey; if (!typedKeyDictionary.TryGetValue(key, out typedKey)) { throw new TsdbException("Could not find one or more of the required keys as a typed key."); } } return(typedKeys); }
public static async Task <ITypedKey <TKey, TMeasureType> > GetTaggedKeyOrThrowAsync <TKey, TMeasureType>(this ITypedKeyStorage <TKey, TMeasureType> storage, TKey key) where TMeasureType : IMeasureType { var keys = new[] { key }; var typedKeys = await storage.GetTaggedKeysAsync(keys).ConfigureAwait(false); var typedKey = typedKeys.FirstOrDefault(); if (typedKey == null || !typedKey.Key.Equals(key)) { throw new TsdbException("Could not find one or more of the required keys as a typed key."); } return(typedKey); }
public static async Task <ITypedKey <TKey, TMeasureType> > GetTaggedKeyAsync <TKey, TMeasureType>(this ITypedKeyStorage <TKey, TMeasureType> storage, TKey key) where TMeasureType : IMeasureType { var keys = new[] { key }; var typedKeys = await storage.GetTaggedKeysAsync(keys).ConfigureAwait(false); return(typedKeys.FirstOrDefault()); }
public InfluxTypedStorage(Uri endpoint, string database, ITypedKeyStorage <TKey, TMeasureType> typeStorage) : this(endpoint, database, null, null, DefaultKeyConverter <TKey> .Current, typeStorage) { }
public InfluxTypedStorage(Uri endpoint, string database, string username, string password, ITypedKeyStorage <TKey, TMeasureType> typeStorage) : this(endpoint, database, username, password, DefaultKeyConverter <TKey> .Current, typeStorage) { }
public InfluxTypedStorage(Uri endpoint, string database, string username, string password, IKeyConverter <TKey> keyConverter, ITypedKeyStorage <TKey, TMeasureType> typeStorage) : this(endpoint, database, username, password, new ConcurrencyControl(DefaultReadParallelism, DefaultWriteParallelism), keyConverter, typeStorage) { }