jerqi commented on code in PR #7330:
URL: https://github.com/apache/gravitino/pull/7330#discussion_r2126511793
##########
core/src/main/java/org/apache/gravitino/cache/BaseEntityCache.java:
##########
@@ -153,6 +154,48 @@ protected static <E extends Entity & HasIdentifier> E
convertEntity(Entity entit
return (E) entity;
}
+ /**
+ * Loads an entity from the database.
+ *
+ * @param ident The name identifier of the entity to load.
+ * @param type The type of the entity to load.
+ * @return The loaded entity.
+ * @param <E> The type of the loaded entity.
+ * @throws IOException if an error occurs while loading the entity.
+ */
+ protected <E extends Entity & HasIdentifier> E loadEntity(
+ NameIdentifier ident, Entity.EntityType type) throws IOException {
+ Preconditions.checkArgument(
+ entityStore != null,
+ "EntityStore must not be null if you want to get entities from " +
"db");
+
+ return entityStore.get(ident, type, getEntityClass(type));
+ }
+
+ /**
+ * Loads a list of entities related to the specified entity.
+ *
+ * @param ident The name identifier of the entity to load related entities
for.
+ * @param type The type of the entity to load related entities for.
+ * @param relType The type of the relation to load.
+ * @param allFields Whether to load all fields.
+ * @return A list of related entities.
+ * @param <E> The type of the related entities.
+ * @throws IOException if an error occurs while loading the entities.
+ */
+ protected <E extends Entity & HasIdentifier> List<E> loadEntitiesByRelation(
+ SupportsRelationOperations.Type relType,
+ NameIdentifier ident,
+ Entity.EntityType type,
+ boolean allFields)
+ throws IOException {
+ Preconditions.checkArgument(
+ entityStore != null,
+ "EntityStore must not be null if you want to get entities from " +
"db");
Review Comment:
ditto.
--
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]