001package io.ebeanservice.docstore.api;
002
003/**
004 * A document store transaction.
005 * <p>
006 * This might just be a buffer to batch persist requests to the document store and may not
007 * support transactional semantics (like rollback).
008 */
009public interface DocStoreTransaction {
010
011  /**
012   * Obtain a context to persist to (like a buffer).
013   */
014  DocStoreUpdateContext obtain();
015
016  /**
017   * Add changes that should be queued to the DocStoreUpdates.
018   * <p>
019   * This mostly means nested/embedded updates that need to be processed after the source
020   * persist event has propagated.
021   * </p>
022   */
023  DocStoreUpdates queue();
024
025  /**
026   * Flush all changes to the document store.
027   */
028  void flush();
029}