Support pagination in query across all anchors(ep4)
[cps.git] / cps-service / src / main / java / org / onap / cps / spi / CpsDataPersistenceService.java
index d28a333..1baca4e 100644 (file)
@@ -44,15 +44,6 @@ public interface CpsDataPersistenceService {
      */
     void storeDataNodes(String dataspaceName, String anchorName, Collection<DataNode> dataNodes);
 
-    /**
-     * Add a child to a Fragment.
-     *
-     * @param dataspaceName dataspace name
-     * @param anchorName    anchor name
-     * @param parentXpath   parent xpath
-     * @param dataNode      dataNode
-     */
-    void addChildDataNode(String dataspaceName, String anchorName, String parentXpath, DataNode dataNode);
 
     /**
      * Add multiple children to a Fragment.
@@ -116,14 +107,14 @@ public interface CpsDataPersistenceService {
                                                        FetchDescendantsOption fetchDescendantsOption);
 
     /**
-     * Updates leaves for existing data node.
+     * Updates data leaves for multiple data nodes.
      *
-     * @param dataspaceName dataspace name
-     * @param anchorName    anchor name
-     * @param xpath         xpath
-     * @param leaves        the leaves as a map where key is a leaf name and a value is a leaf value
+     * @param dataspaceName              dataspace name
+     * @param anchorName                 anchor name
+     * @param updatedLeavesPerXPath      Map of xPaths to updated leaf nodes
      */
-    void updateDataLeaves(String dataspaceName, String anchorName, String xpath, Map<String, Serializable> leaves);
+    void batchUpdateDataLeaves(String dataspaceName, String anchorName,
+                               Map<String, Map<String, Serializable>> updatedLeavesPerXPath);
 
     /**
      * Replaces multiple existing data nodes' content including descendants in a batch operation.
@@ -209,11 +200,12 @@ public interface CpsDataPersistenceService {
      * @param cpsPath                cps path
      * @param fetchDescendantsOption defines whether the descendants of the node(s) found by the query should be
      *                               included in the output
+     * @param paginationOption pagination option
      * @return the data nodes found i.e. 0 or more data nodes
      */
     List<DataNode> queryDataNodesAcrossAnchors(String dataspaceName,
-                                  String cpsPath, FetchDescendantsOption fetchDescendantsOption);
-
+                                  String cpsPath, FetchDescendantsOption fetchDescendantsOption,
+                                  PaginationOption paginationOption);
 
     /**
      * Starts a session which allows use of locks and batch interaction with the persistence service.
@@ -239,4 +231,12 @@ public interface CpsDataPersistenceService {
      * @param timeoutInMilliseconds lock attempt timeout in milliseconds
      */
     void lockAnchor(String sessionID, String dataspaceName, String anchorName, Long timeoutInMilliseconds);
+
+    /**
+     * Query total anchors for dataspace name and cps path.
+     * @param dataspaceName datasoace name
+     * @param cpsPath cps path
+     * @return total anchors for dataspace name and cps path
+     */
+    Integer countAnchorsForDataspaceAndCpsPath(String dataspaceName, String cpsPath);
 }