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 ofIngestionProcessRepository
andCrudIngestionProcessRepository
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
EXPRESSION_LIMIT
Maximum limit of inserted/updated records.
-
Constructor Summary
Constructors Constructor Description DefaultIngestionProcessRepository(Session session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createProcess(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type, String status, Variant metadata)
Creates a new ingestion process.void
endProcess(String processId)
Ends an ingestion process with the specified id.void
endProcess(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
.Optional<IngestionProcess>
fetchLastFinished(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)
Fetches an ingestion process with the latest finishedAt date and status = FINISHEDvoid
save(IngestionProcess process)
Saves the specified ingestion process.void
save(Collection<IngestionProcess> ingestionProcesses)
Saves the specified ingestion processes.void
updateStatus(String processId, String status)
Updates the status of an ingestion process with the specified id.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.
-
-
-
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)
-
-
Method Detail
-
createProcess
public String createProcess(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type, String status, Variant metadata)
Description copied from interface:IngestionProcessRepository
Creates a new ingestion process.- Specified by:
createProcess
in interfaceIngestionProcessRepository
- Parameters:
resourceIngestionDefinitionId
- resource ingestion definition idingestionConfigurationId
- ingestion configuration idtype
- process typestatus
-initial process status
metadata
- 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 inFINISHED
status andfinished_at
timestamp must be null to perform the update.- Specified by:
updateStatus
in 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
FINISHED
status andfinished_at
timestamp must be null to perform the update.- Specified by:
updateStatus
in 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
FINISHED
status andfinished_at
timestamp must be null to perform the update.- Specified by:
endProcess
in 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
FINISHED
status andfinished_at
timestamp must be null to perform the update.- Specified by:
endProcess
in 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:IngestionProcessRepository
Fetches an ingestion process by the specified id.- Specified by:
fetch
in interfaceCrudIngestionProcessRepository
- Specified by:
fetch
in interfaceIngestionProcessRepository
- Parameters:
processId
- process id- Returns:
- ingestion process with the specified id
-
fetchLastFinished
public Optional<IngestionProcess> fetchLastFinished(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)
Description copied from interface:IngestionProcessRepository
Fetches an ingestion process with the latest finishedAt date and status = FINISHED- Specified by:
fetchLastFinished
in interfaceIngestionProcessRepository
- Parameters:
resourceIngestionDefinitionId
- resource ingestion definition idingestionConfigurationId
- ingestion configuration idtype
- process type- Returns:
- ingestion process with the specified id
-
fetchAll
public List<IngestionProcess> fetchAll(String resourceIngestionDefinitionId, String ingestionConfigurationId, String type)
Description copied from interface:IngestionProcessRepository
Fetches all ingestion processes with the specified resource ingestion definition id, ingestion configuration, and process type.- Specified by:
fetchAll
in 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:IngestionProcessRepository
Fetches all ingestion processes with the specified resource ingestion definition id and statuses:IngestionProcessStatuses.SCHEDULED
,IngestionProcessStatuses.IN_PROGRESS
.- Specified by:
fetchAllActive
in 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:CrudIngestionProcessRepository
Saves the specified ingestion process.- Specified by:
save
in interfaceCrudIngestionProcessRepository
- Parameters:
process
- ingestion process
-
save
public void save(Collection<IngestionProcess> ingestionProcesses)
Description copied from interface:CrudIngestionProcessRepository
Saves the specified ingestion processes.- Specified by:
save
in interfaceCrudIngestionProcessRepository
- Parameters:
ingestionProcesses
- ingestion processes
-
fetchAll
public List<IngestionProcess> fetchAll(List<String> resourceIngestionDefinitionIds)
Description copied from interface:CrudIngestionProcessRepository
Fetches all ingestion processes with resource ingestion definition id contained within the specified list of ids.- Specified by:
fetchAll
in 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:CrudIngestionProcessRepository
Fetches all ingestion processes with the specified status.- Specified by:
fetchAll
in interfaceCrudIngestionProcessRepository
- Parameters:
status
- process status- Returns:
- a list containing all the processes matching the specified criteria
-
-