Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Madan Jampani
2014-11-04 18:11:10 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
37c2e70627fbc6935308959e77e78fe370d53ffc
37c2e706
1 parent
aca94ea0
Javadoc fixess
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
16 additions
and
55 deletions
core/store/dist/src/main/java/org/onlab/onos/store/service/DatabaseAdminService.java
core/store/dist/src/main/java/org/onlab/onos/store/service/DatabaseService.java
core/store/dist/src/main/java/org/onlab/onos/store/service/OptionalResult.java
core/store/dist/src/main/java/org/onlab/onos/store/service/PreconditionFailedException.java
core/store/dist/src/main/java/org/onlab/onos/store/service/ReadResult.java
core/store/dist/src/main/java/org/onlab/onos/store/service/WriteResult.java
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseStateMachine.java
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/NettyProtocol.java
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/VersionedValue.java
core/store/dist/src/main/java/org/onlab/onos/store/service/DatabaseAdminService.java
View file @
37c2e70
...
...
@@ -3,7 +3,7 @@ package org.onlab.onos.store.service;
import
java.util.List
;
/**
* Service for running administrative tasks on a Database.
* Service
interface
for running administrative tasks on a Database.
*/
public
interface
DatabaseAdminService
{
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/DatabaseService.java
View file @
37c2e70
...
...
@@ -2,13 +2,17 @@ package org.onlab.onos.store.service;
import
java.util.List
;
/**
* Service interface for a strongly consistent and durable
* key value data store.
*/
public
interface
DatabaseService
{
/**
* Performs a read on the database.
* @param request read request.
* @return ReadResult
* @throws DatabaseException
* @throws DatabaseException
if there is a failure in executing read.
*/
ReadResult
read
(
ReadRequest
request
);
...
...
@@ -16,7 +20,7 @@ public interface DatabaseService {
* Performs a batch read operation on the database.
* The main advantage of batch read operation is parallelization.
* @param batch batch of read requests to execute.
* @return
* @return
batch read result.
*/
List
<
OptionalResult
<
ReadResult
,
DatabaseException
>>
batchRead
(
List
<
ReadRequest
>
batch
);
...
...
@@ -24,7 +28,7 @@ public interface DatabaseService {
* Performs a write operation on the database.
* @param request
* @return write result.
* @throws DatabaseException
* @throws DatabaseException
if there is failure in execution write.
*/
WriteResult
write
(
WriteRequest
request
);
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/OptionalResult.java
View file @
37c2e70
...
...
@@ -5,16 +5,16 @@ package org.onlab.onos.store.service;
* <p>
* 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.
*
*
</p>
* @param <R> type of result.
* @param <E> exception encountered in generating the result.
*/
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
* @throws E if there is no valid result.
*/
public
R
get
();
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/PreconditionFailedException.java
View file @
37c2e70
...
...
@@ -2,7 +2,8 @@ package org.onlab.onos.store.service;
/**
* 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
* to some specified value.</li>
* <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"
)
public
class
PreconditionFailedException
extends
DatabaseException
{
}
}
\ No newline at end of file
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/ReadResult.java
View file @
37c2e70
package
org
.
onlab
.
onos
.
store
.
service
;
import
org.onlab.onos.store.service.impl.VersionedValue
;
/**
* Database read result.
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/WriteResult.java
View file @
37c2e70
package
org
.
onlab
.
onos
.
store
.
service
;
import
org.onlab.onos.store.service.impl.VersionedValue
;
/**
* Database write result.
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseStateMachine.java
View file @
37c2e70
...
...
@@ -12,6 +12,7 @@ import net.kuujo.copycat.StateMachine;
import
org.onlab.onos.store.serializers.KryoSerializer
;
import
org.onlab.onos.store.service.ReadRequest
;
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.WriteResult
;
import
org.onlab.util.KryoNamespace
;
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/NettyProtocol.java
View file @
37c2e70
...
...
@@ -33,6 +33,7 @@ import org.onlab.onos.store.serializers.ImmutableSetSerializer;
import
org.onlab.onos.store.serializers.KryoSerializer
;
import
org.onlab.onos.store.service.ReadRequest
;
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.WriteResult
;
import
org.onlab.util.KryoNamespace
;
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/VersionedValue.java
deleted
100644 → 0
View file @
aca94ea
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
+
"]"
;
}
}
Please
register
or
login
to post a comment