public virtual string GetIndexById(Id id) { if (String.IsNullOrEmpty(id.Value)) { throw new ArgumentNullException(nameof(id)); } if (!ObjectId.TryParse(id.Value, out ObjectId objectId)) { throw new ArgumentException("Unable to parse ObjectId", nameof(id)); } return(TimeSeriesIndex.GetIndex(objectId.CreationTime)); }
public virtual string GetDocumentIndex(T document) { if (document == null) { throw new ArgumentNullException(nameof(document)); } if (_getDocumentDateUtc == null) { throw new ArgumentException("Unable to get document index", nameof(document)); } var date = _getDocumentDateUtc(document); return(TimeSeriesIndex.GetIndex(date)); }
public virtual Task EnsureIndexAsync(T document) { if (document == null) { throw new ArgumentNullException(nameof(document)); } if (_getDocumentDateUtc == null) { throw new ArgumentException("Unable to get document index", nameof(document)); } var date = _getDocumentDateUtc(document); return(TimeSeriesIndex.EnsureIndexAsync(date)); }
private HashSet <string> GetIndexes(IRepositoryQuery query) { var indexes = new HashSet <string>(); var elasticIndexes = query.GetElasticIndexes(); if (elasticIndexes.Count > 0) { indexes.AddRange(elasticIndexes); } if (query.GetElasticIndexesStartUtc().HasValue || query.GetElasticIndexesEndUtc().HasValue) { indexes.AddRange(TimeSeriesIndex.GetIndexes(query.GetElasticIndexesStartUtc(), query.GetElasticIndexesEndUtc())); } return(indexes); }
public virtual string[] GetIndexesByQuery(object query) { var withIndexesQuery = query as IElasticIndexesQuery; if (withIndexesQuery == null) { return(_defaultIndexes); } var indexes = new List <string>(); if (withIndexesQuery.Indexes.Count > 0) { indexes.AddRange(withIndexesQuery.Indexes); } if (withIndexesQuery.UtcStartIndex.HasValue || withIndexesQuery.UtcEndIndex.HasValue) { indexes.AddRange(TimeSeriesIndex.GetIndexes(withIndexesQuery.UtcStartIndex, withIndexesQuery.UtcEndIndex)); } return(indexes.Count > 0 ? indexes.ToArray() : _defaultIndexes); }