Madan Jampani

Javadoc fixess

...@@ -3,7 +3,7 @@ package org.onlab.onos.store.service; ...@@ -3,7 +3,7 @@ package org.onlab.onos.store.service;
3 import java.util.List; 3 import java.util.List;
4 4
5 /** 5 /**
6 - * Service for running administrative tasks on a Database. 6 + * Service interface for running administrative tasks on a Database.
7 */ 7 */
8 public interface DatabaseAdminService { 8 public interface DatabaseAdminService {
9 9
......
...@@ -2,13 +2,17 @@ package org.onlab.onos.store.service; ...@@ -2,13 +2,17 @@ package org.onlab.onos.store.service;
2 2
3 import java.util.List; 3 import java.util.List;
4 4
5 +/**
6 + * Service interface for a strongly consistent and durable
7 + * key value data store.
8 + */
5 public interface DatabaseService { 9 public interface DatabaseService {
6 10
7 /** 11 /**
8 * Performs a read on the database. 12 * Performs a read on the database.
9 * @param request read request. 13 * @param request read request.
10 * @return ReadResult 14 * @return ReadResult
11 - * @throws DatabaseException 15 + * @throws DatabaseException if there is a failure in executing read.
12 */ 16 */
13 ReadResult read(ReadRequest request); 17 ReadResult read(ReadRequest request);
14 18
...@@ -16,7 +20,7 @@ public interface DatabaseService { ...@@ -16,7 +20,7 @@ public interface DatabaseService {
16 * Performs a batch read operation on the database. 20 * Performs a batch read operation on the database.
17 * The main advantage of batch read operation is parallelization. 21 * The main advantage of batch read operation is parallelization.
18 * @param batch batch of read requests to execute. 22 * @param batch batch of read requests to execute.
19 - * @return 23 + * @return batch read result.
20 */ 24 */
21 List<OptionalResult<ReadResult, DatabaseException>> batchRead(List<ReadRequest> batch); 25 List<OptionalResult<ReadResult, DatabaseException>> batchRead(List<ReadRequest> batch);
22 26
...@@ -24,7 +28,7 @@ public interface DatabaseService { ...@@ -24,7 +28,7 @@ public interface DatabaseService {
24 * Performs a write operation on the database. 28 * Performs a write operation on the database.
25 * @param request 29 * @param request
26 * @return write result. 30 * @return write result.
27 - * @throws DatabaseException 31 + * @throws DatabaseException if there is failure in execution write.
28 */ 32 */
29 WriteResult write(WriteRequest request); 33 WriteResult write(WriteRequest request);
30 34
......
...@@ -5,16 +5,16 @@ package org.onlab.onos.store.service; ...@@ -5,16 +5,16 @@ package org.onlab.onos.store.service;
5 * <p> 5 * <p>
6 * If a result is present, get() will return it otherwise get() will throw 6 * If a result is present, get() will return it otherwise get() will throw
7 * the exception that was encountered in the process of generating the result. 7 * the exception that was encountered in the process of generating the result.
8 - * 8 + * </p>
9 * @param <R> type of result. 9 * @param <R> type of result.
10 * @param <E> exception encountered in generating the result. 10 * @param <E> exception encountered in generating the result.
11 */ 11 */
12 public interface OptionalResult<R, E extends Throwable> { 12 public interface OptionalResult<R, E extends Throwable> {
13 13
14 /** 14 /**
15 - * Returns the result. 15 + * Returns the result or throws an exception if there is no
16 + * valid result.
16 * @return result 17 * @return result
17 - * @throws E if there is no valid result.
18 */ 18 */
19 public R get(); 19 public R get();
20 20
......
...@@ -2,7 +2,8 @@ package org.onlab.onos.store.service; ...@@ -2,7 +2,8 @@ package org.onlab.onos.store.service;
2 2
3 /** 3 /**
4 * Exception that indicates a precondition failure. 4 * Exception that indicates a precondition failure.
5 - * <ul>Scenarios that can cause this exception: 5 + * Scenarios that can cause this exception:
6 + * <ul>
6 * <li>An operation that attempts to write a new value iff the current value is equal 7 * <li>An operation that attempts to write a new value iff the current value is equal
7 * to some specified value.</li> 8 * to some specified value.</li>
8 * <li>An operation that attempts to write a new value iff the current version 9 * <li>An operation that attempts to write a new value iff the current version
...@@ -11,4 +12,4 @@ package org.onlab.onos.store.service; ...@@ -11,4 +12,4 @@ package org.onlab.onos.store.service;
11 */ 12 */
12 @SuppressWarnings("serial") 13 @SuppressWarnings("serial")
13 public class PreconditionFailedException extends DatabaseException { 14 public class PreconditionFailedException extends DatabaseException {
14 -} 15 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 package org.onlab.onos.store.service; 1 package org.onlab.onos.store.service;
2 2
3 -import org.onlab.onos.store.service.impl.VersionedValue;
4 3
5 /** 4 /**
6 * Database read result. 5 * Database read result.
......
1 package org.onlab.onos.store.service; 1 package org.onlab.onos.store.service;
2 2
3 -import org.onlab.onos.store.service.impl.VersionedValue;
4 3
5 /** 4 /**
6 * Database write result. 5 * Database write result.
......
...@@ -12,6 +12,7 @@ import net.kuujo.copycat.StateMachine; ...@@ -12,6 +12,7 @@ import net.kuujo.copycat.StateMachine;
12 import org.onlab.onos.store.serializers.KryoSerializer; 12 import org.onlab.onos.store.serializers.KryoSerializer;
13 import org.onlab.onos.store.service.ReadRequest; 13 import org.onlab.onos.store.service.ReadRequest;
14 import org.onlab.onos.store.service.ReadResult; 14 import org.onlab.onos.store.service.ReadResult;
15 +import org.onlab.onos.store.service.VersionedValue;
15 import org.onlab.onos.store.service.WriteRequest; 16 import org.onlab.onos.store.service.WriteRequest;
16 import org.onlab.onos.store.service.WriteResult; 17 import org.onlab.onos.store.service.WriteResult;
17 import org.onlab.util.KryoNamespace; 18 import org.onlab.util.KryoNamespace;
......
...@@ -33,6 +33,7 @@ import org.onlab.onos.store.serializers.ImmutableSetSerializer; ...@@ -33,6 +33,7 @@ import org.onlab.onos.store.serializers.ImmutableSetSerializer;
33 import org.onlab.onos.store.serializers.KryoSerializer; 33 import org.onlab.onos.store.serializers.KryoSerializer;
34 import org.onlab.onos.store.service.ReadRequest; 34 import org.onlab.onos.store.service.ReadRequest;
35 import org.onlab.onos.store.service.ReadResult; 35 import org.onlab.onos.store.service.ReadResult;
36 +import org.onlab.onos.store.service.VersionedValue;
36 import org.onlab.onos.store.service.WriteRequest; 37 import org.onlab.onos.store.service.WriteRequest;
37 import org.onlab.onos.store.service.WriteResult; 38 import org.onlab.onos.store.service.WriteResult;
38 import org.onlab.util.KryoNamespace; 39 import org.onlab.util.KryoNamespace;
......
1 -package org.onlab.onos.store.service.impl;
2 -
3 -import java.util.Arrays;
4 -
5 -/**
6 - * Wrapper object that holds the object (as byte array) and its version.
7 - */
8 -public class VersionedValue {
9 -
10 - private final byte[] value;
11 - private final long version;
12 -
13 - /**
14 - * Creates a new instance with the specified value and version.
15 - * @param value
16 - * @param version
17 - */
18 - public VersionedValue(byte[] value, long version) {
19 - this.value = value;
20 - this.version = version;
21 - }
22 -
23 - /**
24 - * Returns the value.
25 - * @return value.
26 - */
27 - public byte[] value() {
28 - return value;
29 - }
30 -
31 - /**
32 - * Returns the version.
33 - * @return version.
34 - */
35 - public long version() {
36 - return version;
37 - }
38 -
39 - @Override
40 - public String toString() {
41 - return "VersionedValue [value=" + Arrays.toString(value) + ", version="
42 - + version + "]";
43 - }
44 -}