/* Copyright 2010-2015 MongoDB Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using MongoDB.Bson; using MongoDB.Bson.Serialization; namespace MongoDB.Driver { /// /// An interface representing methods used to create, delete and modify indexes. /// /// /// This interface is not guaranteed to remain stable. Implementors should use /// . /// /// The type of the document. public interface IMongoIndexManager { /// /// Gets the namespace of the collection. /// CollectionNamespace CollectionNamespace { get; } /// /// Gets the document serializer. /// IBsonSerializer DocumentSerializer { get; } /// /// Gets the collection settings. /// MongoCollectionSettings Settings { get; } /// /// Creates an index. /// /// The keys. /// The options. /// The cancellation token. /// /// The name of the index that was created. /// string CreateOne(IndexKeysDefinition keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates an index. /// /// The keys. /// The options. /// The cancellation token. /// /// A task whose result is the name of the index that was created. /// Task CreateOneAsync(IndexKeysDefinition keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates multiple indexes. /// /// The models defining each of the indexes. /// The cancellation token. /// /// An of the names of the indexes that were created. /// IEnumerable CreateMany(IEnumerable> models, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates multiple indexes. /// /// The models defining each of the indexes. /// The cancellation token. /// /// A task whose result is an of the names of the indexes that were created. /// Task> CreateManyAsync(IEnumerable> models, CancellationToken cancellationToken = default(CancellationToken)); /// /// Drops all the indexes. /// /// The cancellation token. void DropAll(CancellationToken cancellationToken = default(CancellationToken)); /// /// Drops all the indexes. /// /// The cancellation token. /// A task. Task DropAllAsync(CancellationToken cancellationToken = default(CancellationToken)); /// /// Drops an index by its name. /// /// The name. /// The cancellation token. void DropOne(string name, CancellationToken cancellationToken = default(CancellationToken)); /// /// Drops an index by its name. /// /// The name. /// The cancellation token. /// A task. Task DropOneAsync(string name, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the indexes. /// /// The cancellation token. /// A cursor. IAsyncCursor List(CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the indexes. /// /// The cancellation token. /// A Task whose result is a cursor. Task> ListAsync(CancellationToken cancellationToken = default(CancellationToken)); } }