Package de.bwaldvogel.mongo.backend
Class AbstractMongoDatabase<P>
java.lang.Object
de.bwaldvogel.mongo.backend.AbstractMongoDatabase<P>
- All Implemented Interfaces:
AsyncMongoDatabase,MongoDatabase
- Direct Known Subclasses:
AbstractSynchronizedMongoDatabase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CursorRegistryprotected final Stringprotected final AtomicReference<MongoCollection<P>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMongoDatabase(String databaseName, CursorRegistry cursorRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidclearLastStatus(io.netty.channel.Channel channel) protected intcreateCollectionOrThrowIfExists(String collectionName, CollectionOptions options) voidvoiddropCollection(String collectionName, Oplog oplog) protected voiddropIndex(MongoCollection<P> collection, String indexName) final Stringprotected abstract longprotected StringgetFullCollectionNamespace(String collectionName) protected MongoCollection<P>protected abstract longvoidhandleClose(io.netty.channel.Channel channel) handleCommand(io.netty.channel.Channel channel, String command, Document query, Oplog oplog) handleCommandAsync(io.netty.channel.Channel channel, String command, Document query, Oplog oplog) handleQuery(MongoQuery query) handleQueryAsync(MongoQuery query) protected voidbooleanisEmpty()protected booleanvoidmoveCollection(MongoDatabase oldDatabase, MongoCollection<?> collection, String newCollectionName) protected abstract MongoCollection<P>openOrCreateCollection(String collectionName, CollectionOptions options) openOrCreateSecondaryIndex(String collectionName, String indexName, List<IndexKey> keys, boolean sparse) openOrCreateUniqueIndex(String collectionName, String indexName, List<IndexKey> keys, boolean sparse) protected voidputLastResult(io.netty.channel.Channel channel, Document result) resolveCollection(String collectionName, boolean throwIfNotFound) protected MongoCollection<P>resolveOrCreateCollection(String collectionName) toString()voidunregisterCollection(String collectionName)
-
Field Details
-
databaseName
-
indexes
-
cursorRegistry
-
-
Constructor Details
-
AbstractMongoDatabase
-
-
Method Details
-
initializeNamespacesAndIndexes
protected void initializeNamespacesAndIndexes() -
getDatabaseName
- Specified by:
getDatabaseNamein interfaceMongoDatabase
-
toString
-
handleCommand
public Document handleCommand(io.netty.channel.Channel channel, String command, Document query, Oplog oplog) - Specified by:
handleCommandin interfaceMongoDatabase
-
handleCommandAsync
public CompletionStage<Document> handleCommandAsync(io.netty.channel.Channel channel, String command, Document query, Oplog oplog) - Specified by:
handleCommandAsyncin interfaceAsyncMongoDatabase- Specified by:
handleCommandAsyncin interfaceMongoDatabase
-
resolveOrCreateCollection
-
createCollectionOrThrowIfExists
public MongoCollection<P> createCollectionOrThrowIfExists(String collectionName, CollectionOptions options) - Specified by:
createCollectionOrThrowIfExistsin interfaceMongoDatabase
-
dropIndex
-
countIndexes
protected int countIndexes() -
getFileSize
protected abstract long getFileSize() -
getStorageSize
protected abstract long getStorageSize() -
handleQuery
- Specified by:
handleQueryin interfaceMongoDatabase
-
handleQueryAsync
- Specified by:
handleQueryAsyncin interfaceAsyncMongoDatabase- Specified by:
handleQueryAsyncin interfaceMongoDatabase
-
handleClose
public void handleClose(io.netty.channel.Channel channel) - Specified by:
handleClosein interfaceMongoDatabase
-
clearLastStatus
protected void clearLastStatus(io.netty.channel.Channel channel) -
resolveCollection
- Specified by:
resolveCollectionin interfaceMongoDatabase
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMongoDatabase
-
addIndex
-
getOrCreateIndexesCollection
-
isPrimaryKeyIndex
-
openOrCreateSecondaryIndex
-
openOrCreateUniqueIndex
-
putLastResult
-
openOrCreateCollection
protected abstract MongoCollection<P> openOrCreateCollection(String collectionName, CollectionOptions options) -
drop
- Specified by:
dropin interfaceMongoDatabase
-
dropCollection
- Specified by:
dropCollectionin interfaceMongoDatabase
-
unregisterCollection
- Specified by:
unregisterCollectionin interfaceMongoDatabase
-
moveCollection
public void moveCollection(MongoDatabase oldDatabase, MongoCollection<?> collection, String newCollectionName) - Specified by:
moveCollectionin interfaceMongoDatabase
-
getFullCollectionNamespace
-