Class AttestationResultService

java.lang.Object
com.suse.coco.attestation.AttestationResultService

public class AttestationResultService extends Object
Service class to handle AttestationResult in the database
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • sessionFactory

      private final org.apache.ibatis.session.SqlSessionFactory sessionFactory
  • Constructor Details

    • AttestationResultService

      public AttestationResultService()
      Default constructor.
    • AttestationResultService

      public AttestationResultService(org.apache.ibatis.session.SqlSessionFactory sessionFactoryIn)
      Build a services with the given session factory.
      Parameters:
      sessionFactoryIn - the sql session factory
  • Method Details

    • getPendingResultByType

      public List<Long> getPendingResultByType(Collection<Integer> resultTypeList, int batchSize)
      Retrieve the ids of the available attestation results with the given state and result type.
      Parameters:
      resultTypeList - a list of possible result types to match
      batchSize - the number of results to fetch at max
      Returns:
      the ids of the attestation results matching the criteria
    • processAttestationResult

      public void processAttestationResult(long id, AttestationWorker worker)
      Process an attestation result. The result is extracted from the database and locked for update.
      Parameters:
      id - the id of the attestation result
      worker - the worker processing the attestation result
    • lockAttestationResult

      private static AttestationResult lockAttestationResult(org.apache.ibatis.session.SqlSession session, long id)