Interface IngestionRunRepository

  • All Known Implementing Classes:
    DefaultIngestionRunRepository

    public interface IngestionRunRepository
    A repository for basic storage of the ingestion run information. This repository should only be used for logging purposes.
    • Method Detail

      • startRun

        String startRun​(String resourceIngestionDefinitionId,
                        String ingestionConfigurationId,
                        String ingestionProcessId,
                        Variant metadata)
        Starts a new ingestion run with the provided definition id, configuration id, process id, and metadata.
        Parameters:
        resourceIngestionDefinitionId - resource ingestion definition id
        ingestionConfigurationId - ingestion configuration definition id
        ingestionProcessId - ingestion process id
        metadata - ingestion run metadata
        Returns:
        id of the started ingestion run
        Throws:
        IngestionRunsReferenceException - if insufficient ingestion information is provided
      • startRun

        default String startRun​(String resourceIngestionDefinitionId,
                                String ingestionConfigurationId,
                                Variant metadata)
        Starts a new ingestion run with the provided definition id, configuration id, and metadata.

        No ingestion process id is used for the new ingestion run.

        Parameters:
        resourceIngestionDefinitionId - resource ingestion definition id
        ingestionConfigurationId - ingestion configuration definition id
        metadata - ingestion run metadata
        Returns:
        id of the started ingestion run
        Throws:
        IngestionRunsReferenceException - if insufficient ingestion information is provided
      • endRun

        void endRun​(String id,
                    IngestionRun.IngestionStatus status,
                    Long ingestedRows,
                    IngestionRunRepository.Mode mode,
                    Variant metadata)
        Ends the specified ingestion run, setting the run status, number of ingested rows, and metadata.
        Parameters:
        id - ingestion run id
        status - ingestion run status
        ingestedRows - number of ingested rows
        mode - specifies how the number of ingested rows will be persisted
        metadata - ingestion run metadata
        Throws:
        IngestionRunsBadStatusException - if the provided status cannot be used when ending an ingestion run
      • endRun

        default void endRun​(String id,
                            IngestionRun.IngestionStatus status,
                            Long ingestedRows,
                            Variant metadata)
        Ends the specified ingestion run, setting the run status, number of ingested rows, and metadata.

        The currently persisted number of ingested rows will be overwritten by the provided value.

        Parameters:
        id - ingestion run id
        status - ingestion run status
        ingestedRows - number of ingested rows
        metadata - ingestion run metadata
        Throws:
        IngestionRunsBadStatusException - if the provided status cannot be used when ending an ingestion run
      • updateIngestedRows

        void updateIngestedRows​(String id,
                                Long ingestedRows,
                                IngestionRunRepository.Mode mode)
        Updates the number of ingested rows for the specified ingestion run.
        Parameters:
        id - ingestion run id
        ingestedRows - number of ingested rows
        mode - specifies how the number of ingested rows will be persisted
        Throws:
        IngestionRunsUpdateException - if the specified ingestion run does not exist
      • updateIngestedRows

        default void updateIngestedRows​(String id,
                                        Long ingestedRows)
        Updates the number of ingested rows for the specified ingestion run.

        The currently persisted number of ingested rows will be overwritten by the provided value.

        Parameters:
        id - ingestion run id
        ingestedRows - number of ingested rows
        Throws:
        IngestionRunsUpdateException - if the specified ingestion run does not exist
      • findById

        Optional<IngestionRun> findById​(String id)
        Finds an ingestion run with the specified id.
        Parameters:
        id - id of the ingestion run
        Returns:
        ingestion run with the specified id
      • fetchAllByResourceId

        List<IngestionRun> fetchAllByResourceId​(String resourceIngestionDefinitionId)
        Fetches all ingestion runs created for the specified resource ingestion definition id.
        Parameters:
        resourceIngestionDefinitionId - resource ingestion definition id
        Returns:
        all ingestion runs created for the specified resource ingestion definition id
      • fetchAllByProcessId

        List<IngestionRun> fetchAllByProcessId​(String processId)
        Fetches all ingestion runs created for the specified ingestion process id.
        Parameters:
        processId - ingestion process id
        Returns:
        all ingestion runs created for the specified ingestion process id
      • getInstance

        static IngestionRunRepository getInstance​(Session session)
        Returns a new instance of the default repository implementation.

        Default implementation of the repository uses the STATE.INGESTION_RUN table.

        Default implementation of the repository also implements additional methods from the CrudIngestionRunRepository interface.

        Parameters:
        session - Snowpark session object
        Returns:
        a new repository instance