Javadoc fixess

This commit is contained in:
Madan Jampani 2014-11-04 18:11:10 -08:00
parent aca94ea066
commit 37c2e70627
9 changed files with 16 additions and 55 deletions

View File

@ -3,7 +3,7 @@ package org.onlab.onos.store.service;
import java.util.List; import java.util.List;
/** /**
* Service for running administrative tasks on a Database. * Service interface for running administrative tasks on a Database.
*/ */
public interface DatabaseAdminService { public interface DatabaseAdminService {

View File

@ -2,13 +2,17 @@ package org.onlab.onos.store.service;
import java.util.List; import java.util.List;
/**
* Service interface for a strongly consistent and durable
* key value data store.
*/
public interface DatabaseService { public interface DatabaseService {
/** /**
* Performs a read on the database. * Performs a read on the database.
* @param request read request. * @param request read request.
* @return ReadResult * @return ReadResult
* @throws DatabaseException * @throws DatabaseException if there is a failure in executing read.
*/ */
ReadResult read(ReadRequest request); ReadResult read(ReadRequest request);
@ -16,7 +20,7 @@ public interface DatabaseService {
* Performs a batch read operation on the database. * Performs a batch read operation on the database.
* The main advantage of batch read operation is parallelization. * The main advantage of batch read operation is parallelization.
* @param batch batch of read requests to execute. * @param batch batch of read requests to execute.
* @return * @return batch read result.
*/ */
List<OptionalResult<ReadResult, DatabaseException>> batchRead(List<ReadRequest> batch); List<OptionalResult<ReadResult, DatabaseException>> batchRead(List<ReadRequest> batch);
@ -24,7 +28,7 @@ public interface DatabaseService {
* Performs a write operation on the database. * Performs a write operation on the database.
* @param request * @param request
* @return write result. * @return write result.
* @throws DatabaseException * @throws DatabaseException if there is failure in execution write.
*/ */
WriteResult write(WriteRequest request); WriteResult write(WriteRequest request);

View File

@ -5,16 +5,16 @@ package org.onlab.onos.store.service;
* <p> * <p>
* If a result is present, get() will return it otherwise get() will throw * If a result is present, get() will return it otherwise get() will throw
* the exception that was encountered in the process of generating the result. * the exception that was encountered in the process of generating the result.
* * </p>
* @param <R> type of result. * @param <R> type of result.
* @param <E> exception encountered in generating the result. * @param <E> exception encountered in generating the result.
*/ */
public interface OptionalResult<R, E extends Throwable> { public interface OptionalResult<R, E extends Throwable> {
/** /**
* Returns the result. * Returns the result or throws an exception if there is no
* valid result.
* @return result * @return result
* @throws E if there is no valid result.
*/ */
public R get(); public R get();

View File

@ -2,7 +2,8 @@ package org.onlab.onos.store.service;
/** /**
* Exception that indicates a precondition failure. * Exception that indicates a precondition failure.
* <ul>Scenarios that can cause this exception: * Scenarios that can cause this exception:
* <ul>
* <li>An operation that attempts to write a new value iff the current value is equal * <li>An operation that attempts to write a new value iff the current value is equal
* to some specified value.</li> * to some specified value.</li>
* <li>An operation that attempts to write a new value iff the current version * <li>An operation that attempts to write a new value iff the current version
@ -11,4 +12,4 @@ package org.onlab.onos.store.service;
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PreconditionFailedException extends DatabaseException { public class PreconditionFailedException extends DatabaseException {
} }

View File

@ -1,6 +1,5 @@
package org.onlab.onos.store.service; package org.onlab.onos.store.service;
import org.onlab.onos.store.service.impl.VersionedValue;
/** /**
* Database read result. * Database read result.

View File

@ -1,6 +1,5 @@
package org.onlab.onos.store.service; package org.onlab.onos.store.service;
import org.onlab.onos.store.service.impl.VersionedValue;
/** /**
* Database write result. * Database write result.

View File

@ -12,6 +12,7 @@ import net.kuujo.copycat.StateMachine;
import org.onlab.onos.store.serializers.KryoSerializer; import org.onlab.onos.store.serializers.KryoSerializer;
import org.onlab.onos.store.service.ReadRequest; import org.onlab.onos.store.service.ReadRequest;
import org.onlab.onos.store.service.ReadResult; import org.onlab.onos.store.service.ReadResult;
import org.onlab.onos.store.service.VersionedValue;
import org.onlab.onos.store.service.WriteRequest; import org.onlab.onos.store.service.WriteRequest;
import org.onlab.onos.store.service.WriteResult; import org.onlab.onos.store.service.WriteResult;
import org.onlab.util.KryoNamespace; import org.onlab.util.KryoNamespace;

View File

@ -33,6 +33,7 @@ import org.onlab.onos.store.serializers.ImmutableSetSerializer;
import org.onlab.onos.store.serializers.KryoSerializer; import org.onlab.onos.store.serializers.KryoSerializer;
import org.onlab.onos.store.service.ReadRequest; import org.onlab.onos.store.service.ReadRequest;
import org.onlab.onos.store.service.ReadResult; import org.onlab.onos.store.service.ReadResult;
import org.onlab.onos.store.service.VersionedValue;
import org.onlab.onos.store.service.WriteRequest; import org.onlab.onos.store.service.WriteRequest;
import org.onlab.onos.store.service.WriteResult; import org.onlab.onos.store.service.WriteResult;
import org.onlab.util.KryoNamespace; import org.onlab.util.KryoNamespace;

View File

@ -1,44 +0,0 @@
package org.onlab.onos.store.service.impl;
import java.util.Arrays;
/**
* Wrapper object that holds the object (as byte array) and its version.
*/
public class VersionedValue {
private final byte[] value;
private final long version;
/**
* Creates a new instance with the specified value and version.
* @param value
* @param version
*/
public VersionedValue(byte[] value, long version) {
this.value = value;
this.version = version;
}
/**
* Returns the value.
* @return value.
*/
public byte[] value() {
return value;
}
/**
* Returns the version.
* @return version.
*/
public long version() {
return version;
}
@Override
public String toString() {
return "VersionedValue [value=" + Arrays.toString(value) + ", version="
+ version + "]";
}
}