Skip to content

Commit

Permalink
Fixed AsyncLightDB to allow customizing collections for re-indexing a…
Browse files Browse the repository at this point in the history
…s well
  • Loading branch information
darkfrog26 committed Dec 21, 2024
1 parent 2feef79 commit b241beb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion async/src/main/scala/lightdb/async/AsyncLightDB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ trait AsyncLightDB extends FeatureSupport[DBFeatureKey] { db =>
storeManager: Option[StoreManager] = None): AsyncCollection[Doc, Model] =
AsyncCollection(underlying.collection[Doc, Model](model, name, storeManager))

def reIndex(): Task[Int] = rapid.Stream.emits(underlying.collections)
def reIndex(collections: List[Collection[_, _]] = underlying.collections): Task[Int] = rapid.Stream.emits(collections)
.par(maxThreads = 32) { collection =>
AsyncCollection[KeyValue, KeyValue.type](collection.asInstanceOf[Collection[KeyValue, KeyValue.type]]).reIndex()
}
Expand Down Expand Up @@ -106,6 +106,9 @@ trait AsyncLightDB extends FeatureSupport[DBFeatureKey] { db =>

protected def initialize(): Task[Unit] = Task.unit

def collectionsByNames(collectionNames: String*): Task[List[Collection[_, _]]] =
Task(underlying.collectionsByNames(collectionNames: _*))

def dispose(): Task[Boolean] = Task {
if (underlying.disposed) {
false
Expand Down

0 comments on commit b241beb

Please sign in to comment.