Interface Updater<R>

All Superinterfaces:
AutoCloseable, Closeable, Scanner<R>, Spliterator<R>

public interface Updater<R> extends Scanner<R>
Support for scanning through all rows in a table, updating them along the way. Any exception thrown when acting upon an updater automatically closes it.

Update operations only affect columns which have a modified state, and the rest of the columns remain the same as what was served by the updater. Columns which have an unmodified state, regardless of the column value, aren't updated. Consider the case in which a row key is changed, the row is loaded, and then one column is modified. Although all columns are effectively different than what was served by the updater, only one column is updated against the original row. For debugging, call the row's toString method to identify which columns are modified. The name of a modified column is prefixed with an asterisk.

Updater instances can only be safely used by one thread at a time, and they must be closed when no longer needed. Instances can be exchanged by threads, as long as a happens-before relationship is established. Without proper exclusion, multiple threads interacting with a Updater instance may cause database corruption.

See Also:
  • Method Details

    • update

      default R update() throws IOException
      Update the current row and then step to the next row.
      Returns:
      the next row or null if no more rows remain and scanner has been closed
      Throws:
      IllegalStateException - if no current row
      UniqueConstraintException - if update creates a conflicting primary or alternate key
      IOException
    • update

      R update(R row) throws IOException
      Update the current row and then step to the next row.
      Parameters:
      row - use this for the next row instead of creating a new one; if null is passed in, a new instance will be created if necessary
      Returns:
      the next row or null if no more rows remain and scanner has been closed
      Throws:
      IllegalStateException - if no current row
      UniqueConstraintException - if update creates a conflicting primary or alternate key
      IOException
    • delete

      default R delete() throws IOException
      Delete the current row and then step to the next row.
      Returns:
      the next row or null if no more rows remain and scanner has been closed
      Throws:
      IllegalStateException - if no current row
      IOException
    • delete

      R delete(R row) throws IOException
      Delete the current row and then step to the next row.
      Parameters:
      row - use this for the next row instead of creating a new one; if null is passed in, a new instance will be created if necessary
      Returns:
      the next row or null if no more rows remain and scanner has been closed
      Throws:
      IllegalStateException - if no current row
      IOException