Package com.yahoo.documentapi.local
Class LocalSyncSession
- java.lang.Object
-
- com.yahoo.documentapi.local.LocalSyncSession
-
- All Implemented Interfaces:
Session
,SyncSession
public class LocalSyncSession extends java.lang.Object implements SyncSession
- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description LocalSyncSession(LocalDocumentAccess access)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroys this session and frees up any resources it has held.com.yahoo.document.Document
get(com.yahoo.document.DocumentId id, java.lang.String fieldSet, DocumentProtocol.Priority priority, java.time.Duration timeout)
Gets a document with timeout.com.yahoo.document.Document
get(com.yahoo.document.DocumentId id, java.time.Duration timeout)
Gets a document with timeout.Response
getNext()
Returns the next response of this session.Response
getNext(int timeout)
Returns the next response of this session.void
put(com.yahoo.document.DocumentPut documentPut)
Puts a document.void
put(com.yahoo.document.DocumentPut documentPut, DocumentProtocol.Priority priority)
Puts a document.boolean
remove(com.yahoo.document.DocumentRemove documentRemove)
Removes a document if it is present and condition is fulfilled.boolean
remove(com.yahoo.document.DocumentRemove documentRemove, DocumentProtocol.Priority priority)
Removes a document if it is present.boolean
update(com.yahoo.document.DocumentUpdate update)
Updates a document.boolean
update(com.yahoo.document.DocumentUpdate update, DocumentProtocol.Priority pri)
Updates a document.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.yahoo.documentapi.SyncSession
get, get
-
-
-
-
Constructor Detail
-
LocalSyncSession
public LocalSyncSession(LocalDocumentAccess access)
-
-
Method Detail
-
put
public void put(com.yahoo.document.DocumentPut documentPut)
Description copied from interface:SyncSession
Puts a document. When this method returns, the document is safely received. This enables setting condition compared to using Document.- Specified by:
put
in interfaceSyncSession
- Parameters:
documentPut
- The DocumentPut operation
-
put
public void put(com.yahoo.document.DocumentPut documentPut, DocumentProtocol.Priority priority)
Description copied from interface:SyncSession
Puts a document. When this method returns, the document is safely received.- Specified by:
put
in interfaceSyncSession
- Parameters:
documentPut
- The DocumentPut operationpriority
- The priority with which to perform this operation.
-
get
public com.yahoo.document.Document get(com.yahoo.document.DocumentId id, java.time.Duration timeout)
Description copied from interface:SyncSession
Gets a document with timeout.- Specified by:
get
in interfaceSyncSession
- Parameters:
id
- The id of the document to gettimeout
- Timeout. If timeout is null, an unspecified default will be used- Returns:
- the document with this id, or null if there is none
-
get
public com.yahoo.document.Document get(com.yahoo.document.DocumentId id, java.lang.String fieldSet, DocumentProtocol.Priority priority, java.time.Duration timeout)
Description copied from interface:SyncSession
Gets a document with timeout.- Specified by:
get
in interfaceSyncSession
- Parameters:
id
- The id of the document to get.fieldSet
- A comma-separated list of fields to retrievepriority
- 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.
-
remove
public boolean remove(com.yahoo.document.DocumentRemove documentRemove)
Description copied from interface:SyncSession
Removes a document if it is present and condition is fulfilled.
- Specified by:
remove
in interfaceSyncSession
- Parameters:
documentRemove
- document to delete- Returns:
- true if the document with this id was removed, false otherwise.
-
remove
public boolean remove(com.yahoo.document.DocumentRemove documentRemove, DocumentProtocol.Priority priority)
Description copied from interface:SyncSession
Removes a document if it is present.- Specified by:
remove
in interfaceSyncSession
- Parameters:
documentRemove
- Document remove operationpriority
- The priority with which to perform this operation.- Returns:
- true If the document with this id was removed, false otherwise.
-
update
public boolean update(com.yahoo.document.DocumentUpdate update)
Description copied from interface:SyncSession
Updates a document.- Specified by:
update
in interfaceSyncSession
- Parameters:
update
- The updates to perform.- Returns:
- True, if the document was found and updated.
-
update
public boolean update(com.yahoo.document.DocumentUpdate update, DocumentProtocol.Priority pri)
Description copied from interface:SyncSession
Updates a document.- Specified by:
update
in interfaceSyncSession
- Parameters:
update
- The updates to perform.pri
- The priority with which to perform this operation.- Returns:
- True, if the document was found and updated.
-
getNext
public Response getNext()
Description copied from interface:Session
Returns the next response of this session. This method returns immediately.
-
getNext
public Response getNext(int timeout)
Description copied from interface:Session
Returns the next response of this session. This will block until a response is ready or until the given timeout is reached
-
-