Interface SyncSession

All Superinterfaces:
Session
All Known Implementing Classes:
LocalSyncSession, MessageBusSyncSession

public interface SyncSession extends Session
A session for synchronous access to a document repository. This class provides simple document access where throughput is not a concern.
Author:
Simon Thoresen Hult, bjorncs
  • Method Summary

    Modifier and Type
    Method
    Description
    default com.yahoo.document.Document
    get(com.yahoo.document.DocumentId id)
    Gets a document.
    default com.yahoo.document.Document
    get(com.yahoo.document.DocumentId id, DocumentOperationParameters parameters, Duration timeout)
    Gets a document with timeout.
    default com.yahoo.document.Document
    get(com.yahoo.document.DocumentId id, String fieldSet, DocumentProtocol.Priority priority)
    Deprecated, for removal: This API element is subject to removal in a future version.
    specifying explicit operation priority is deprecated.
    com.yahoo.document.Document
    get(com.yahoo.document.DocumentId id, String fieldSet, DocumentProtocol.Priority priority, Duration timeout)
    Deprecated, for removal: This API element is subject to removal in a future version.
    specifying explicit operation priority is deprecated
    com.yahoo.document.Document
    get(com.yahoo.document.DocumentId id, Duration timeout)
    Gets a document with timeout.
    void
    put(com.yahoo.document.DocumentPut documentPut)
    Puts a document.
    default void
    put(com.yahoo.document.DocumentPut documentPut, DocumentOperationParameters parameters)
    Puts a document.
    default void
    put(com.yahoo.document.DocumentPut documentPut, DocumentProtocol.Priority priority)
    Deprecated, for removal: This API element is subject to removal in a future version.
    specifying explicit operation priority is deprecated
    boolean
    remove(com.yahoo.document.DocumentRemove documentRemove)
    Removes a document if it is present and condition is fulfilled.
    default boolean
    remove(com.yahoo.document.DocumentRemove documentRemove, DocumentOperationParameters parameters)
    Removes a document if it is present.
    boolean
    remove(com.yahoo.document.DocumentRemove documentRemove, DocumentProtocol.Priority priority)
    Deprecated, for removal: This API element is subject to removal in a future version.
    specifying explicit operation priority is deprecated
    boolean
    update(com.yahoo.document.DocumentUpdate update)
    Updates a document.
    default boolean
    update(com.yahoo.document.DocumentUpdate update, DocumentOperationParameters parameters)
    Updates a document.
    boolean
    update(com.yahoo.document.DocumentUpdate update, DocumentProtocol.Priority priority)
    Deprecated, for removal: This API element is subject to removal in a future version.
    specifying explicit operation priority is deprecated

    Methods inherited from interface com.yahoo.documentapi.Session

    destroy, getNext, getNext
  • Method Details

    • put

      void put(com.yahoo.document.DocumentPut documentPut)
      Puts a document. When this method returns, the document is safely received. This enables setting condition compared to using Document.
      Parameters:
      documentPut - the DocumentPut operation
    • put

      @Deprecated(forRemoval=true) default void put(com.yahoo.document.DocumentPut documentPut, DocumentProtocol.Priority priority)
      Deprecated, for removal: This API element is subject to removal in a future version.
      specifying explicit operation priority is deprecated
      Puts a document. When this method returns, the document is safely received.
      Parameters:
      documentPut - the DocumentPut operation
      priority - the priority with which to perform this operation
    • put

      default void put(com.yahoo.document.DocumentPut documentPut, DocumentOperationParameters parameters)
      Puts a document. When this method returns, the document is safely received.
      Parameters:
      documentPut - the DocumentPut operation
      parameters - parameters for the operation
    • get

      default com.yahoo.document.Document get(com.yahoo.document.DocumentId id)
      Gets a document.
      Parameters:
      id - the id of the document to get.
      Returns:
      the known document having this id, or null if there is no document having this id
      Throws:
      UnsupportedOperationException - thrown if this access does not support retrieving
    • get

      @Deprecated(forRemoval=true) default com.yahoo.document.Document get(com.yahoo.document.DocumentId id, String fieldSet, DocumentProtocol.Priority priority)
      Deprecated, for removal: This API element is subject to removal in a future version.
      specifying explicit operation priority is deprecated. Set fieldSet via get(DocumentId, DocumentOperationParameters, Duration) instead.
      Gets a document with an unspecified timeout
      Parameters:
      id - the id of the document to get
      fieldSet - a comma-separated list of fields to retrieve
      priority - the priority with which to perform this operation
      Returns:
      the document with this id, or null if there is none
      Throws:
      UnsupportedOperationException - thrown if this does not support retrieving
    • get

      com.yahoo.document.Document get(com.yahoo.document.DocumentId id, Duration timeout)
      Gets a document with timeout.
      Parameters:
      id - the id of the document to get
      timeout - timeout. If timeout is null, an unspecified default will be used
      Returns:
      the document with this id, or null if there is none
      Throws:
      UnsupportedOperationException - thrown if this access does not support retrieving
      DocumentAccessException - on any messagebus error, including timeout (ErrorCode.TIMEOUT).
    • get

      @Deprecated(forRemoval=true) com.yahoo.document.Document get(com.yahoo.document.DocumentId id, String fieldSet, DocumentProtocol.Priority priority, Duration timeout)
      Deprecated, for removal: This API element is subject to removal in a future version.
      specifying explicit operation priority is deprecated
      Gets a document with timeout.
      Parameters:
      id - the id of the document to get
      fieldSet - a comma-separated list of fields to retrieve
      priority - the priority with which to perform this operation
      timeout - timeout. If timeout is null, an unspecified default will be used
      Returns:
      the known document having this id, or null if there is no document having this id
      Throws:
      UnsupportedOperationException - thrown if this access does not support retrieving
      DocumentAccessException - on any messagebus error, including timeout (ErrorCode.TIMEOUT)
    • get

      default com.yahoo.document.Document get(com.yahoo.document.DocumentId id, DocumentOperationParameters parameters, Duration timeout)
      Gets a document with timeout.
      Parameters:
      id - the id of the document to get
      parameters - parameters for the operation
      timeout - timeout. If timeout is null, an unspecified default will be used
      Returns:
      the known document having this id, or null if there is no document having this id
      Throws:
      UnsupportedOperationException - thrown if this access does not support retrieving
      DocumentAccessException - on any messagebus error, including timeout (ErrorCode.TIMEOUT)
    • remove

      boolean remove(com.yahoo.document.DocumentRemove documentRemove)
      Removes a document if it is present and condition is fulfilled.
      Parameters:
      documentRemove - document to delete
      Returns:
      true if the document with this id was removed, false otherwise
    • remove

      @Deprecated(forRemoval=true) boolean remove(com.yahoo.document.DocumentRemove documentRemove, DocumentProtocol.Priority priority)
      Deprecated, for removal: This API element is subject to removal in a future version.
      specifying explicit operation priority is deprecated
      Removes a document if it is present.
      Parameters:
      documentRemove - document remove operation
      priority - the priority with which to perform this operation
      Returns:
      true if the document with this id was removed, false otherwise.
      Throws:
      UnsupportedOperationException - thrown if this access does not support removal
    • remove

      default boolean remove(com.yahoo.document.DocumentRemove documentRemove, DocumentOperationParameters parameters)
      Removes a document if it is present.
      Parameters:
      documentRemove - document remove operation
      parameters - parameters for the operation
      Returns:
      true if the document with this id was removed, false otherwise.
      Throws:
      UnsupportedOperationException - thrown if this access does not support removal
    • update

      boolean update(com.yahoo.document.DocumentUpdate update)
      Updates a document.
      Parameters:
      update - the updates to perform
      Returns:
      false if the updates could not be applied as the document does not exist and create-if-non-existent is not set.
      Throws:
      DocumentAccessException - on update error, including but not limited to: 1. timeouts, 2. the document exists but the condition is not met.
    • update

      @Deprecated(forRemoval=true) boolean update(com.yahoo.document.DocumentUpdate update, DocumentProtocol.Priority priority)
      Deprecated, for removal: This API element is subject to removal in a future version.
      specifying explicit operation priority is deprecated
      Updates a document.
      Parameters:
      update - the updates to perform.
      priority - the priority with which to perform this operation
      Returns:
      false if the updates could not be applied as the document does not exist and create-if-non-existent is not set.
      Throws:
      DocumentAccessException - on update error, including but not limited to: 1. timeouts, 2. the document exists but the condition is not met.
    • update

      default boolean update(com.yahoo.document.DocumentUpdate update, DocumentOperationParameters parameters)
      Updates a document.
      Parameters:
      update - the updates to perform.
      parameters - parameters for the operation
      Returns:
      false if the updates could not be applied as the document does not exist and create-if-non-existent is not set.
      Throws:
      DocumentAccessException - on update error, including but not limited to: 1. timeouts, 2. the document exists but the condition is not met.