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, @org.jspecify.annotations.NonNull byte[] serializedValue)
    • conditionalUpdate

      boolean conditionalUpdate(@NonNull String realmId, String objTypeId, @NonNull PersistId persistId, long createdAtMicros, @NonNull String updateToken, @NonNull String expectedToken, @org.jspecify.annotations.NonNull byte[] serializedValue)
    • conditionalDelete

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