/* 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;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
namespace MongoDB.Driver
{
///
/// Base class for implementors of .
///
/// The type of the document.
public abstract class MongoIndexManagerBase : IMongoIndexManager
{
// public properties
///
public abstract CollectionNamespace CollectionNamespace { get; }
///
public abstract IBsonSerializer DocumentSerializer { get; }
///
public abstract MongoCollectionSettings Settings { get; }
// public methods
///
public virtual string CreateOne(IndexKeysDefinition keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
{
var model = new CreateIndexModel(keys, options);
var result = CreateMany(new[] { model }, cancellationToken);
return result.Single();
}
///
public virtual async Task CreateOneAsync(IndexKeysDefinition keys, CreateIndexOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
{
var model = new CreateIndexModel(keys, options);
var result = await CreateManyAsync(new[] { model }, cancellationToken).ConfigureAwait(false);
return result.Single();
}
///
public virtual IEnumerable CreateMany(IEnumerable> models, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotImplementedException();
}
///
public virtual Task> CreateManyAsync(IEnumerable> models, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotImplementedException("CreateManyAsync has not been implemented.");
}
///
public virtual void DropAll(CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotImplementedException();
}
///
public abstract Task DropAllAsync(CancellationToken cancellationToken = default(CancellationToken));
///
public virtual void DropOne(string name, CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotImplementedException();
}
///
public abstract Task DropOneAsync(string name, CancellationToken cancellationToken = default(CancellationToken));
///
public virtual IAsyncCursor List(CancellationToken cancellationToken = default(CancellationToken))
{
throw new NotImplementedException();
}
///
public abstract Task> ListAsync(CancellationToken cancellationToken = default(CancellationToken));
}
}