/* Copyright 2010-present 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;
namespace MongoDB.Driver.Search
{
///
/// An interface representing methods used to create, delete and modify search indexes.
///
public interface IMongoSearchIndexManager
{
///
/// 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);
///
/// 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);
///
/// Creates a search index.
///
/// The index definition.
/// The index name.
/// The cancellation token.
///
/// The name of the index that was created.
///
string CreateOne(BsonDocument definition, string name = null, CancellationToken cancellationToken = default);
///
/// Creates a search index.
///
/// The model defining the index.
/// The cancellation token.
///
/// The name of the index that was created.
///
string CreateOne(CreateSearchIndexModel model, CancellationToken cancellationToken = default);
///
/// Creates a search index.
///
/// The index definition.
/// The index name.
/// The cancellation token.
///
/// The name of the index that was created.
///
Task CreateOneAsync(BsonDocument definition, string name = null, CancellationToken cancellationToken = default);
///
/// Creates a search index.
///
/// The model defining the index.
/// The cancellation token.
///
/// A Task whose result is the name of the index that was created.
///
Task CreateOneAsync(CreateSearchIndexModel model, CancellationToken cancellationToken = default);
///
/// Drops an index by its name.
///
/// The index name.
/// The cancellation token.
void DropOne(string name, CancellationToken cancellationToken = default);
///
/// Drops an index by its name.
///
/// The index name.
/// The cancellation token.
/// A Task.
Task DropOneAsync(string name, CancellationToken cancellationToken = default);
///
/// Lists the search indexes.
///
/// Name of the index.
/// The aggregate options.
/// The cancellation token.
///
/// A cursor.
///
IAsyncCursor List(string name = null, AggregateOptions aggregateOptions = null, CancellationToken cancellationToken = default);
///
/// Lists the search indexes.
///
/// Name of the index.
/// The aggregate options.
/// The cancellation token.
///
/// A Task whose result is a cursor.
///
Task> ListAsync(string name = null, AggregateOptions aggregateOptions = null, CancellationToken cancellationToken = default);
///
/// Update the search index.
///
/// Name of the index.
/// The definition.
/// The cancellation token.
void Update(string name, BsonDocument definition, CancellationToken cancellationToken = default);
///
/// Update the search index.
///
/// Name of the index.
/// The definition.
/// The cancellation token.
/// A Task.
Task UpdateAsync(string name, BsonDocument definition, CancellationToken cancellationToken = default);
}
}