Class CrawlSessionRepository
java.lang.Object
ai.pipeline.connector.intake.repository.CrawlSessionRepository
- All Implemented Interfaces:
io.quarkus.hibernate.orm.panache.PanacheRepository<CrawlSession>, io.quarkus.hibernate.orm.panache.PanacheRepositoryBase<CrawlSession, Long>
@ApplicationScoped
public class CrawlSessionRepository
extends Object
implements io.quarkus.hibernate.orm.panache.PanacheRepository<CrawlSession>
Repository for crawl session operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBytesProcessed(String sessionId, long bytes) Add the number of processed bytes to the session total.voidcompleteSession(String sessionId, String state) Mark a session as completed and set its terminal state.findByAccountId(String accountId) Find all sessions for an account.findByDatasourceAndCrawl(String datasourceId, String crawlId) Find a session by datasource ID and crawl ID.findByDatasourceId(String datasourceId) Find all sessions for a datasource.Find a session by its unique identifier.findByState(String state) Find sessions by state.findStaleSessions(OffsetDateTime cutoffTime) Find running sessions whose last heartbeat is older than the cutoff time.voidincrementDocumentsFailed(String sessionId) Increment the counter of documents that failed processing for the session.voidincrementDocumentsFound(String sessionId) Increment the counter of documents discovered for the session.voidincrementDocumentsProcessed(String sessionId) Increment the counter of documents successfully processed for the session.voidincrementDocumentsSkipped(String sessionId) Increment the counter of documents skipped (not processed) for the session.voidupdateHeartbeat(String sessionId) Update the last heartbeat timestamp for a session to the current time.voidupdateState(String sessionId, String state) Update the persisted state for a session.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.quarkus.hibernate.orm.panache.PanacheRepositoryBase
count, count, count, count, delete, delete, delete, delete, deleteAll, deleteById, find, find, find, find, find, find, findAll, findAll, findById, findById, findByIdOptional, findByIdOptional, findByIds, flush, getEntityManager, getSession, isPersistent, list, list, list, list, list, list, listAll, listAll, persist, persist, persist, persist, persistAndFlush, stream, stream, stream, stream, stream, stream, streamAll, streamAll, update, update, update
-
Constructor Details
-
CrawlSessionRepository
public CrawlSessionRepository()Default constructor for CDI.
-
-
Method Details
-
findById
Find a session by its unique identifier.- Parameters:
sessionId- session UUID- Returns:
- an
Optionalwith theCrawlSessionif found; otherwise empty
-
findByDatasourceAndCrawl
Find a session by datasource ID and crawl ID.- Parameters:
datasourceId- datasource identifiercrawlId- client-provided crawl identifier- Returns:
- an
Optionalwith theCrawlSessionif found; otherwise empty
-
findByDatasourceId
Find all sessions for a datasource.- Parameters:
datasourceId- datasource identifier- Returns:
- list of sessions owned by the datasource (possibly empty)
-
findByAccountId
Find all sessions for an account.- Parameters:
accountId- account identifier- Returns:
- list of sessions for the account (possibly empty)
-
findByState
Find sessions by state.- Parameters:
state- session state (e.g., RUNNING, COMPLETED, FAILED)- Returns:
- list of sessions in the given state (possibly empty)
-
findStaleSessions
Find running sessions whose last heartbeat is older than the cutoff time.- Parameters:
cutoffTime- sessions withlastHeartbeat < cutoffTimeare considered stale- Returns:
- list of sessions in RUNNING state that appear stale (possibly empty)
-
updateState
-
updateHeartbeat
Update the last heartbeat timestamp for a session to the current time.- Parameters:
sessionId- session UUID
-
incrementDocumentsFound
Increment the counter of documents discovered for the session.- Parameters:
sessionId- session UUID
-
incrementDocumentsProcessed
Increment the counter of documents successfully processed for the session.- Parameters:
sessionId- session UUID
-
incrementDocumentsFailed
Increment the counter of documents that failed processing for the session.- Parameters:
sessionId- session UUID
-
incrementDocumentsSkipped
Increment the counter of documents skipped (not processed) for the session.- Parameters:
sessionId- session UUID
-
addBytesProcessed
Add the number of processed bytes to the session total.- Parameters:
sessionId- session UUIDbytes- number of bytes to add (non-negative)
-
completeSession
-