MongoClientBase.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /* Copyright 2010-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using System.Collections.Generic;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. using MongoDB.Bson;
  20. using MongoDB.Driver.Core.Clusters;
  21. namespace MongoDB.Driver
  22. {
  23. /// <summary>
  24. /// Base class for implementors of <see cref="IMongoClient"/>.
  25. /// </summary>
  26. public abstract class MongoClientBase : IMongoClient
  27. {
  28. /// <inheritdoc />
  29. public abstract ICluster Cluster { get; }
  30. /// <inheritdoc />
  31. public abstract MongoClientSettings Settings { get; }
  32. /// <inheritdoc />
  33. public virtual void DropDatabase(string name, CancellationToken cancellationToken = default(CancellationToken))
  34. {
  35. throw new NotImplementedException();
  36. }
  37. /// <inheritdoc />
  38. public virtual void DropDatabase(IClientSessionHandle session, string name, CancellationToken cancellationToken = default(CancellationToken))
  39. {
  40. throw new NotImplementedException();
  41. }
  42. /// <inheritdoc />
  43. public abstract Task DropDatabaseAsync(string name, CancellationToken cancellationToken = default(CancellationToken));
  44. /// <inheritdoc />
  45. public virtual Task DropDatabaseAsync(IClientSessionHandle session, string name, CancellationToken cancellationToken = default(CancellationToken))
  46. {
  47. throw new NotImplementedException();
  48. }
  49. /// <inheritdoc />
  50. public abstract IMongoDatabase GetDatabase(string name, MongoDatabaseSettings settings = null);
  51. /// <inheritdoc />
  52. public virtual IAsyncCursor<string> ListDatabaseNames(
  53. CancellationToken cancellationToken = default(CancellationToken))
  54. {
  55. throw new NotImplementedException();
  56. }
  57. /// <inheritdoc />
  58. public virtual IAsyncCursor<string> ListDatabaseNames(
  59. IClientSessionHandle session,
  60. CancellationToken cancellationToken = default(CancellationToken))
  61. {
  62. throw new NotImplementedException();
  63. }
  64. /// <inheritdoc />
  65. public virtual Task<IAsyncCursor<string>> ListDatabaseNamesAsync(
  66. CancellationToken cancellationToken = default(CancellationToken))
  67. {
  68. throw new NotImplementedException();
  69. }
  70. /// <inheritdoc />
  71. public virtual Task<IAsyncCursor<string>> ListDatabaseNamesAsync(
  72. IClientSessionHandle session,
  73. CancellationToken cancellationToken = default(CancellationToken))
  74. {
  75. throw new NotImplementedException();
  76. }
  77. /// <inheritdoc />
  78. public virtual IAsyncCursor<BsonDocument> ListDatabases(CancellationToken cancellationToken = default(CancellationToken))
  79. {
  80. throw new NotImplementedException();
  81. }
  82. /// <inheritdoc />
  83. public virtual IAsyncCursor<BsonDocument> ListDatabases(
  84. ListDatabasesOptions options,
  85. CancellationToken cancellationToken = default(CancellationToken))
  86. {
  87. throw new NotImplementedException();
  88. }
  89. /// <inheritdoc />
  90. public virtual IAsyncCursor<BsonDocument> ListDatabases(
  91. IClientSessionHandle session,
  92. CancellationToken cancellationToken = default(CancellationToken))
  93. {
  94. throw new NotImplementedException();
  95. }
  96. /// <inheritdoc />
  97. public virtual IAsyncCursor<BsonDocument> ListDatabases(
  98. IClientSessionHandle session,
  99. ListDatabasesOptions options,
  100. CancellationToken cancellationToken = default(CancellationToken))
  101. {
  102. throw new NotImplementedException();
  103. }
  104. /// <inheritdoc />
  105. public abstract Task<IAsyncCursor<BsonDocument>> ListDatabasesAsync(CancellationToken cancellationToken = default(CancellationToken));
  106. /// <inheritdoc />
  107. public virtual Task<IAsyncCursor<BsonDocument>> ListDatabasesAsync(
  108. ListDatabasesOptions options,
  109. CancellationToken cancellationToken = default(CancellationToken))
  110. {
  111. throw new NotImplementedException();
  112. }
  113. /// <inheritdoc />
  114. public virtual Task<IAsyncCursor<BsonDocument>> ListDatabasesAsync(IClientSessionHandle session, CancellationToken cancellationToken = default(CancellationToken))
  115. {
  116. throw new NotImplementedException();
  117. }
  118. /// <inheritdoc />
  119. public virtual Task<IAsyncCursor<BsonDocument>> ListDatabasesAsync(
  120. IClientSessionHandle session,
  121. ListDatabasesOptions options,
  122. CancellationToken cancellationToken = default(CancellationToken))
  123. {
  124. throw new NotImplementedException();
  125. }
  126. /// <inheritdoc />
  127. public virtual IClientSessionHandle StartSession(ClientSessionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  128. {
  129. throw new NotImplementedException();
  130. }
  131. /// <inheritdoc />
  132. public virtual Task<IClientSessionHandle> StartSessionAsync(ClientSessionOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
  133. {
  134. throw new NotImplementedException();
  135. }
  136. /// <inheritdoc />
  137. public virtual IAsyncCursor<TResult> Watch<TResult>(
  138. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  139. ChangeStreamOptions options = null,
  140. CancellationToken cancellationToken = default(CancellationToken))
  141. {
  142. throw new NotImplementedException(); // implemented by subclasses
  143. }
  144. /// <inheritdoc />
  145. public virtual IAsyncCursor<TResult> Watch<TResult>(
  146. IClientSessionHandle session,
  147. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  148. ChangeStreamOptions options = null,
  149. CancellationToken cancellationToken = default(CancellationToken))
  150. {
  151. throw new NotImplementedException(); // implemented by subclasses
  152. }
  153. /// <inheritdoc />
  154. public virtual Task<IAsyncCursor<TResult>> WatchAsync<TResult>(
  155. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  156. ChangeStreamOptions options = null,
  157. CancellationToken cancellationToken = default(CancellationToken))
  158. {
  159. throw new NotImplementedException(); // implemented by subclasses
  160. }
  161. /// <inheritdoc />
  162. public virtual Task<IAsyncCursor<TResult>> WatchAsync<TResult>(
  163. IClientSessionHandle session,
  164. PipelineDefinition<ChangeStreamDocument<BsonDocument>, TResult> pipeline,
  165. ChangeStreamOptions options = null,
  166. CancellationToken cancellationToken = default(CancellationToken))
  167. {
  168. throw new NotImplementedException(); // implemented by subclasses
  169. }
  170. /// <inheritdoc />
  171. public virtual IMongoClient WithReadConcern(ReadConcern readConcern)
  172. {
  173. throw new NotImplementedException();
  174. }
  175. /// <inheritdoc />
  176. public virtual IMongoClient WithReadPreference(ReadPreference readPreference)
  177. {
  178. throw new NotImplementedException();
  179. }
  180. /// <inheritdoc />
  181. public virtual IMongoClient WithWriteConcern(WriteConcern writeConcern)
  182. {
  183. throw new NotImplementedException();
  184. }
  185. }
  186. }