Reformat code

This commit is contained in:
eikek 2022-03-13 15:05:29 +01:00
parent 90e52efbff
commit 4c220879db
85 changed files with 492 additions and 225 deletions

View File

@ -7,6 +7,7 @@
package docspell.backend
import cats.effect._
import docspell.backend.auth.Login
import docspell.backend.fulltext.CreateIndex
import docspell.backend.ops._
@ -17,6 +18,7 @@ import docspell.pubsub.api.PubSubT
import docspell.scheduler.JobStoreModule
import docspell.store.Store
import docspell.totp.Totp
import emil.Emil
trait BackendApp[F[_]] {

View File

@ -8,6 +8,7 @@ package docspell.backend
import cats.effect._
import cats.implicits._
import docspell.backend.MailAddressCodec
import docspell.common._
import docspell.notification.api.PeriodicQueryArgs

View File

@ -7,6 +7,7 @@
package docspell.backend.msg
import cats.data.NonEmptyList
import docspell.pubsub.api.TypedTopic
import docspell.scheduler.msg._

View File

@ -9,17 +9,19 @@ package docspell.backend.ops
import cats.effect.{Async, Resource}
import cats.implicits._
import fs2.Stream
import docspell.backend.JobFactory
import docspell.backend.PasswordCrypt
import docspell.backend.ops.OCollective._
import docspell.common._
import docspell.scheduler.JobStore
import docspell.scheduler.usertask.{UserTask, UserTaskScope, UserTaskStore}
import docspell.store.UpdateResult
import docspell.store.queries.{QCollective, QUser}
import docspell.store.records._
import docspell.store.{AddResult, Store}
import com.github.eikek.calev._
import docspell.scheduler.JobStore
import docspell.scheduler.usertask.{UserTask, UserTaskScope, UserTaskStore}
trait OCollective[F[_]] {

View File

@ -9,11 +9,13 @@ package docspell.backend.ops
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.backend.JobFactory
import docspell.backend.ops.OFileRepository.IntegrityResult
import docspell.common._
import docspell.scheduler.{Job, JobStore}
import docspell.store.Store
import scodec.bits.ByteVector
trait OFileRepository[F[_]] {

View File

@ -10,6 +10,7 @@ import cats.data.NonEmptyList
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.backend.JobFactory
import docspell.backend.ops.OItemSearch._
import docspell.common._

View File

@ -9,6 +9,7 @@ package docspell.backend.ops
import cats.data.{NonEmptyList => Nel, OptionT}
import cats.effect.{Async, Resource}
import cats.implicits._
import docspell.backend.AttachedEvent
import docspell.backend.JobFactory
import docspell.backend.fulltext.CreateIndex
@ -21,6 +22,7 @@ import docspell.scheduler.JobStore
import docspell.store.queries.{QAttachment, QItem, QMoveAttachment}
import docspell.store.records._
import docspell.store.{AddResult, Store, UpdateResult}
import doobie.implicits._
trait OItem[F[_]] {

View File

@ -9,6 +9,7 @@ package docspell.backend.ops
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.backend.ops.OJob.{CollectiveQueueState, JobCancelResult}
import docspell.common._
import docspell.pubsub.api.PubSubT

View File

@ -9,6 +9,7 @@ package docspell.backend.ops
import cats.Applicative
import cats.effect._
import cats.implicits._
import docspell.common.Ident
import docspell.pubsub.api.PubSubT
import docspell.scheduler.msg.{CancelJob, JobsNotify, PeriodicTaskNotify}

View File

@ -11,6 +11,7 @@ import cats.data.{EitherT, OptionT}
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.backend.JobFactory
import docspell.common._
import docspell.scheduler.{Job, JobStore}

View File

@ -10,11 +10,13 @@ import cats.data.{NonEmptyList, OptionT}
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.notification.api.{ChannelRef, PeriodicDueItemsArgs, PeriodicQueryArgs}
import docspell.scheduler.usertask.{UserTask, UserTaskScope, UserTaskStore}
import docspell.store.Store
import docspell.store.records.RNotificationChannel
import io.circe.Encoder
trait OUserTask[F[_]] {

View File

@ -19,10 +19,10 @@ import docspell.ftssolr.SolrConfig
import docspell.joex.analysis.RegexNerFile
import docspell.joex.hk.HouseKeepingConfig
import docspell.joex.routes.InternalHeader
import docspell.scheduler.{PeriodicSchedulerConfig, SchedulerConfig}
import docspell.joex.updatecheck.UpdateCheckConfig
import docspell.logging.LogConfig
import docspell.pubsub.naive.PubSubConfig
import docspell.scheduler.{PeriodicSchedulerConfig, SchedulerConfig}
import docspell.store.JdbcConfig
case class Config(

View File

@ -9,36 +9,25 @@ package docspell.joex
import cats.effect._
import cats.implicits._
import fs2.concurrent.SignallingRef
import docspell.analysis.TextAnalyser
import docspell.backend.MailAddressCodec
import docspell.backend.fulltext.CreateIndex
import docspell.backend.ops._
import docspell.common._
import docspell.ftsclient.FtsClient
import docspell.ftssolr.SolrFtsClient
import docspell.joex.analysis.RegexNerFile
import docspell.joex.emptytrash._
import docspell.joex.filecopy.{FileCopyTask, FileIntegrityCheckTask}
import docspell.joex.fts.{MigrationTask, ReIndexTask}
import docspell.joex.fts.MigrationTask
import docspell.joex.hk._
import docspell.joex.learn.LearnClassifierTask
import docspell.joex.notify._
import docspell.joex.pagecount._
import docspell.joex.pdfconv.ConvertAllPdfTask
import docspell.joex.pdfconv.PdfConvTask
import docspell.joex.preview._
import docspell.joex.process.ItemHandler
import docspell.joex.process.ReProcessItem
import docspell.joex.scanmailbox._
import docspell.scheduler._
import docspell.scheduler.impl.{JobStoreModuleBuilder, SchedulerModuleBuilder}
import docspell.joex.updatecheck._
import docspell.notification.api.NotificationModule
import docspell.notification.impl.NotificationModuleImpl
import docspell.pubsub.api.{PubSub, PubSubT}
import docspell.scheduler._
import docspell.scheduler.impl.{JobStoreModuleBuilder, SchedulerModuleBuilder}
import docspell.scheduler.usertask.{UserTaskScope, UserTaskStore}
import docspell.store.Store
import docspell.store.records.{REmptyTrashSetting, RJobLog}
import emil.javamail._
import org.http4s.client.Client
@ -129,165 +118,21 @@ object JoexAppImpl extends MailAddressCodec {
.withEventSink(notificationMod)
.build
joex <- OJoex(pubSubT)
upload <- OUpload(store, jobStoreModule.jobs, joex)
fts <- createFtsClient(cfg)(httpClient)
createIndex <- CreateIndex.resource(fts, store)
itemOps <- OItem(store, fts, createIndex, jobStoreModule.jobs, joex)
itemSearchOps <- OItemSearch(store)
analyser <- TextAnalyser.create[F](cfg.textAnalysis.textAnalysisConfig)
regexNer <- RegexNerFile(cfg.textAnalysis.regexNerFileConfig, store)
updateCheck <- UpdateCheck.resource(httpClient)
notification <- ONotification(store, notificationMod)
fileRepo <- OFileRepository(store, jobStoreModule.jobs, joex)
tasks <- JoexTasks.resource(
cfg,
jobStoreModule,
httpClient,
pubSubT,
notificationMod,
javaEmil
)
schedulerModule <- SchedulerModuleBuilder(jobStoreModule)
.withSchedulerConfig(cfg.scheduler)
.withPeriodicSchedulerConfig(cfg.periodicScheduler)
.withTaskRegistry(JobTaskRegistry
.empty[F]
.withTask(
JobTask.json(
ProcessItemArgs.taskName,
ItemHandler.newItem[F](cfg,store, itemOps, fts, analyser, regexNer),
ItemHandler.onCancel[F](store)
)
)
.withTask(
JobTask.json(
ReProcessItemArgs.taskName,
ReProcessItem[F](cfg, fts, itemOps, analyser, regexNer, store),
ReProcessItem.onCancel[F]
)
)
.withTask(
JobTask.json(
ScanMailboxArgs.taskName,
ScanMailboxTask[F](cfg.userTasks.scanMailbox, store, javaEmil, upload, joex),
ScanMailboxTask.onCancel[F]
)
)
.withTask(
JobTask.json(
MigrationTask.taskName,
MigrationTask[F](cfg.fullTextSearch, store, fts, createIndex),
MigrationTask.onCancel[F]
)
)
.withTask(
JobTask.json(
ReIndexTask.taskName,
ReIndexTask[F](cfg.fullTextSearch, store, fts, createIndex),
ReIndexTask.onCancel[F]
)
)
.withTask(
JobTask.json(
HouseKeepingTask.taskName,
HouseKeepingTask[F](cfg, store, fileRepo),
HouseKeepingTask.onCancel[F]
)
)
.withTask(
JobTask.json(
PdfConvTask.taskName,
PdfConvTask[F](cfg, store),
PdfConvTask.onCancel[F]
)
)
.withTask(
JobTask.json(
ConvertAllPdfArgs.taskName,
ConvertAllPdfTask[F](jobStoreModule.jobs, joex, store),
ConvertAllPdfTask.onCancel[F]
)
)
.withTask(
JobTask.json(
LearnClassifierArgs.taskName,
LearnClassifierTask[F](cfg.textAnalysis, store, analyser),
LearnClassifierTask.onCancel[F]
)
)
.withTask(
JobTask.json(
MakePreviewArgs.taskName,
MakePreviewTask[F](cfg.extraction.preview, store),
MakePreviewTask.onCancel[F]
)
)
.withTask(
JobTask.json(
AllPreviewsArgs.taskName,
AllPreviewsTask[F](jobStoreModule.jobs, joex, store),
AllPreviewsTask.onCancel[F]
)
)
.withTask(
JobTask.json(
MakePageCountArgs.taskName,
MakePageCountTask[F](store),
MakePageCountTask.onCancel[F]
)
)
.withTask(
JobTask.json(
AllPageCountTask.taskName,
AllPageCountTask[F](store, jobStoreModule.jobs, joex),
AllPageCountTask.onCancel[F]
)
)
.withTask(
JobTask.json(
EmptyTrashArgs.taskName,
EmptyTrashTask[F](itemOps, itemSearchOps),
EmptyTrashTask.onCancel[F]
)
)
.withTask(
JobTask.json(
UpdateCheckTask.taskName,
UpdateCheckTask[F](
cfg.updateCheck,
cfg.sendMail,
store,
javaEmil,
updateCheck,
ThisVersion.default
),
UpdateCheckTask.onCancel[F]
)
)
.withTask(
JobTask.json(
PeriodicQueryTask.taskName,
PeriodicQueryTask[F](store, notification),
PeriodicQueryTask.onCancel[F]
)
)
.withTask(
JobTask.json(
PeriodicDueItemsTask.taskName,
PeriodicDueItemsTask[F](store, notification),
PeriodicDueItemsTask.onCancel[F]
)
)
.withTask(
JobTask.json(
FileCopyTaskArgs.taskName,
FileCopyTask[F](cfg, store),
FileCopyTask.onCancel[F]
)
)
.withTask(
JobTask.json(
FileIntegrityCheckArgs.taskName,
FileIntegrityCheckTask[F](fileRepo, store),
FileIntegrityCheckTask.onCancel[F]
)
)
)
.withTaskRegistry(tasks.get)
.resource
app = new JoexAppImpl(
cfg,
store,
@ -301,10 +146,4 @@ object JoexAppImpl extends MailAddressCodec {
appR <- Resource.make(app.init.map(_ => app))(_.initShutdown)
} yield appR
private def createFtsClient[F[_]: Async](
cfg: Config
)(client: Client[F]): Resource[F, FtsClient[F]] =
if (cfg.fullTextSearch.enabled) SolrFtsClient(cfg.fullTextSearch.solr, client)
else Resource.pure[F, FtsClient[F]](FtsClient.none[F])
}

View File

@ -0,0 +1,248 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.joex
import cats.effect.{Async, Resource}
import docspell.analysis.TextAnalyser
import docspell.backend.fulltext.CreateIndex
import docspell.backend.ops._
import docspell.common._
import docspell.ftsclient.FtsClient
import docspell.ftssolr.SolrFtsClient
import docspell.joex.analysis.RegexNerFile
import docspell.joex.emptytrash.EmptyTrashTask
import docspell.joex.filecopy.{FileCopyTask, FileIntegrityCheckTask}
import docspell.joex.fts.{MigrationTask, ReIndexTask}
import docspell.joex.hk.HouseKeepingTask
import docspell.joex.learn.LearnClassifierTask
import docspell.joex.notify.{PeriodicDueItemsTask, PeriodicQueryTask}
import docspell.joex.pagecount.{AllPageCountTask, MakePageCountTask}
import docspell.joex.pdfconv.{ConvertAllPdfTask, PdfConvTask}
import docspell.joex.preview.{AllPreviewsTask, MakePreviewTask}
import docspell.joex.process.{ItemHandler, ReProcessItem}
import docspell.joex.scanmailbox.ScanMailboxTask
import docspell.joex.updatecheck.{ThisVersion, UpdateCheck, UpdateCheckTask}
import docspell.notification.api.NotificationModule
import docspell.pubsub.api.PubSubT
import docspell.scheduler.impl.JobStoreModuleBuilder
import docspell.scheduler.{JobStoreModule, JobTask, JobTaskRegistry}
import docspell.store.Store
import emil.Emil
import org.http4s.client.Client
final class JoexTasks[F[_]: Async](
cfg: Config,
store: Store[F],
itemOps: OItem[F],
fts: FtsClient[F],
analyser: TextAnalyser[F],
regexNer: RegexNerFile[F],
updateCheck: UpdateCheck[F],
notification: ONotification[F],
fileRepo: OFileRepository[F],
javaEmil: Emil[F],
jobStoreModule: JobStoreModule[F],
upload: OUpload[F],
createIndex: CreateIndex[F],
joex: OJoex[F],
itemSearch: OItemSearch[F]
) {
def get: JobTaskRegistry[F] =
JobTaskRegistry
.empty[F]
.withTask(
JobTask.json(
ProcessItemArgs.taskName,
ItemHandler.newItem[F](cfg, store, itemOps, fts, analyser, regexNer),
ItemHandler.onCancel[F](store)
)
)
.withTask(
JobTask.json(
ReProcessItemArgs.taskName,
ReProcessItem[F](cfg, fts, itemOps, analyser, regexNer, store),
ReProcessItem.onCancel[F]
)
)
.withTask(
JobTask.json(
ScanMailboxArgs.taskName,
ScanMailboxTask[F](cfg.userTasks.scanMailbox, store, javaEmil, upload, joex),
ScanMailboxTask.onCancel[F]
)
)
.withTask(
JobTask.json(
MigrationTask.taskName,
MigrationTask[F](cfg.fullTextSearch, store, fts, createIndex),
MigrationTask.onCancel[F]
)
)
.withTask(
JobTask.json(
ReIndexTask.taskName,
ReIndexTask[F](cfg.fullTextSearch, store, fts, createIndex),
ReIndexTask.onCancel[F]
)
)
.withTask(
JobTask.json(
HouseKeepingTask.taskName,
HouseKeepingTask[F](cfg, store, fileRepo),
HouseKeepingTask.onCancel[F]
)
)
.withTask(
JobTask.json(
PdfConvTask.taskName,
PdfConvTask[F](cfg, store),
PdfConvTask.onCancel[F]
)
)
.withTask(
JobTask.json(
ConvertAllPdfArgs.taskName,
ConvertAllPdfTask[F](jobStoreModule.jobs, joex, store),
ConvertAllPdfTask.onCancel[F]
)
)
.withTask(
JobTask.json(
LearnClassifierArgs.taskName,
LearnClassifierTask[F](cfg.textAnalysis, store, analyser),
LearnClassifierTask.onCancel[F]
)
)
.withTask(
JobTask.json(
MakePreviewArgs.taskName,
MakePreviewTask[F](cfg.extraction.preview, store),
MakePreviewTask.onCancel[F]
)
)
.withTask(
JobTask.json(
AllPreviewsArgs.taskName,
AllPreviewsTask[F](jobStoreModule.jobs, joex, store),
AllPreviewsTask.onCancel[F]
)
)
.withTask(
JobTask.json(
MakePageCountArgs.taskName,
MakePageCountTask[F](store),
MakePageCountTask.onCancel[F]
)
)
.withTask(
JobTask.json(
AllPageCountTask.taskName,
AllPageCountTask[F](store, jobStoreModule.jobs, joex),
AllPageCountTask.onCancel[F]
)
)
.withTask(
JobTask.json(
EmptyTrashArgs.taskName,
EmptyTrashTask[F](itemOps, itemSearch),
EmptyTrashTask.onCancel[F]
)
)
.withTask(
JobTask.json(
UpdateCheckTask.taskName,
UpdateCheckTask[F](
cfg.updateCheck,
cfg.sendMail,
store,
javaEmil,
updateCheck,
ThisVersion.default
),
UpdateCheckTask.onCancel[F]
)
)
.withTask(
JobTask.json(
PeriodicQueryTask.taskName,
PeriodicQueryTask[F](store, notification),
PeriodicQueryTask.onCancel[F]
)
)
.withTask(
JobTask.json(
PeriodicDueItemsTask.taskName,
PeriodicDueItemsTask[F](store, notification),
PeriodicDueItemsTask.onCancel[F]
)
)
.withTask(
JobTask.json(
FileCopyTaskArgs.taskName,
FileCopyTask[F](cfg, store),
FileCopyTask.onCancel[F]
)
)
.withTask(
JobTask.json(
FileIntegrityCheckArgs.taskName,
FileIntegrityCheckTask[F](fileRepo, store),
FileIntegrityCheckTask.onCancel[F]
)
)
}
object JoexTasks {
def resource[F[_]: Async](
cfg: Config,
jobStoreModule: JobStoreModuleBuilder.Module[F],
httpClient: Client[F],
pubSub: PubSubT[F],
notificationModule: NotificationModule[F],
emailService: Emil[F]
): Resource[F, JoexTasks[F]] =
for {
joex <- OJoex(pubSub)
store = jobStoreModule.store
upload <- OUpload(store, jobStoreModule.jobs, joex)
fts <- createFtsClient(cfg)(httpClient)
createIndex <- CreateIndex.resource(fts, store)
itemOps <- OItem(store, fts, createIndex, jobStoreModule.jobs, joex)
itemSearchOps <- OItemSearch(store)
analyser <- TextAnalyser.create[F](cfg.textAnalysis.textAnalysisConfig)
regexNer <- RegexNerFile(cfg.textAnalysis.regexNerFileConfig, store)
updateCheck <- UpdateCheck.resource(httpClient)
notification <- ONotification(store, notificationModule)
fileRepo <- OFileRepository(store, jobStoreModule.jobs, joex)
} yield new JoexTasks[F](
cfg,
store,
itemOps,
fts,
analyser,
regexNer,
updateCheck,
notification,
fileRepo,
emailService,
jobStoreModule,
upload,
createIndex,
joex,
itemSearchOps
)
private def createFtsClient[F[_]: Async](
cfg: Config
)(client: Client[F]): Resource[F, FtsClient[F]] =
if (cfg.fullTextSearch.enabled) SolrFtsClient(cfg.fullTextSearch.solr, client)
else Resource.pure[F, FtsClient[F]](FtsClient.none[F])
}

View File

@ -9,12 +9,14 @@ package docspell.joex.emptytrash
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.backend.ops.{OItem, OItemSearch}
import docspell.common._
import docspell.scheduler._
import docspell.store.records.RItem
import com.github.eikek.calev.CalEvent
import docspell.scheduler.usertask.UserTask
import docspell.store.records.RItem
import com.github.eikek.calev.CalEvent
object EmptyTrashTask {
type Args = EmptyTrashArgs

View File

@ -9,15 +9,17 @@ package docspell.joex.filecopy
import cats.data.NonEmptyList
import cats.effect._
import cats.implicits._
import docspell.common.FileCopyTaskArgs.Selection
import docspell.common.{FileCopyTaskArgs, Ident}
import docspell.joex.Config
import docspell.scheduler.{JobTaskResultEncoder, Task}
import docspell.logging.Logger
import docspell.scheduler.{JobTaskResultEncoder, Task}
import docspell.store.Store
import docspell.store.file.{BinnyUtils, FileRepository, FileRepositoryConfig}
import binny.CopyTool.Counter
import binny.{BinaryId, BinaryStore, CopyTool}
import docspell.store.Store
import io.circe.generic.semiauto.deriveCodec
import io.circe.{Codec, Decoder, Encoder}

View File

@ -9,12 +9,14 @@ package docspell.joex.filecopy
import cats.Monoid
import cats.effect._
import cats.implicits._
import docspell.backend.ops.OFileRepository
import docspell.backend.ops.OFileRepository.IntegrityResult
import docspell.common.{FileIntegrityCheckArgs, FileKey}
import docspell.scheduler.{JobTaskResultEncoder, Task}
import docspell.store.Store
import docspell.store.records.RFileMeta
import io.circe.Encoder
import io.circe.generic.semiauto.deriveEncoder

View File

@ -9,12 +9,13 @@ package docspell.joex.fts
import cats._
import cats.data.{Kleisli, NonEmptyList}
import cats.implicits._
import docspell.backend.fulltext.CreateIndex
import docspell.common._
import docspell.ftsclient._
import docspell.joex.Config
import docspell.scheduler.Context
import docspell.logging.Logger
import docspell.scheduler.Context
import docspell.store.Store
object FtsWork {

View File

@ -8,6 +8,7 @@ package docspell.joex.fts
import cats.effect._
import cats.implicits._
import docspell.backend.fulltext.CreateIndex
import docspell.common._
import docspell.ftsclient._

View File

@ -8,6 +8,7 @@ package docspell.joex.fts
import cats.effect._
import cats.implicits._
import docspell.backend.fulltext.CreateIndex
import docspell.common._
import docspell.ftsclient._

View File

@ -8,11 +8,13 @@ package docspell.joex.hk
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.scheduler.Task
import docspell.logging.Logger
import docspell.scheduler.Task
import docspell.store.Store
import docspell.store.records._
import org.http4s.blaze.client.BlazeClientBuilder
import org.http4s.client.Client

View File

@ -8,6 +8,7 @@ package docspell.joex.hk
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.scheduler.Task
import docspell.store.Store

View File

@ -8,6 +8,7 @@ package docspell.joex.hk
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.scheduler.Task
import docspell.store.Store

View File

@ -8,14 +8,16 @@ package docspell.joex.hk
import cats.effect._
import cats.implicits._
import docspell.backend.ops.OFileRepository
import docspell.common._
import docspell.joex.Config
import docspell.joex.filecopy.FileIntegrityCheckTask
import docspell.scheduler.{JobTaskResultEncoder, Task}
import com.github.eikek.calev._
import docspell.scheduler.usertask.UserTask
import docspell.scheduler.{JobTaskResultEncoder, Task}
import docspell.store.Store
import com.github.eikek.calev._
import io.circe.Encoder
import io.circe.generic.semiauto.deriveEncoder

View File

@ -8,6 +8,7 @@ package docspell.joex.hk
import cats.effect._
import cats.implicits._
import docspell.backend.ops.OFileRepository
import docspell.common._
import docspell.joex.filecopy.FileIntegrityCheckTask

View File

@ -9,12 +9,13 @@ package docspell.joex.learn
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.analysis.TextAnalyser
import docspell.backend.ops.OCollective
import docspell.common._
import docspell.joex.Config
import docspell.scheduler._
import docspell.logging.Logger
import docspell.scheduler._
import docspell.store.Store
import docspell.store.records.{RClassifierModel, RClassifierSetting}

View File

@ -10,6 +10,7 @@ import cats.data.Kleisli
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.analysis.TextAnalyser
import docspell.analysis.classifier.TextClassifier.Data
import docspell.common._

View File

@ -9,6 +9,7 @@ package docspell.joex.learn
import cats.data.Kleisli
import cats.effect._
import cats.implicits._
import docspell.analysis.TextAnalyser
import docspell.common._
import docspell.scheduler._

View File

@ -9,16 +9,17 @@ package docspell.joex.notify
import cats.data.NonEmptyList
import cats.effect._
import cats.implicits._
import docspell.backend.ops.ONotification
import docspell.common._
import docspell.scheduler.Context
import docspell.scheduler.Task
import docspell.notification.api.EventContext
import docspell.notification.api.NotificationChannel
import docspell.notification.api.PeriodicDueItemsArgs
import docspell.query.Date
import docspell.query.ItemQuery._
import docspell.query.ItemQueryDsl._
import docspell.scheduler.Context
import docspell.scheduler.Task
import docspell.store.Store
import docspell.store.qb.Batch
import docspell.store.queries.ListItem

View File

@ -10,10 +10,9 @@ import cats.data.OptionT
import cats.data.{NonEmptyList => Nel}
import cats.effect._
import cats.implicits._
import docspell.backend.ops.ONotification
import docspell.common._
import docspell.scheduler.Context
import docspell.scheduler.Task
import docspell.notification.api.EventContext
import docspell.notification.api.NotificationChannel
import docspell.notification.api.PeriodicQueryArgs
@ -21,6 +20,8 @@ import docspell.query.ItemQuery
import docspell.query.ItemQuery.Expr
import docspell.query.ItemQuery.Expr.AndExpr
import docspell.query.ItemQueryParser
import docspell.scheduler.Context
import docspell.scheduler.Task
import docspell.store.Store
import docspell.store.qb.Batch
import docspell.store.queries.ListItem

View File

@ -9,10 +9,11 @@ package docspell.joex.pagecount
import cats.effect._
import cats.implicits._
import fs2.{Chunk, Stream}
import docspell.backend.JobFactory
import docspell.backend.ops.OJoex
import docspell.common._
import docspell.scheduler.{Context, Job, JobStore, Task}
import docspell.scheduler._
import docspell.store.Store
import docspell.store.records.RAttachment

View File

@ -8,6 +8,7 @@ package docspell.joex.pagecount
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.joex.process.AttachmentPageCount
import docspell.scheduler.Context

View File

@ -9,9 +9,10 @@ package docspell.joex.pdfconv
import cats.effect._
import cats.implicits._
import fs2.{Chunk, Stream}
import docspell.backend.ops.OJoex
import docspell.common._
import docspell.scheduler.{Context, Job, JobStore, Task}
import docspell.scheduler._
import docspell.store.Store
import docspell.store.records.RAttachment

View File

@ -11,6 +11,7 @@ import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.convert.ConversionResult
import docspell.convert.extern.OcrMyPdf
@ -18,6 +19,7 @@ import docspell.joex.Config
import docspell.scheduler.{Context, Task}
import docspell.store.Store
import docspell.store.records._
import io.circe.generic.semiauto._
import io.circe.{Decoder, Encoder}

View File

@ -9,11 +9,12 @@ package docspell.joex.preview
import cats.effect._
import cats.implicits._
import fs2.{Chunk, Stream}
import docspell.backend.JobFactory
import docspell.backend.ops.OJoex
import docspell.common.MakePreviewArgs.StoreMode
import docspell.common._
import docspell.scheduler.{Context, Job, JobStore, Task}
import docspell.scheduler._
import docspell.store.Store
import docspell.store.records.RAttachment

View File

@ -8,6 +8,7 @@ package docspell.joex.preview
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.extract.pdfbox.PdfboxPreview
import docspell.extract.pdfbox.PreviewConfig

View File

@ -11,6 +11,7 @@ import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.extract.pdfbox.PdfMetaData
import docspell.extract.pdfbox.PdfboxExtract

View File

@ -11,6 +11,7 @@ import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.extract.pdfbox.PdfboxPreview
import docspell.extract.pdfbox.PreviewConfig

View File

@ -11,6 +11,7 @@ import cats.data.{Kleisli, OptionT}
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.convert.ConversionResult.Handler
import docspell.convert.SanitizeHtml

View File

@ -11,6 +11,7 @@ import cats.data.OptionT
import cats.effect.Sync
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.scheduler.{Context, Task}
import docspell.store.Store

View File

@ -10,9 +10,10 @@ import cats.data.NonEmptyList
import cats.data.OptionT
import cats.effect.Sync
import cats.implicits._
import docspell.common._
import docspell.scheduler.Task
import docspell.logging.Logger
import docspell.scheduler.Task
import docspell.store.Store
/** After candidates have been determined, the set is reduced by doing some cross checks.

View File

@ -8,12 +8,14 @@ package docspell.joex.process
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.scheduler.{Context, Task}
import docspell.store.Store
import docspell.store.queries.QItem
import docspell.store.records.RFileMeta
import docspell.store.records.RJob
import doobie._
object DuplicateCheck {

View File

@ -7,8 +7,10 @@
package docspell.joex.process
import java.time.{LocalDate, Period}
import cats.effect.Sync
import cats.implicits._
import docspell.common._
import docspell.scheduler.Task
import docspell.store.Store

View File

@ -14,12 +14,14 @@ import cats.implicits._
import cats.kernel.Monoid
import cats.kernel.Order
import fs2.Stream
import docspell.common._
import docspell.files.Zip
import docspell.joex.mail._
import docspell.scheduler._
import docspell.store.Store
import docspell.store.records._
import emil.Mail
/** Goes through all attachments and extracts archive files, like zip files. The process

View File

@ -7,9 +7,11 @@
package docspell.joex.process
import java.time.ZoneId
import cats.effect.Sync
import cats.implicits._
import cats.{Applicative, FlatMap}
import docspell.analysis.contact._
import docspell.common.MetaProposal.Candidate
import docspell.common._

View File

@ -10,6 +10,7 @@ import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.analysis.TextAnalyser
import docspell.backend.ops.OItem
import docspell.common.{ItemState, ProcessItemArgs}

View File

@ -9,6 +9,7 @@ package docspell.joex.process
import cats.data.NonEmptyList
import cats.effect.Sync
import cats.implicits._
import docspell.common._
import docspell.scheduler.{Context, Task}
import docspell.store.Store

View File

@ -8,6 +8,7 @@ package docspell.joex.process
import cats.effect._
import cats.implicits._
import docspell.analysis.TextAnalyser
import docspell.backend.ops.OItem
import docspell.common.ProcessItemArgs

View File

@ -9,6 +9,7 @@ package docspell.joex.process
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.analysis.TextAnalyser
import docspell.backend.ops.OItem
import docspell.common._

View File

@ -8,10 +8,11 @@ package docspell.joex.process
import cats.effect.Sync
import cats.implicits._
import docspell.common._
import docspell.scheduler.{Context, Task}
import docspell.store.{AddResult, Store}
import docspell.store.records._
import docspell.store.{AddResult, Store}
/** Saves the proposals in the database */
object SaveProposals {

View File

@ -9,6 +9,7 @@ package docspell.joex.process
import cats.Traverse
import cats.effect._
import cats.implicits._
import docspell.analysis.classifier.TextClassifier
import docspell.analysis.{NlpSettings, TextAnalyser}
import docspell.common.MetaProposal.Candidate

View File

@ -9,6 +9,7 @@ package docspell.joex.process
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.extract.{ExtractConfig, ExtractResult, Extraction}
import docspell.ftsclient.{FtsClient, TextData}

View File

@ -12,15 +12,17 @@ import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2._
import docspell.backend.ops.{OJoex, OUpload}
import docspell.common._
import docspell.joex.Config
import docspell.scheduler.{Context, Task}
import docspell.logging.Logger
import docspell.scheduler.{Context, Task}
import docspell.store.Store
import docspell.store.queries.QOrganization
import docspell.store.records._
import _root_.io.circe.syntax._
import docspell.store.Store
import emil.SearchQuery.{All, ReceivedDate}
import emil.javamail.syntax._
import emil.{MimeType => _, _}

View File

@ -9,11 +9,13 @@ package docspell.joex.updatecheck
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.scheduler.Task
import docspell.scheduler.usertask.UserTask
import docspell.store.Store
import docspell.store.records.RUserEmail
import emil._
object UpdateCheckTask {

View File

@ -9,6 +9,7 @@ package docspell.restserver
import cats.effect._
import fs2.Stream
import fs2.concurrent.Topic
import docspell.backend.BackendApp
import docspell.backend.auth.{AuthToken, ShareToken}
import docspell.ftsclient.FtsClient
@ -24,6 +25,7 @@ import docspell.restserver.webapp.{TemplateRoutes, Templates, WebjarRoutes}
import docspell.restserver.ws.{OutputEvent, WebSocketRoutes}
import docspell.scheduler.impl.JobStoreModuleBuilder
import docspell.store.Store
import emil.javamail.JavaMailEmil
import org.http4s.HttpRoutes
import org.http4s.client.Client

View File

@ -9,6 +9,7 @@ package docspell.restserver
import cats.effect.Async
import fs2.Stream
import fs2.concurrent.Topic
import docspell.pubsub.api.PubSubT
import docspell.restserver.ws.OutputEvent
import docspell.scheduler.msg.{JobDone, JobSubmitted}

View File

@ -9,6 +9,7 @@ package docspell.restserver.routes
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.backend.BackendApp
import docspell.backend.MailAddressCodec
import docspell.backend.auth.AuthToken
@ -19,6 +20,7 @@ import docspell.restserver.Config
import docspell.restserver.conv.{Conversions, NonEmptyListSupport}
import docspell.restserver.http4s.ClientRequestInfo
import docspell.scheduler.usertask._
import org.http4s._
import org.http4s.circe.CirceEntityDecoder._
import org.http4s.circe.CirceEntityEncoder._

View File

@ -9,6 +9,7 @@ package docspell.restserver.routes
import cats.data.{NonEmptyList, OptionT}
import cats.effect._
import cats.implicits._
import docspell.backend.BackendApp
import docspell.backend.MailAddressCodec
import docspell.backend.auth.AuthToken
@ -20,6 +21,7 @@ import docspell.restserver.Config
import docspell.restserver.conv.{Conversions, NonEmptyListSupport}
import docspell.restserver.http4s.ClientRequestInfo
import docspell.scheduler.usertask._
import org.http4s._
import org.http4s.circe.CirceEntityDecoder._
import org.http4s.circe.CirceEntityEncoder._

View File

@ -9,12 +9,14 @@ package docspell.restserver.routes
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import docspell.backend.BackendApp
import docspell.backend.auth.AuthToken
import docspell.common._
import docspell.restapi.model._
import docspell.restserver.conv.Conversions
import docspell.scheduler.usertask._
import org.http4s._
import org.http4s.circe.CirceEntityDecoder._
import org.http4s.circe.CirceEntityEncoder._

View File

@ -1,8 +1,16 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler
import cats.effect.Sync
import cats.syntax.functor._
import docspell.common._
import io.circe.Encoder
final case class Job[A](

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler
trait JobStore[F[_]] {

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler
import docspell.scheduler.usertask.UserTaskStore

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler
trait SchedulerModule[F[_]] {

View File

@ -8,6 +8,7 @@ package docspell.scheduler.msg
import docspell.common._
import docspell.pubsub.api.{Topic, TypedTopic}
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder}

View File

@ -8,6 +8,7 @@ package docspell.scheduler.msg
import docspell.common._
import docspell.pubsub.api.{Topic, TypedTopic}
import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
import io.circe.{Decoder, Encoder}

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.msg
import docspell.pubsub.api.{Topic, TypedTopic}

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.msg
import docspell.pubsub.api.{Topic, TypedTopic}

View File

@ -6,8 +6,9 @@
package docspell.scheduler.usertask
import com.github.eikek.calev.CalEvent
import docspell.common._
import com.github.eikek.calev.CalEvent
import io.circe.Encoder
final case class UserTask[A](

View File

@ -7,8 +7,10 @@
package docspell.scheduler.usertask
import cats.data.OptionT
import docspell.common._
import fs2.Stream
import docspell.common._
import io.circe._
/** User tasks are `RPeriodicTask`s that can be managed by the user. The user can change

View File

@ -7,6 +7,7 @@
package docspell.scheduler
import docspell.common.Priority
import munit._
class CountingSchemeSpec extends FunSuite {

View File

@ -1,8 +1,14 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats._
import cats.syntax.all._
import cats.effect._
import cats.syntax.all._
import docspell.common._
import docspell.logging.Logger

View File

@ -8,6 +8,7 @@ package docspell.scheduler.impl
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.store.Store
import docspell.store.queries.QJob

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.effect.Sync
@ -5,7 +11,6 @@ import cats.syntax.all._
import docspell.common.Timestamp
import docspell.scheduler._
import docspell.store.Store
import docspell.store.records.RJob

View File

@ -1,3 +1,9 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.effect.Async

View File

@ -8,12 +8,13 @@ package docspell.scheduler.impl
import cats.effect._
import cats.implicits._
import fs2.Pipe
import docspell.common._
import docspell.logging
import docspell.scheduler.LogEvent
import docspell.store.Store
import docspell.store.records.RJobLog
import fs2.Pipe
trait LogSink[F[_]] {

View File

@ -1,9 +1,16 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.effect._
import fs2.concurrent.SignallingRef
import docspell.pubsub.api.PubSubT
import docspell.scheduler._
import fs2.concurrent.SignallingRef
object PeriodicSchedulerBuilder {

View File

@ -10,12 +10,14 @@ import cats.effect._
import cats.implicits._
import fs2._
import fs2.concurrent.SignallingRef
import docspell.common._
import docspell.pubsub.api.PubSubT
import docspell.scheduler._
import docspell.scheduler.impl.PeriodicSchedulerImpl.State
import docspell.scheduler.msg.{JobsNotify, PeriodicTaskNotify}
import docspell.store.records.RPeriodicTask
import eu.timepit.fs2cron.calev.CalevScheduler
final class PeriodicSchedulerImpl[F[_]: Async](

View File

@ -8,6 +8,7 @@ package docspell.scheduler.impl
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.scheduler.{Job, JobStore}
import docspell.store.queries.QPeriodicTask

View File

@ -1,16 +1,24 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.effect.Sync
import cats.syntax.all._
import com.github.eikek.calev.CalEvent
import docspell.common.{AccountId, Ident, Priority, Timestamp}
import fs2.Stream
import docspell.common._
import docspell.scheduler.usertask.{UserTask, UserTaskScope}
import docspell.store.qb.DML
import docspell.store.qb.DSL._
import docspell.store.records.RPeriodicTask
import fs2.Stream
import io.circe.{Decoder, Encoder}
import com.github.eikek.calev.CalEvent
import doobie._
import io.circe.{Decoder, Encoder}
object QUserTask {
private val RT = RPeriodicTask.T

View File

@ -1,13 +1,20 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.syntax.all._
import cats.effect.std.Queue
import cats.effect.{Async, Sync}
import cats.syntax.all._
import fs2.Stream
import docspell.common.{Ident, LogLevel}
import docspell.logging
import docspell.logging.{Level, Logger}
import docspell.scheduler.LogEvent
import fs2.Stream
object QueueLogger {

View File

@ -10,9 +10,10 @@ import cats.effect._
import cats.effect.std.Semaphore
import cats.implicits._
import fs2.concurrent.SignallingRef
import docspell.scheduler._
import docspell.notification.api.EventSink
import docspell.pubsub.api.PubSubT
import docspell.scheduler._
import docspell.store.Store
case class SchedulerBuilder[F[_]: Async](

View File

@ -12,16 +12,18 @@ import cats.effect.std.Semaphore
import cats.implicits._
import fs2.Stream
import fs2.concurrent.SignallingRef
import docspell.scheduler.msg.{CancelJob, JobDone, JobsNotify}
import docspell.common._
import docspell.scheduler._
import docspell.scheduler.impl.SchedulerImpl._
import docspell.notification.api.Event
import docspell.notification.api.EventSink
import docspell.pubsub.api.PubSubT
import docspell.scheduler._
import docspell.scheduler.impl.SchedulerImpl._
import docspell.scheduler.msg.{CancelJob, JobDone, JobsNotify}
import docspell.store.Store
import docspell.store.queries.QJob
import docspell.store.records.RJob
import io.circe.Json
final class SchedulerImpl[F[_]: Async](

View File

@ -1,13 +1,15 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.effect._
import docspell.common.Ident
import docspell.scheduler.{
JobTaskRegistry,
PeriodicSchedulerConfig,
SchedulerConfig,
SchedulerModule
}
import docspell.scheduler._
case class SchedulerModuleBuilder[F[_]: Async] private (
periodicSchedulerConfig: PeriodicSchedulerConfig,

View File

@ -1,15 +1,23 @@
/*
* Copyright 2020 Eike K. & Contributors
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
package docspell.scheduler.impl
import cats.effect._
import docspell.scheduler.usertask.UserTaskStore
import cats.data.OptionT
import cats.effect._
import cats.implicits._
import fs2.Stream
import docspell.common._
import docspell.scheduler.impl.QUserTask.UserTaskCodec
import docspell.scheduler.usertask.UserTaskStore
import docspell.scheduler.usertask._
import docspell.store.{AddResult, Store}
import fs2.Stream
import io.circe._
import QUserTask.UserTaskCodec
final class UserTaskStoreImpl[F[_]: Sync](
store: Store[F],

View File

@ -9,9 +9,11 @@ package docspell.store.records
import cats.data.NonEmptyList
import cats.effect._
import cats.implicits._
import docspell.common._
import docspell.store.qb.DSL._
import docspell.store.qb._
import com.github.eikek.calev.CalEvent
import doobie._
import doobie.implicits._