1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi;
import com.yahoo.document.Document;
import com.yahoo.document.DocumentId;
import com.yahoo.document.DocumentPut;
import com.yahoo.document.DocumentRemove;
import com.yahoo.document.DocumentType;
import com.yahoo.document.DocumentUpdate;
import com.yahoo.document.TestAndSetCondition;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
/**
* <p>A session for synchronous access to a document repository. This class
* provides simple document access where throughput is not a concern.</p>
*
* @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
*/
public interface SyncSession extends Session {
/**
* <p>Puts a document. When this method returns, the document is safely
* received. This enables setting condition compared to using Document.</p>
*
* @param documentPut The DocumentPut operation
*/
void put(DocumentPut documentPut);
/**
* <p>Puts a document. When this method returns, the document is safely
* received.</p>
*
* @param documentPut The DocumentPut operation
* @param priority The priority with which to perform this operation.
*/
void put(DocumentPut documentPut, DocumentProtocol.Priority priority);
/**
* <p>Gets a document.</p>
*
* @param id The id of the document to get.
* @return 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.
*/
Document get(DocumentId id);
/**
* <p>Gets a document.</p>
*
* @param id The id of the document to get.
* @param fieldSet A comma-separated list of fields to retrieve
* @param priority The priority with which to perform this operation.
* @return 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.
*/
Document get(DocumentId id, String fieldSet, DocumentProtocol.Priority priority);
/**
* <p>Removes a document if it is present and condition is fulfilled.</p>
* @param documentRemove document to delete
* @return true If the document with this id was removed, false otherwise.
*/
boolean remove(DocumentRemove documentRemove);
/**
* <p>Removes a document if it is present.</p>
*
* @param documentRemove Document remove operation
* @param priority The priority with which to perform this operation.
* @return true If the document with this id was removed, false otherwise.
* @throws UnsupportedOperationException Thrown if this access does not
* support removal.
*/
boolean remove(DocumentRemove documentRemove, DocumentProtocol.Priority priority);
/**
* <p>Updates a document.</p>
*
* @param update The updates to perform.
* @return True, if the document was found and updated.
* @throws UnsupportedOperationException Thrown if this access does not
* support update.
*/
boolean update(DocumentUpdate update);
/**
* <p>Updates a document.</p>
*
* @param update The updates to perform.
* @param priority The priority with which to perform this operation.
* @return True, if the document was found and updated.
* @throws UnsupportedOperationException Thrown if this access does not
* support update.
*/
boolean update(DocumentUpdate update, DocumentProtocol.Priority priority);
}
|