huaxingao commented on code in PR #4397:
URL: https://github.com/apache/polaris/pull/4397#discussion_r3230589845


##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/MetaStoreManagerFactory.java:
##########
@@ -26,13 +26,59 @@
 import org.apache.polaris.core.persistence.cache.EntityCache;
 import org.apache.polaris.core.persistence.dao.entity.BaseResult;
 import org.apache.polaris.core.persistence.dao.entity.PrincipalSecretsResult;
+import org.apache.polaris.core.persistence.metrics.MetricsPersistence;
+import org.apache.polaris.core.policy.PolicyMappingPersistence;
 
 /** Configuration interface for configuring the {@link 
PolarisMetaStoreManager}. */
 public interface MetaStoreManagerFactory {
 
   PolarisMetaStoreManager getOrCreateMetaStoreManager(RealmContext 
realmContext);
 
-  BasePersistence getOrCreateSession(RealmContext realmContext);
+  /**
+   * Returns the per-realm {@link BasePersistence}. Backends implement this on 
the same concrete
+   * class as the other modular persistences (such as {@link 
PolicyMappingPersistence}, {@link
+   * MetricsPersistence}, and {@link IntegrationPersistence}); the 
corresponding typed accessors
+   * below default to casting that same instance.
+   */
+  BasePersistence getOrCreateBasePersistence(RealmContext realmContext);
+
+  /**
+   * Returns the per-realm {@link PolicyMappingPersistence}. The default 
implementation returns the
+   * same instance produced by {@link 
#getOrCreateBasePersistence(RealmContext)} when it also
+   * implements {@link PolicyMappingPersistence}.
+   */
+  default PolicyMappingPersistence 
getOrCreatePolicyMappingPersistence(RealmContext realmContext) {
+    return cast(getOrCreateBasePersistence(realmContext), 
PolicyMappingPersistence.class);

Review Comment:
   You comment makes sense. I have updated the PR accordingly. PTAL



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to