Class DefaultIngestionProcessRepository
- java.lang.Object
-
- com.snowflake.connectors.application.ingestion.process.DefaultIngestionProcessRepository
-
- All Implemented Interfaces:
CrudIngestionProcessRepository,IngestionProcessRepository
public class DefaultIngestionProcessRepository extends Object implements IngestionProcessRepository, CrudIngestionProcessRepository
Default implementation ofIngestionProcessRepositoryandCrudIngestionProcessRepository.
-
-
Field Summary
Fields Modifier and Type Field Description static intEXPRESSION_LIMITMaximum limit of inserted/updated records.
-
Constructor Summary
Constructors Constructor Description DefaultIngestionProcessRepository(Session session)Creates a newDefaultIngestionProcessRepository.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcreateProcess(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type, String status, Variant metadata)Creates a new ingestion process.voiddeleteAllByResourceId(String resourceIngestionDefinitionId)Deletes ingestion processes with the specified resource ingestion definition id.voidendProcess(String processId)Ends an ingestion process with the specified id.voidendProcess(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)Ends an ingestion process with the specified resource ingestion definition id, ingestion configuration, and process type.Optional<IngestionProcess>fetch(String processId)Fetches an ingestion process by the specified id.List<IngestionProcess>fetchAll(String status)Fetches all ingestion processes with the specified status.List<IngestionProcess>fetchAll(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)Fetches all ingestion processes with the specified resource ingestion definition id, ingestion configuration, and process type.List<IngestionProcess>fetchAll(List<String> resourceIngestionDefinitionIds)Fetches all ingestion processes with resource ingestion definition id contained within the specified list of ids.List<IngestionProcess>fetchAllActive(String resourceIngestionDefinitionId)Fetches all ingestion processes with the specified resource ingestion definition id and statuses:IngestionProcessStatuses.SCHEDULED,IngestionProcessStatuses.IN_PROGRESS.List<IngestionProcess>fetchAllById(List<String> processIds)Fetches all ingestion processes by the specified ids.List<IngestionProcess>fetchLastFinished(String resourceIngestionDefinitionId, String ingestionConfigurationId)Fetches ingestion processes with the latest finishedAt date, status = FINISHED and distinct process type.Optional<IngestionProcess>fetchLastFinished(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)Fetches an ingestion process with the latest finishedAt date and status = FINISHEDvoidsave(IngestionProcess process)Saves the specified ingestion process.voidsave(Collection<IngestionProcess> ingestionProcesses)Saves the specified ingestion processes.voidupdateStatus(String processId, String status)Updates the status of an ingestion process with the specified id.voidupdateStatus(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type, String status)Updates the status of an ingestion process with the specified resource ingestion definition id, ingestion configuration, and process type.
-
-
-
Field Detail
-
EXPRESSION_LIMIT
public static final int EXPRESSION_LIMIT
Maximum limit of inserted/updated records.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultIngestionProcessRepository
public DefaultIngestionProcessRepository(Session session)
Creates a newDefaultIngestionProcessRepository.- Parameters:
session- Snowpark session object
-
-
Method Detail
-
createProcess
public String createProcess(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type, String status, Variant metadata)
Description copied from interface:IngestionProcessRepositoryCreates a new ingestion process.- Specified by:
createProcessin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition idingestionConfigurationId- ingestion configuration idtype- process typestatus-initial process statusmetadata- process metadata- Returns:
- id of the created process
-
updateStatus
public void updateStatus(String processId, String status)
Updates the status of an ingestion process with the specified id. This implementation assumes that process cannot be inFINISHEDstatus andfinished_attimestamp must be null to perform the update.- Specified by:
updateStatusin interfaceIngestionProcessRepository- Parameters:
processId- process idstatus-new process status- Throws:
IngestionProcessUpdateException- if no rows were updated or more than 1 row was updated
-
updateStatus
public void updateStatus(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type, String status)
Updates the status of an ingestion process with the specified resource ingestion definition id, ingestion configuration, and process type.This update method is not recommended, as technically multiple processes can fit the specified criteria. It should only be used when the status update is a part of a resource update. This implementation assumes that process cannot be in
FINISHEDstatus andfinished_attimestamp must be null to perform the update.- Specified by:
updateStatusin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition idingestionConfigurationId- ingestion configuration idtype- process typestatus- new process status- Throws:
IngestionProcessUpdateException- if no rows were updated
-
endProcess
public void endProcess(String processId)
Ends an ingestion process with the specified id.The ending of the process will set the status to a terminal value and update the process' finishedAt timestamp. This implementation assumes that process cannot be in
FINISHEDstatus andfinished_attimestamp must be null to perform the update.- Specified by:
endProcessin interfaceIngestionProcessRepository- Parameters:
processId- process id- Throws:
IngestionProcessUpdateException- if no rows were updated or more than 1 row was updated
-
endProcess
public void endProcess(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)
Ends an ingestion process with the specified resource ingestion definition id, ingestion configuration, and process type.This update method is not recommended, as technically multiple processes can fit the specified criteria. It should only be used when the status update is a part of a resource update.
The ending of the process will set the status to a terminal value and update the process' finishedAt timestamp. This implementation assumes that process cannot be in
FINISHEDstatus andfinished_attimestamp must be null to perform the update.- Specified by:
endProcessin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition idingestionConfigurationId- ingestion configuration idtype- process type- Throws:
IngestionProcessUpdateException- if no rows were updated
-
fetch
public Optional<IngestionProcess> fetch(String processId)
Description copied from interface:IngestionProcessRepositoryFetches an ingestion process by the specified id.- Specified by:
fetchin interfaceCrudIngestionProcessRepository- Specified by:
fetchin interfaceIngestionProcessRepository- Parameters:
processId- process id- Returns:
- ingestion process with the specified id
-
fetchAllById
public List<IngestionProcess> fetchAllById(List<String> processIds)
Description copied from interface:IngestionProcessRepositoryFetches all ingestion processes by the specified ids.- Specified by:
fetchAllByIdin interfaceIngestionProcessRepository- Parameters:
processIds- List of process ids- Returns:
- ingestion processes with the specified ids
-
fetchLastFinished
public Optional<IngestionProcess> fetchLastFinished(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)
Description copied from interface:IngestionProcessRepositoryFetches an ingestion process with the latest finishedAt date and status = FINISHED- Specified by:
fetchLastFinishedin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition idingestionConfigurationId- ingestion configuration idtype- process type- Returns:
- ingestion process with the specified id
-
fetchLastFinished
public List<IngestionProcess> fetchLastFinished(String resourceIngestionDefinitionId, String ingestionConfigurationId)
Description copied from interface:IngestionProcessRepositoryFetches ingestion processes with the latest finishedAt date, status = FINISHED and distinct process type.- Specified by:
fetchLastFinishedin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition idingestionConfigurationId- ingestion configuration id- Returns:
- ingestion process with the specified id
-
fetchAll
public List<IngestionProcess> fetchAll(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)
Description copied from interface:IngestionProcessRepositoryFetches all ingestion processes with the specified resource ingestion definition id, ingestion configuration, and process type.- Specified by:
fetchAllin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition idingestionConfigurationId- ingestion configuration idtype- process type- Returns:
- a list containing processes matching the specified criteria
-
fetchAllActive
public List<IngestionProcess> fetchAllActive(String resourceIngestionDefinitionId)
Description copied from interface:IngestionProcessRepositoryFetches all ingestion processes with the specified resource ingestion definition id and statuses:IngestionProcessStatuses.SCHEDULED,IngestionProcessStatuses.IN_PROGRESS.- Specified by:
fetchAllActivein interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition id- Returns:
- a list containing processes matching the specified criteria
-
save
public void save(IngestionProcess process)
Description copied from interface:CrudIngestionProcessRepositorySaves the specified ingestion process.- Specified by:
savein interfaceCrudIngestionProcessRepository- Parameters:
process- ingestion process
-
save
public void save(Collection<IngestionProcess> ingestionProcesses)
Description copied from interface:CrudIngestionProcessRepositorySaves the specified ingestion processes.- Specified by:
savein interfaceCrudIngestionProcessRepository- Parameters:
ingestionProcesses- ingestion processes
-
fetchAll
public List<IngestionProcess> fetchAll(List<String> resourceIngestionDefinitionIds)
Description copied from interface:CrudIngestionProcessRepositoryFetches all ingestion processes with resource ingestion definition id contained within the specified list of ids.- Specified by:
fetchAllin interfaceCrudIngestionProcessRepository- Parameters:
resourceIngestionDefinitionIds- resource ingestion definition ids- Returns:
- a list containing processes matching the specified criteria
-
fetchAll
public List<IngestionProcess> fetchAll(String status)
Description copied from interface:CrudIngestionProcessRepositoryFetches all ingestion processes with the specified status.- Specified by:
fetchAllin interfaceCrudIngestionProcessRepository- Parameters:
status- process status- Returns:
- a list containing all the processes matching the specified criteria
-
deleteAllByResourceId
public void deleteAllByResourceId(String resourceIngestionDefinitionId)
Description copied from interface:IngestionProcessRepositoryDeletes ingestion processes with the specified resource ingestion definition id.- Specified by:
deleteAllByResourceIdin interfaceIngestionProcessRepository- Parameters:
resourceIngestionDefinitionId- resource ingestion definition id
-
-