in polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/TreeMapMetaStore.java [225:301]
public TreeMapMetaStore(@Nonnull PolarisDiagnostics diagnostics) {
// the entities slice
this.sliceEntities =
new Slice<>(
entity -> String.format("%d::%d", entity.getCatalogId(), entity.getId()),
PolarisBaseEntity::new);
// the entities active slice; simply acts as a name-based index into the entities slice
this.sliceEntitiesActive = new Slice<>(this::buildEntitiesActiveKey, PolarisBaseEntity::new);
// change tracking
this.sliceEntitiesChangeTracking =
new Slice<>(
entity -> String.format("%d::%d", entity.getCatalogId(), entity.getId()),
PolarisBaseEntity::new);
// grant records by securable
this.sliceGrantRecords =
new Slice<>(
grantRecord ->
String.format(
"%d::%d::%d::%d::%d",
grantRecord.getSecurableCatalogId(),
grantRecord.getSecurableId(),
grantRecord.getGranteeCatalogId(),
grantRecord.getGranteeId(),
grantRecord.getPrivilegeCode()),
PolarisGrantRecord::new);
// grant records by securable
this.sliceGrantRecordsByGrantee =
new Slice<>(
grantRecord ->
String.format(
"%d::%d::%d::%d::%d",
grantRecord.getGranteeCatalogId(),
grantRecord.getGranteeId(),
grantRecord.getSecurableCatalogId(),
grantRecord.getSecurableId(),
grantRecord.getPrivilegeCode()),
PolarisGrantRecord::new);
// principal secrets
slicePrincipalSecrets =
new Slice<>(
principalSecrets -> String.format("%s", principalSecrets.getPrincipalClientId()),
PolarisPrincipalSecrets::new);
this.slicePolicyMappingRecords =
new Slice<>(
policyMappingRecord ->
String.format(
"%d::%d::%d::%d::%d",
policyMappingRecord.getTargetCatalogId(),
policyMappingRecord.getTargetId(),
policyMappingRecord.getPolicyTypeCode(),
policyMappingRecord.getPolicyCatalogId(),
policyMappingRecord.getPolicyId()),
PolarisPolicyMappingRecord::new);
this.slicePolicyMappingRecordsByPolicy =
new Slice<>(
policyMappingRecord ->
String.format(
"%d::%d::%d::%d",
policyMappingRecord.getPolicyCatalogId(),
policyMappingRecord.getPolicyId(),
policyMappingRecord.getTargetCatalogId(),
policyMappingRecord.getTargetId()),
PolarisPolicyMappingRecord::new);
// no transaction open yet
this.diagnosticServices = diagnostics;
this.tr = null;
this.lock = new Object();
}