From f28eee1ba07554be73881e1df417494b3968ea85 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 22 Sep 2014 14:55:35 +0000
Subject: [PATCH] OPENDJ-1444 CR-4537 Remove previous cookie from storage of ChangeNumberIndexDB

---
 opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
index 1fe0714..585a82f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/server/changelog/api/DBCursor.java
@@ -52,6 +52,38 @@
  * }
  * </pre>
  *
+ * A cursor can be initialised from a key, using a {@code KeyMatchingStrategy} and
+ * a {@code PositionStrategy}, to determine the exact starting position.
+ * <p>
+ * Let's call Kp the highest key lower than K and Kn the lowest key higher
+ * than K : Kp &lt; K &lt; Kn
+ * <ul>
+ *  <li>When using EQUAL_TO_KEY on key K :
+ *   <ul>
+ *    <li>with ON_MATCHING_KEY, cursor is positioned on key K (if K exists in log),
+ *        otherwise it is empty</li>
+ *    <li>with AFTER_MATCHING_KEY, cursor is positioned on key Kn (if K exists in log),
+ *        otherwise it is empty</li>
+ *   </ul>
+ *  </li>
+ *  <li>When using LESS_THAN_OR_EQUAL_TO_KEY on key K :
+ *   <ul>
+ *    <li>with ON_MATCHING_KEY, cursor is positioned on key K (if K exists in log)
+ *        or else Kp (if Kp exists in log), otherwise it is empty</li>
+ *    <li>with AFTER_MATCHING_KEY, cursor is positioned on key Kn (if Kp or K exist in log),
+ *        otherwise it is empty</li>
+ *   </ul>
+ *  </li>
+ *  <li>When using GREATER_THAN_OR_EQUAL_TO_KEY on key K :
+ *   <ul>
+ *    <li>with ON_MATCHING_KEY, cursor is positioned on key K (if K exists in log)
+ *        or else Kn (if Kn exists in log), otherwise it is empty</li>
+ *    <li>with AFTER_MATCHING_KEY, cursor is positioned on key Kn (if K or Kn exist in log),
+ *        otherwise it is empty</li>
+ *   </ul>
+ *  </li>
+ * </ul>
+ *
  * @param <T>
  *          type of the record being returned
  * \@NotThreadSafe
@@ -61,9 +93,11 @@
 
   /**
    * Represents a cursor key matching strategy, which allow to choose if only
-   * the exact key must be found or if any key equals or higher should match.
+   * the exact key must be found or if any key equal or lower/higher should match.
    */
   public enum KeyMatchingStrategy {
+    /** matches if the key or a lower key is found. */
+    LESS_THAN_OR_EQUAL_TO_KEY,
     /** matches only if the exact key is found. */
     EQUAL_TO_KEY,
     /** matches if the key or a greater key is found. */

--
Gitblit v1.10.0