Uploaded image for project: 'Kotlin Couchbase Client'
  1. Kotlin Couchbase Client
  2. KCBC-123

Improve subdocument counter methods

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 1.1.7
    • None
    • None
    • None
    • 1
    • SDK22

    Description

      • Add new versions of `MutateInSpec.incrementAndGet` and `decrementAndGet` without a `delta` parameter ("increment/decrement" implies the delta is 1).
      • Add an `addAndGet` method that takes a delta.
      • Deprecate the old increment/decrement methods that take a delta, in favor of addAndGet.

      This aligns the subdocument counter methods with Java's AtomicLong methods, and side-steps the problem of what to do if the user attempts to subtract Long.MIN_VALUE. (The current implementation of decrementAndGet that takes a delta is flawed because it naively negates the delta and then delegates to incrementAndGet. This fails if the delta is `Long.MIN_VALUE`, because negating `Long.MIN_VALUE` has no effect.)

      Attachments

        Activity

          People

            david.nault David Nault
            david.nault David Nault
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty