bbende commented on code in PR #8726:
URL: https://github.com/apache/nifi/pull/8726#discussion_r1587917581


##########
nifi-api/src/main/java/org/apache/nifi/registry/flow/FlowRegistryClient.java:
##########
@@ -71,30 +74,82 @@ public interface FlowRegistryClient extends 
ConfigurableComponent {
      */
     boolean isStorageLocationApplicable(FlowRegistryClientConfigurationContext 
context, String location);
 
+    /**
+     * Indicates if the registry supports branching.
+     *
+     * @param context Configuration context
+     * @return true if the registry supports branching, false otherwise
+     */
+    default boolean isBranchingSupported(final 
FlowRegistryClientConfigurationContext context) {
+        return false;
+    }
+
+    /**
+     * Get the available branches. Should return at least one branch that 
matches the response of getDefaultBranch.
+     *
+     * @param context Configuration context
+     * @return the set of available branches
+     *
+     * @throws FlowRegistryException If an issue happens during processing the 
request.
+     * @throws IOException If there is issue with the communication between 
NiFi and the Flow Registry.
+     */
+    default Set<FlowRegistryBranch> getBranches(final 
FlowRegistryClientConfigurationContext context) throws FlowRegistryException, 
IOException {
+        return Set.of(getDefaultBranch(context));
+    }
+
+    /**
+     * Gets the default branch. Must return a non-null FlowRegistryBranch 
instance with a non-null name.
+     *
+     * @param context Configuration context
+     * @return the default branch
+     *
+     * @throws FlowRegistryException If an issue happens during processing the 
request.
+     * @throws IOException If there is issue with the communication between 
NiFi and the Flow Registry.
+     */
+    default FlowRegistryBranch getDefaultBranch(final 
FlowRegistryClientConfigurationContext context) throws FlowRegistryException, 
IOException {
+        final FlowRegistryBranch branch = new FlowRegistryBranch();
+        branch.setName(DEFAULT_BRANCH_NAME);
+        return branch;
+    }
+
+    /**
+     * Creates a new branch from a given branch.
+     *
+     * @param context Configuration context
+     * @param createBranch the info for creating the branch
+     *
+     * @throws FlowRegistryException If an issue happens during processing the 
request.
+     * @throws IOException If there is issue with the communication between 
NiFi and the Flow Registry.
+     */
+    default void createBranch(FlowRegistryClientConfigurationContext context, 
final CreateBranch createBranch) throws FlowRegistryException, IOException {

Review Comment:
   That is a fair point and it is making me think whether we should leave this 
out initially, since I did not plan to expose any API to use this yet, and we 
could always add it later with a default impl.
   
   The reason I added this was related to the Git workflow I described in a 
later comment. I was picturing a possible UX in NiFi UI where you go to `Import 
Flow From Registry` screen and you choose (Branch - Bucket - Flow - Version) 
and then an option to create a new branch from this and have your imported PG 
track to the new branch. Essentially "create my feature branch" to work on 
this, but maybe we should be punting this to an out of band process through 
GitHub UI or Git command line.



-- 
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