Showing
10 changed files
with
29 additions
and
3 deletions
... | @@ -8,7 +8,7 @@ import com.google.common.collect.Lists; | ... | @@ -8,7 +8,7 @@ import com.google.common.collect.Lists; |
8 | /** | 8 | /** |
9 | * Collection of read requests to be submitted as one batch. | 9 | * Collection of read requests to be submitted as one batch. |
10 | */ | 10 | */ |
11 | -public class BatchReadRequest { | 11 | +public final class BatchReadRequest { |
12 | 12 | ||
13 | private final List<ReadRequest> readRequests; | 13 | private final List<ReadRequest> readRequests; |
14 | 14 | ||
... | @@ -60,7 +60,7 @@ public class BatchReadRequest { | ... | @@ -60,7 +60,7 @@ public class BatchReadRequest { |
60 | } | 60 | } |
61 | 61 | ||
62 | /** | 62 | /** |
63 | - * Builds a BatchReadRequest | 63 | + * Builds a BatchReadRequest. |
64 | * @return BatchReadRequest | 64 | * @return BatchReadRequest |
65 | */ | 65 | */ |
66 | public BatchReadRequest build() { | 66 | public BatchReadRequest build() { | ... | ... |
... | @@ -3,6 +3,9 @@ package org.onlab.onos.store.service; | ... | @@ -3,6 +3,9 @@ package org.onlab.onos.store.service; |
3 | import java.util.Collections; | 3 | import java.util.Collections; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | +/** | ||
7 | + * Result of a batch read operation. | ||
8 | + */ | ||
6 | public class BatchReadResult { | 9 | public class BatchReadResult { |
7 | 10 | ||
8 | private final List<ReadResult> readResults; | 11 | private final List<ReadResult> readResults; |
... | @@ -11,10 +14,18 @@ public class BatchReadResult { | ... | @@ -11,10 +14,18 @@ public class BatchReadResult { |
11 | this.readResults = Collections.unmodifiableList(readResults); | 14 | this.readResults = Collections.unmodifiableList(readResults); |
12 | } | 15 | } |
13 | 16 | ||
17 | + /** | ||
18 | + * Returns the results as a list. | ||
19 | + * @return list of results | ||
20 | + */ | ||
14 | public List<ReadResult> getAsList() { | 21 | public List<ReadResult> getAsList() { |
15 | return readResults; | 22 | return readResults; |
16 | } | 23 | } |
17 | 24 | ||
25 | + /** | ||
26 | + * Returns the batch size. | ||
27 | + * @return batch size | ||
28 | + */ | ||
18 | public int batchSize() { | 29 | public int batchSize() { |
19 | return readResults.size(); | 30 | return readResults.size(); |
20 | } | 31 | } | ... | ... |
... | @@ -8,7 +8,7 @@ import com.google.common.collect.Lists; | ... | @@ -8,7 +8,7 @@ import com.google.common.collect.Lists; |
8 | /** | 8 | /** |
9 | * Collection of write requests to be submitted as one batch. | 9 | * Collection of write requests to be submitted as one batch. |
10 | */ | 10 | */ |
11 | -public class BatchWriteRequest { | 11 | +public final class BatchWriteRequest { |
12 | 12 | ||
13 | private final List<WriteRequest> writeRequests; | 13 | private final List<WriteRequest> writeRequests; |
14 | 14 | ... | ... |
... | @@ -3,6 +3,9 @@ package org.onlab.onos.store.service; | ... | @@ -3,6 +3,9 @@ package org.onlab.onos.store.service; |
3 | import java.util.Collections; | 3 | import java.util.Collections; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | +/** | ||
7 | + * Result of a batch write operation. | ||
8 | + */ | ||
6 | public class BatchWriteResult { | 9 | public class BatchWriteResult { |
7 | 10 | ||
8 | private final List<WriteResult> writeResults; | 11 | private final List<WriteResult> writeResults; |
... | @@ -11,6 +14,10 @@ public class BatchWriteResult { | ... | @@ -11,6 +14,10 @@ public class BatchWriteResult { |
11 | this.writeResults = Collections.unmodifiableList(writeResults); | 14 | this.writeResults = Collections.unmodifiableList(writeResults); |
12 | } | 15 | } |
13 | 16 | ||
17 | + /** | ||
18 | + * Returns true if this batch write operation was successful. | ||
19 | + * @return true if successful, false otherwise. | ||
20 | + */ | ||
14 | public boolean isSuccessful() { | 21 | public boolean isSuccessful() { |
15 | for (WriteResult result : writeResults) { | 22 | for (WriteResult result : writeResults) { |
16 | if (result.status() != WriteStatus.OK) { | 23 | if (result.status() != WriteStatus.OK) { |
... | @@ -20,10 +27,18 @@ public class BatchWriteResult { | ... | @@ -20,10 +27,18 @@ public class BatchWriteResult { |
20 | return true; | 27 | return true; |
21 | } | 28 | } |
22 | 29 | ||
30 | + /** | ||
31 | + * Returns the results as a List. | ||
32 | + * @return list of batch results. | ||
33 | + */ | ||
23 | public List<WriteResult> getAsList() { | 34 | public List<WriteResult> getAsList() { |
24 | return this.writeResults; | 35 | return this.writeResults; |
25 | } | 36 | } |
26 | 37 | ||
38 | + /** | ||
39 | + * Returns the size of this batch. | ||
40 | + * @return batch size. | ||
41 | + */ | ||
27 | public int batchSize() { | 42 | public int batchSize() { |
28 | return writeResults.size(); | 43 | return writeResults.size(); |
29 | } | 44 | } | ... | ... |
-
Please register or login to post a comment