From b241beb59c0465bc8b044dd7ad8efd4ec8b5f2b2 Mon Sep 17 00:00:00 2001 From: Matt Hicks Date: Sat, 21 Dec 2024 15:26:11 -0600 Subject: [PATCH] Fixed AsyncLightDB to allow customizing collections for re-indexing as well --- async/src/main/scala/lightdb/async/AsyncLightDB.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/async/src/main/scala/lightdb/async/AsyncLightDB.scala b/async/src/main/scala/lightdb/async/AsyncLightDB.scala index 617f724..ac97e4c 100644 --- a/async/src/main/scala/lightdb/async/AsyncLightDB.scala +++ b/async/src/main/scala/lightdb/async/AsyncLightDB.scala @@ -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() } @@ -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