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) voidhandleDelete(MongoDelete delete, Oplog oplog) voidhandleInsert(MongoInsert insert, Oplog oplog) handleQuery(MongoQuery query) handleQueryAsync(MongoQuery query) voidhandleUpdate(MongoUpdate updateCommand, Oplog oplog) 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) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.bwaldvogel.mongo.MongoDatabase
handleDeleteAsync, handleInsertAsync, handleUpdateAsync
-
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) -
handleInsert
- Specified by:
handleInsertin interfaceMongoDatabase
-
resolveCollection
- Specified by:
resolveCollectionin interfaceMongoDatabase
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMongoDatabase
-
handleDelete
- Specified by:
handleDeletein interfaceMongoDatabase
-
handleUpdate
- Specified by:
handleUpdatein 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
-