public int WaitForEntriesCount(IDocumentStore store, string indexName, int minEntriesCount, string databaseName = null, TimeSpan?timeout = null, bool throwOnTimeout = true) { timeout ??= (Debugger.IsAttached ? TimeSpan.FromMinutes(15) : TimeSpan.FromMinutes(1)); var sp = Stopwatch.StartNew(); var entriesCount = -1; while (sp.Elapsed < timeout.Value) { MaintenanceOperationExecutor operations = string.IsNullOrEmpty(databaseName) == false?store.Maintenance.ForDatabase(databaseName) : store.Maintenance; entriesCount = operations.Send(new GetIndexStatisticsOperation(indexName)).EntriesCount; if (entriesCount >= minEntriesCount) { return(entriesCount); } Thread.Sleep(32); } if (throwOnTimeout) { throw new TimeoutException($"It didn't get min entries count {minEntriesCount} for index {indexName}. The index has {entriesCount} entries."); } return(entriesCount); }
public SwitchOperationsToDifferentDatabase() { using (var documentStore = new DocumentStore()) { #region for_database_3 OperationExecutor operations = documentStore.Operations.ForDatabase("otherDatabase"); #endregion #region for_database_4 MaintenanceOperationExecutor maintenanceOperations = documentStore.Maintenance.ForDatabase("otherDatabase"); #endregion } }
private TimeSeriesOperations(IDocumentStore store, string database) { _store = store; _database = database; _executor = _store.Maintenance.ForDatabase(_database); }
public TimeSeriesOperations(IDocumentStore store) { _store = store; _database = store.Database; _executor = _store.Maintenance.ForDatabase(_database); }