public BufferedDocumentStore(IDocumentStore innerDocumentStore) { Condition.Requires(innerDocumentStore, "innerDocumentStore").IsNotNull(); this._innerDocumentStore = innerDocumentStore; this._strategy = innerDocumentStore.Strategy; this._documentWriters = new List <IBufferedDocumentWriter>(); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { var dev = AzureStorage.CreateConfigurationForDev(); WipeAzureAccount.Fast(s => s.StartsWith("test-views"), dev); return(dev.CreateNuclear(strategy)); }
public AzureAtomicReader(CloudBlobClient storage, IDocumentStrategy strategy) { _strategy = strategy; var folder = strategy.GetEntityBucket <TEntity>(); _container = storage.GetBlobDirectoryReference(folder); }
public AzureAtomicWriter(CloudBlobClient storageClient, IDocumentStrategy strategy) { this._strategy = strategy; var folder = strategy.GetEntityBucket <TEntity>(); this._containerDirectory = storageClient.GetBlobDirectory(folder); }
public void SetUp() { _strategy = new DocumentStrategy(); _log = Console.Out; _store = new FileDocumentStore(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Remove(0,6), _strategy, _log); _store.Reset(_strategy.GetEntityBucket<TestObject>()); }
public AzureAtomicWriter(CloudBlobClient directory, IDocumentStrategy strategy) { _strategy = strategy; var folderForEntity = strategy.GetEntityBucket <TEntity>(); _container = directory.GetBlobDirectoryReference(folderForEntity); }
public AzureAtomicReader(CloudBlobClient storageClient, IDocumentStrategy strategy) { this._strategy = strategy; var folder = strategy.GetEntityBucket <TEntity>(); this._containerDirectory = storageClient.GetBlobDirectory(folder); this._logger = NetcoLogger.GetLogger(this.GetType()); this._ap = ActionPolicyAsync.From((exception => { var storageException = exception as StorageException; if (storageException == null) { return(false); } switch (storageException.RequestInformation.HttpStatusCode) { case ( int )HttpStatusCode.InternalServerError: case ( int )HttpStatusCode.ServiceUnavailable: return(true); default: return(false); } })).Retry(200, (ex, i) => { this._logger.Log().Trace(ex, "Retrying Azure API GET call: {0}/200", i); var secondsDelay = 0.2 + 0.1 * _random.Next(-1, 1); // randomize wait time Task.Delay(TimeSpan.FromSeconds(secondsDelay)).Wait(); }); }
/// <summary> Creates the simplified nuclear storage wrapper around Atomic storage. </summary> /// <param name="config">The storage config.</param> /// <param name="strategy">The atomic storage strategy.</param> /// <returns></returns> public static IDocumentStore CreateDocumentStore(this IAzureStorageConfig config, IDocumentStrategy strategy) { var client = config.CreateBlobClient(); return(new AzureDocumentStore(strategy, client)); }
public void SetUp() { _strategy = new JsonDocumentStrategy(); _store = new FileDocumentStore(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Remove(0, 6), _strategy); _store.Reset(_strategy.GetEntityBucket<TestObject>()); _store.Reset(_strategy.GetEntityBucket<TestEvent>()); _store.Reset(_strategy.GetEntityBucket<TestWrapper>()); }
public BufferedDocumentWriter(IDocumentReader <TKey, TEntity> reader, IDocumentWriter <TKey, TEntity> writer, IDocumentStrategy strategy) { this._reader = reader; this._writer = writer; this._strategy = strategy; this._viewsCache = new ConcurrentDictionary <string, TEntity>(); this._viewsToDelete = new ConcurrentDictionary <string, bool>(); this._keys = new ConcurrentDictionary <string, TKey>(); }
/// <summary> Creates the simplified nuclear storage wrapper around Atomic storage. </summary> /// <param name="storageConfig">The storage config.</param> /// <param name="strategy">The atomic storage strategy.</param> /// <returns></returns> public static NuclearStorage CreateNuclear(this IAzureStorageConfig storageConfig, IDocumentStrategy strategy) { var client = storageConfig.CreateBlobClient(); var factory = new AzureDocumentStore(strategy, client); return(new NuclearStorage(factory)); }
public ProjectionInfo(IEnumerable <ViewInfo> views, object tempProjection, IDocumentStrategy strategy) { Condition.Requires(views, "views").IsNotNull(); Condition.Requires(tempProjection, "tempProjection").IsNotNull(); Condition.Requires(strategy, "strategy").IsNotNull(); this.ViewBuckets = views.Select(v => v.StoreBucket).ToArray(); var viewTypes = views.Select(v => v.EntityType); var projectionType = tempProjection.GetType(); this.Hash = new ProjectionHash(projectionType, viewTypes, strategy.GetType()); this.ProjectionName = projectionType.Name; this._checkpoint = new ProjectionCheckpoint(); this._tempProjection = tempProjection; }
public FileDocumentReaderWriter(string directoryPath, IDocumentStrategy strategy, TextWriter log) { _folder = Path.Combine(directoryPath, strategy.GetEntityBucket <TEntity>());//.Replace('/', Path.DirectorySeparatorChar); _strategy = strategy; _log = log; }
/// <summary> Creates the simplified nuclear storage wrapper around Atomic storage. </summary> /// <param name="config">The storage config.</param> /// <param name="strategy">The atomic storage strategy.</param> /// <returns></returns> public static IDocumentStore CreateDocumentStore(this IAzureStorageConfig config, IDocumentStrategy strategy) { var client = config.CreateBlobClient(); return new AzureDocumentStore(strategy, client); }
public FileDocumentStore(string folderPath, IDocumentStrategy strategy) { _folderPath = folderPath; _strategy = strategy; }
protected abstract NuclearStorage Compose(IDocumentStrategy strategy);
public AzureDocumentStore(IDocumentStrategy strategy, CloudBlobClient client) { _strategy = strategy; _client = client; }
/// <summary> /// Creates the simplified nuclear storage wrapper around Atomic storage. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="strategy">The atomic storage strategy.</param> /// <returns></returns> public static NuclearStorage CreateNuclear(this MemoryStorageConfig dictionary, IDocumentStrategy strategy) { var container = new MemoryDocumentStore(dictionary.Data, strategy); return new NuclearStorage(container); }
private IEnumerable <ProjectionInfo> GeneratedProjectionInfosFromProjectors(CancellationToken token, IDocumentStore memoryContainer, IDocumentStrategy strategy) { var trackingStore = new ProjectionInspectingStore(memoryContainer); var generatedProjectionInfos = new List <ProjectionInfo>(); foreach (var projection in this._projectors(trackingStore)) { var views = trackingStore.GetNewViewsAndReset(); var projectionInfo = new ProjectionInfo(views, projection, strategy); if (generatedProjectionInfos.Any(p => p.ProjectionName == projectionInfo.ProjectionName)) { throw new InvalidOperationException("Duplicate projection encountered: " + projectionInfo.ProjectionName); } generatedProjectionInfos.Add(projectionInfo); } trackingStore.ValidateSanity(); token.ThrowIfCancellationRequested(); if (trackingStore.Views.Count != generatedProjectionInfos.Count) { throw new InvalidOperationException("Projections count mismatch"); } return(generatedProjectionInfos); }
/// <summary> Creates the simplified nuclear storage wrapper around Atomic storage. </summary> /// <param name="storageConfig">The storage config.</param> /// <param name="strategy">The atomic storage strategy.</param> /// <returns></returns> public static NuclearStorage CreateNuclear(this IAzureStorageConfig storageConfig, IDocumentStrategy strategy) { var client = storageConfig.CreateBlobClient(); var factory = new AzureDocumentStore(strategy, client); return new NuclearStorage(factory); }
public static IDocumentStore CreateDocumentStore(this FileStorageConfig config, IDocumentStrategy strategy) { return new FileDocumentStore(config.FullPath, strategy); }
public FileDocumentReaderWriter(string directoryPath, IDocumentStrategy strategy) { _strategy = strategy; _folder = Path.Combine(directoryPath, strategy.GetEntityBucket <TEntity>()); }
public CachingDocumentReader(IDocumentReader <TKey, TEntity> reader, IDocumentStrategy strategy) { this._reader = reader; this._strategy = strategy; this._cache = new ConcurrentDictionary <string, Task <Maybe <TEntity> > >(); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { return(new MemoryStorageConfig().CreateNuclear(strategy)); }
public void SetUp() { _strategy = new DocumentStrategy(); _store = new MemoryDocumentStore(_strategy, new MemoryStorageConfig().Data); }
public static NuclearStorage CreateNuclear(this FileStorageConfig config, IDocumentStrategy strategy) { var factory = new FileDocumentStore(config.FullPath, strategy); return new NuclearStorage(factory); }
public FileDocumentStore(string folderPath, IDocumentStrategy strategy, TextWriter log) { _folderPath = folderPath; _strategy = strategy; _log = log; }
public NonserializingMemoryDocumentStore(ConcurrentDictionary <string, ConcurrentDictionary <string, object> > store, IDocumentStrategy strategy) { this._store = store; this._strategy = strategy; }
public static NuclearStorage CreateNuclear(this FileStorageConfig config, IDocumentStrategy strategy) { var factory = new FileDocumentStore(config.FullPath, strategy); return(new NuclearStorage(factory)); }
public void Setup() { m_strategy = new FileJsonDocumentStrategy(); m_store = new FileDocumentStore(FOLDER_PATH, m_strategy); m_account = new AccountView { AccountID = Guid.NewGuid(), Name = "Test Account" }; m_accountID = new AccountID(m_account.AccountID); m_store.ResetAll(); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { return(_config.CreateNuclear(strategy)); }
/// <summary> /// Creates the simplified nuclear storage wrapper around Atomic storage. /// </summary> /// <param name="dictionary">The dictionary.</param> /// <param name="strategy">The atomic storage strategy.</param> /// <returns></returns> public static NuclearStorage CreateNuclear(this MemoryStorageConfig dictionary, IDocumentStrategy strategy) { var container = new MemoryDocumentStore(dictionary.Data, strategy); return(new NuclearStorage(container)); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { return new MemoryStorageConfig().CreateNuclear(strategy); }
public NonserializingMemoryDocumentReaderWriter(IDocumentStrategy strategy, ConcurrentDictionary <string, object> store) { this._store = store; this._strategy = strategy; }
public MemoryDocumentStore(ConcurrentDictionary <string, ConcurrentDictionary <string, byte[]> > store, IDocumentStrategy strategy) { _store = store; _strategy = strategy; }
public MemoryDocumentReaderWriter(IDocumentStrategy strategy, ConcurrentDictionary <string, byte[]> store) { _strategy = strategy; _store = store; }
public static IDocumentStore CreateDocumentStore(this FileStorageConfig config, IDocumentStrategy strategy) { return(new FileDocumentStore(config.FullPath, strategy)); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { return _config.CreateNuclear(strategy); }
protected override NuclearStorage Compose(IDocumentStrategy strategy) { var dev = AzureStorage.CreateConfigurationForDev(); WipeAzureAccount.Fast(s => s.StartsWith("test-views"), dev); return dev.CreateNuclear(strategy); }