Feature/242 refactor datamanager architecture#256
Conversation
| @@ -0,0 +1,64 @@ | |||
| package fr.inria.corese.core.storage.api.dataManager.lifecycle; | |||
There was a problem hiding this comment.
Le package fr.inria.corese.core.storage.api.dataManager.lifecycle utilise une majuscule (dataManager). Pour respecter les conventions Java il est préférable d'utiliser uniquement des minuscules
| * @param config New configuration | ||
| * @throws DataManagerException if restart fails | ||
| */ | ||
| default void restart(DataManagerConfig config) throws DataManagerException { |
There was a problem hiding this comment.
Atomicité de restart() : La méthode par défaut enchaîne un shutdown() puis un initialize(). Si l'initialisation échoue, le composant reste arrêté et l'état précédent est perdu. Il serait plus robuste d'ajouter un bloc try-catch pour tenter de restaurer l'ancienne configuration en cas d'échec, ou au moins de documenter explicitement ce risque.
| void shutdown() throws DataManagerException; | ||
|
|
||
| /** | ||
| * Restarts the DataManager with a new configuration. |
There was a problem hiding this comment.
La Javadoc de restart(config) devrait mentionner qu'elle lance une IllegalArgumentException si la config est null, par souci de cohérence avec initialize(config)
| * | ||
| * @return true if initialized (RUNNING state), false otherwise | ||
| */ | ||
| boolean isInitialized(); |
There was a problem hiding this comment.
On a isInitialized() ici et isUsable() dans LifecycleState. Pour éviter les incohérences futures, isInitialized() devrait simplement déléguer à getState().isUsable().
| * | ||
| * @return true if usable (RUNNING) | ||
| */ | ||
| public boolean isUsable() { |
There was a problem hiding this comment.
Le nom isUsable() est bien, mais comme l'état s'appelle RUNNING, une méthode isRunning() serait peut-être plus intuitive
| public static final class Builder { | ||
| private final Map<String, Object> properties = new HashMap<>(); | ||
| private boolean transactionSupport = false; | ||
| private String storagePath = "http://ns.inria.fr/corese/dataset"; |
There was a problem hiding this comment.
La valeur codée en dur (http://ns.inria.fr/corese/dataset) est très spécifique et arbitraire.
| * @throws DataManagerException if operation fails | ||
| * @throws IllegalArgumentException if context is null | ||
| */ | ||
| MutationResult declareContext(Node context) throws DataManagerException; |
There was a problem hiding this comment.
Toutes les méthodes de cette interface concernent des opérations de masse ou structurelles, mais declareContext ne porte que sur un seul Node. Est-ce qu'une version declareContexts(List) ne serait pas plus cohérente avec le nom de l'interface BulkOperations ?
| * @return This builder (for chaining) | ||
| */ | ||
| public Builder storagePath(String path) { | ||
| if (path != null && !path.isEmpty()) { |
There was a problem hiding this comment.
Remplacer les vérifications silencieuses (if != null) par des IllegalArgumentException pour les méthodes property() et storagePath().
d58eb66 to
4c63d3d
Compare
|
| * @return this builder instance | ||
| * @throws IllegalArgumentException if path is null, empty, or blank | ||
| */ | ||
| public Builder storagePath(String path) { |
There was a problem hiding this comment.
I don't get why this is a required parameter ?
What if the datamanager is in-memory ? Is there a storage path ?
| * | ||
| * @return true if predicate is specified | ||
| */ | ||
| public boolean isPredicate() { |
There was a problem hiding this comment.
For this function and all the similar one: "isPredicate" -> "hasPredicate"
| */ | ||
| public class GraphStatistics { | ||
|
|
||
| private final long edgeCount; |
There was a problem hiding this comment.
Count attributes should not be final, as they will increase or decrease with each modification to the models.
| /** | ||
| * Builder for GraphStatistics. | ||
| */ | ||
| public static class Builder { |
There was a problem hiding this comment.
Following comment on R10, not sure if this class is suitable for the builder pattern
6b39e92 to
c1e5458
Compare
|
|
No description provided.