Interface RealmStore
public interface RealmStore
Interface to be implemented by persistence-specific implementations (NoSQL or metastore manager
based).
Implementations must not perform any validation of the realm definitions unless explicitly stated below.
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.polaris.persistence.nosql.realms.api.RealmDefinitionCreate a new realm.voiddelete(String realmId, Consumer<org.apache.polaris.persistence.nosql.realms.api.RealmDefinition> callback) Deletes a realm definition.Optional<org.apache.polaris.persistence.nosql.realms.api.RealmDefinition> Returns a realm definition if it exists.Stream<org.apache.polaris.persistence.nosql.realms.api.RealmDefinition> list()Returns a stream of all realm definitions.org.apache.polaris.persistence.nosql.realms.api.RealmDefinitionupdate(String realmId, Function<org.apache.polaris.persistence.nosql.realms.api.RealmDefinition, org.apache.polaris.persistence.nosql.realms.api.RealmDefinition> updater) Updates a realm definition.
-
Method Details
-
list
Returns a stream of all realm definitions. The returned stream must be closed. -
get
Returns a realm definition if it exists.Unlike the updating functions, this function does not throw an exception if a realm does not exist.
-
delete
void delete(String realmId, Consumer<org.apache.polaris.persistence.nosql.realms.api.RealmDefinition> callback) Deletes a realm definition.- Parameters:
callback- receives the persisted realm definition that is being deleted. If the callback throws any exception, the delete operation must not be persisted. All thrown exceptions must be propagated to the caller.- Throws:
org.apache.polaris.persistence.nosql.realms.api.RealmNotFoundException- if a realm with the given ID does not exist
-
update
org.apache.polaris.persistence.nosql.realms.api.RealmDefinition update(String realmId, Function<org.apache.polaris.persistence.nosql.realms.api.RealmDefinition, org.apache.polaris.persistence.nosql.realms.api.RealmDefinition> updater) Updates a realm definition.Implementations update the persisted state of the realm definition. The created timestamp must be carried forwards from the persisted state.
RealmManagementimplementations, which call this function, take care of "properly" populating the attributes of the realm definition to persist.- Parameters:
updater- receives the current definition and returns the updated definition. If the updated throws any exception, the update operation must not be persisted. All thrown exceptions must be propagated to the caller.- Returns:
- the persisted realm definition
- Throws:
org.apache.polaris.persistence.nosql.realms.api.RealmNotFoundException- if a realm with the given ID does not exist
-
create
org.apache.polaris.persistence.nosql.realms.api.RealmDefinition create(String realmId, org.apache.polaris.persistence.nosql.realms.api.RealmDefinition definition) Create a new realm.RealmManagementimplementations, which call this function, take care of "properly" populating the attributes of the realm definition to persist.- Parameters:
definition- the realm definition of the realm to be created, to be persisted as given.- Returns:
- the persisted realm definition
- Throws:
org.apache.polaris.persistence.nosql.realms.api.RealmAlreadyExistsException- if the realm already exists
-