All Superinterfaces:
AutoCloseable

public interface Backend extends AutoCloseable
Provides "low-level" access to the database-specific backend.
  • Method Details

    • type

      @Nonnull String type()
      Name of this backend. This value serves as an identifier to select the correct backend.
    • setupSchema

      Optional<String> setupSchema()
      Called to set up the database schema.
      Returns:
      optional, human-readable information
    • newPersistence

      @Nonnull Persistence newPersistence(Function<Backend,Backend> backendWrapper, @Nonnull PersistenceParams persistenceParams, String realmId, org.apache.polaris.ids.api.MonotonicClock monotonicClock, org.apache.polaris.ids.api.IdGenerator idGenerator)
    • supportsRealmDeletion

      boolean supportsRealmDeletion()
      Whether the implementation supports deleteRealms(Set).
    • deleteRealms

      void deleteRealms(Set<String> realmIds)
      Delete the given realms.

      This function works, if supportsRealmDeletion() yields true.

      Throws an UnsupportedOperationException, if supportsRealmDeletion() yields false.

    • batchDeleteRefs

      void batchDeleteRefs(Map<String,Set<String>> realmRefs)
      Bulk reference deletion, grouped by realm. This functionality is primarily needed for the maintenance service.
    • batchDeleteObjs

      void batchDeleteObjs(Map<String,Set<PersistId>> realmObjs)
      Bulk object-part deletion, grouped by realm. This functionality is primarily needed for the maintenance service.
    • scanBackend

      void scanBackend(@Nonnull Backend.ReferenceScanCallback referenceConsumer, @Nonnull Backend.ObjScanCallback objConsumer)
      Scan the whole backend database and return each discovered reference and object-part via the provided callbacks. This functionality is primarily needed for the maintenance service.
    • createReference

      boolean createReference(@Nonnull String realmId, @Nonnull Reference newRef)
    • createReferences

      void createReferences(@Nonnull String realmId, @Nonnull List<Reference> newRefs)
    • updateReference

      boolean updateReference(@Nonnull String realmId, @Nonnull Reference updatedRef, @Nonnull Optional<ObjRef> expectedPointer)
    • fetchReference

      @Nonnull Reference fetchReference(@Nonnull String realmId, @Nonnull String name)
    • fetch

      @Nonnull Map<PersistId,FetchedObj> fetch(@Nonnull String realmId, @Nonnull Set<PersistId> ids)
    • write

      void write(@Nonnull String realmId, @Nonnull List<WriteObj> writes)
    • delete

      void delete(@Nonnull String realmId, @Nonnull Set<PersistId> ids)
    • conditionalInsert

      boolean conditionalInsert(@Nonnull String realmId, String objTypeId, @Nonnull PersistId persistId, long createdAtMicros, @Nonnull String versionToken, @Nonnull byte[] serializedValue)
    • conditionalUpdate

      boolean conditionalUpdate(@Nonnull String realmId, String objTypeId, @Nonnull PersistId persistId, long createdAtMicros, @Nonnull String updateToken, @Nonnull String expectedToken, @Nonnull byte[] serializedValue)
    • conditionalDelete

      boolean conditionalDelete(@Nonnull String realmId, @Nonnull PersistId persistId, @Nonnull String expectedToken)