public UrlService( UrlContext context, IKeyConverter keyConverter, ILogger <UrlService> logger) { _context = context; _keyConverter = keyConverter; _logger = logger; }
/// <summary> /// Creates a new cached identity information structure /// </summary> /// <param name="baseUri">The base URI for the identifier</param> /// <param name="identityProperty">The property that will hold the entity key</param> /// <param name="keyProperties">The property or properties that together are used to construct the entity key</param> /// <param name="keySeparator">The string separator to insert between key values in a composite key</param> /// <param name="keyConverter">The converter responsible for converting key property values into a single composite key string</param> public IdentityInfo(string baseUri, PropertyInfo identityProperty, PropertyInfo[] keyProperties, string keySeparator, IKeyConverter keyConverter) { BaseUri = baseUri; IdentityProperty = identityProperty; KeyProperties = keyProperties; KeySeparator = keySeparator; KeyConverter = keyConverter; }
/// <summary> /// Creates a new cached identity information structure /// </summary> /// <param name="baseUri">The base URI for the identifier</param> /// <param name="identityProperty">The property that will hold the entity key</param> /// <param name="keyProperties">The property or properties that together are used to construct the entity key</param> /// <param name="keySeparator">The string separator to insert between key values in a composite key</param> /// <param name="keyConverter">The converter responsible for converting key property values into a single composite key string</param> public IdentityInfo(string baseUri, PropertyInfo identityProperty, PropertyInfo[] keyProperties, string keySeparator, IKeyConverter keyConverter) { BaseUri = baseUri; IdentityProperty = identityProperty; KeyProperties = keyProperties; KeySeparator = keySeparator; KeyConverter = keyConverter; }
public SqlDynamicStorage(string tableName, string connectionString, IConcurrencyControl concurrency, IKeyConverter <TKey> keyConverter) { SqlMapper.AddTypeMap(typeof(DateTime), DbType.DateTime2); _tableName = tableName; _connectionString = connectionString; _cc = concurrency; _keyConverter = keyConverter; _defaultSelection = new[] { new StorageSelection <TKey, TEntry, IDynamicStorage <TKey, TEntry> >(this) }; }
public TemporaryFileStorage(string directory, int maxFileSize, long maxStorageSize, IKeyConverter <TKey> keyConverter) { _directory = new DirectoryInfo(directory); _maxFileSize = maxFileSize; _maxStorageSize = maxStorageSize; _keyConverter = keyConverter; _sem = new SemaphoreSlim(1, 1); CalculateDirectorySize(); }
public S3ObjectStore(IAmazonS3 s3Client, S3ObjectStoreSettings settings, IKeyConverter <I> converter) { Guard.NotNull(s3Client, nameof(s3Client)); Guard.NotNull(settings, nameof(settings)); Guard.NotNull(converter, nameof(converter)); _s3Client = s3Client; _settings = settings; _converter = converter; }
public AssociationService( AssociationContext associationContext, IKeyRepository keysRepository, IKeyConverter keyConverter, ILogger <AssociationService> logger) { _logger = logger; _associationContext = associationContext; _keyRepository = keysRepository; _keyConverter = keyConverter; }
public AtsVolumeStorage(string tableName, string connectionString, IConcurrencyControl concurrency, IPartitionProvider <TKey> provider, IKeyConverter <TKey> keyConverter) { _cc = concurrency; _tableName = tableName; _account = CloudStorageAccount.Parse(connectionString); _client = _account.CreateCloudTableClient(); _partitioningProvider = provider; _keyConverter = keyConverter; _defaultSelection = new[] { new StorageSelection <TKey, TEntry, IStorage <TKey, TEntry> >(this) }; _client.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.JsonNoMetadata; }
public InfluxStorage(Uri endpoint, string database, string username, string password, IConcurrencyControl concurrency, IKeyConverter <TKey> keyConverter) { _client = new InfluxClient(endpoint, username, password); _database = database; _client.DefaultQueryOptions.Precision = TimestampPrecision.Nanosecond; _client.DefaultWriteOptions.Precision = TimestampPrecision.Nanosecond; _keyConverter = keyConverter; _cc = concurrency; _defaultSelection = new[] { new StorageSelection <TKey, TEntry, IStorage <TKey, TEntry> >(this) }; }
public RedisPublishSubscribe(string connectionString, string prefix, ITsdbLogger logger, IKeyConverter <TKey> keyConverter) : base(false) { _connection = new RedisConnection(connectionString, prefix, logger); _waitWhileDisconnected = new TaskCompletionSource <bool>(); _keyConverter = keyConverter; _logger = logger; ThreadPool.QueueUserWorkItem(_ => { var ignore = ConnectWithRetry(); }); }
public Task SubscribeAsync <TKey, TEntry>(string id, IKeyConverter <TKey> keyConverter, SubscriptionType subscribe, Action <Serie <TKey, TEntry> > onMessage) where TEntry : IRedisEntry, new() { if (_redisSubscriber == null) { throw new InvalidOperationException("The redis connection has not been started."); } var key = CreateSubscriptionKey(id, subscribe); return(_redisSubscriber.SubscribeAsync(key, async(channel, data) => { try { var entries = await RedisSerializer.Deserialize <TKey, TEntry>(data, keyConverter).ConfigureAwait(false); onMessage(entries); } catch (Exception e) { _logger.Error(e, "An error ocurred while deserializing subscription message."); } })); }
private static IdentityInfo GetIdentityInfo(AssemblyMappingInfo assemblyMappingInfo, Type entityType, PropertyInfo identityProperty, IdentifierAttribute identifierAttr) { string baseUri = identifierAttr == null || identifierAttr.BaseAddress == null ? Constants.GeneratedUriPrefix : assemblyMappingInfo.ResolveIdentifier(identifierAttr.BaseAddress); if (identifierAttr != null && identifierAttr.KeyProperties != null && identifierAttr.KeyProperties.Length > 0) { var keyProperties = new PropertyInfo[identifierAttr.KeyProperties.Length]; for (var i = 0; i < identifierAttr.KeyProperties.Length; i++) { var property = entityType.GetProperty(identifierAttr.KeyProperties[i]); if (property == null) { throw new ReflectionMappingException( String.Format("Could not find key property {0} on type {1}.", identifierAttr.KeyProperties[i], entityType.FullName)); } keyProperties[i] = property; } IKeyConverter keyConverter = null; if (identifierAttr.KeyConverterType != null) { keyConverter = Activator.CreateInstance(identifierAttr.KeyConverterType) as IKeyConverter; if (keyConverter == null) { throw new ReflectionMappingException( String.Format("Could not instantiate type {0} as a key converter for entity type {1}. Ensure that this type implements the IKeyConverter interface.", identifierAttr.KeyConverterType.FullName, entityType.FullName)); } } return(new IdentityInfo(baseUri, identityProperty, keyProperties, identifierAttr.KeySeparator ?? Constants.DefaultKeySeparator, keyConverter ?? new DefaultKeyConverter())); } return(new IdentityInfo(baseUri, identityProperty, null, null, null)); }
public CosmosTablesStorage(string tableName, string connectionString, int throughputUnits, IConcurrencyControl concurrency, IPartitionProvider <TKey> partitioningProvider, ITableProvider tableProvider, IKeyConverter <TKey> keyConverter) { _cc = concurrency; _tableName = tableName; _account = CloudStorageAccount.Parse(connectionString); var policy = new TableConnectionPolicy { EnableEndpointDiscovery = true, MaxConnectionLimit = 1000, MaxRetryAttemptsOnThrottledRequests = 5, MaxRetryWaitTimeInSeconds = 10, UseDirectMode = false, UseTcpProtocol = false }; _client = _account.CreateCloudTableClient(policy, ConsistencyLevel.Eventual); _partitioningProvider = partitioningProvider; _tableProvider = tableProvider; _keyConverter = keyConverter; _defaultSelection = new[] { new StorageSelection <TKey, TEntry, IStorage <TKey, TEntry> >(this) }; _tables = new Dictionary <string, CloudTable>(); _client.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.JsonNoMetadata; _throughputUnits = throughputUnits; }
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) { }
public static async Task <Serie <TKey, TEntry> > Deserialize <TKey, TEntry>(byte[] bytes, IKeyConverter <TKey> keyConverter) where TEntry : IRedisEntry, new() { var stream = new MemoryStream(bytes); var reader = CreateReader(stream); var id = reader.ReadString(); var key = await keyConverter.ConvertAsync(id).ConfigureAwait(false); var serie = new Serie <TKey, TEntry>(key); while (stream.Length != stream.Position) { var entry = DeserializeEntry <TKey, TEntry>(reader); serie.Entries.Add(entry); } return(serie); }
public HandshakeResponseFactory(IKeyConverter[] keyConverters) { _keyConverters = keyConverters; }
public InfluxStorage(Uri endpoint, string database, string username, string password, IKeyConverter <TKey> keyConverter) : this(endpoint, database, username, password, new ConcurrencyControl(DefaultReadParallelism, DefaultWriteParallelism), keyConverter) { }
public RepoService(IRepository <TKey, TData> repository, IKeyConverter <TKey> converter) { this.repository = repository; this.converter = converter; }