org.sdnplatform.sync.internal.remote
Class RemoteStore

java.lang.Object
  extended by org.sdnplatform.sync.internal.remote.RemoteStore
All Implemented Interfaces:
IStore<ByteArray,byte[]>

public class RemoteStore
extends java.lang.Object
implements IStore<ByteArray,byte[]>

A store implementation that will connect to a remote sync instance

Author:
readams

Constructor Summary
RemoteStore(java.lang.String storeName, RemoteSyncManager syncManager)
           
 
Method Summary
 void close()
          Close the store.
 IClosableIterator<java.util.Map.Entry<ByteArray,java.util.List<Versioned<byte[]>>>> entries()
          Get an iterator over pairs of entries in the store.
 java.util.List<Versioned<byte[]>> get(ByteArray key)
          Get the value associated with the given key
 java.lang.String getName()
           
 java.util.List<IVersion> getVersions(ByteArray key)
          Get a list of the versions associated with the given key
 void put(ByteArray key, Versioned<byte[]> value)
          Associate the value with the key and version in this store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteStore

public RemoteStore(java.lang.String storeName,
                   RemoteSyncManager syncManager)
Method Detail

get

public java.util.List<Versioned<byte[]>> get(ByteArray key)
                                      throws SyncException
Description copied from interface: IStore
Get the value associated with the given key

Specified by:
get in interface IStore<ByteArray,byte[]>
Parameters:
key - The key to check for
Returns:
The value associated with the key or an empty list if no values are found.
Throws:
SyncException

entries

public IClosableIterator<java.util.Map.Entry<ByteArray,java.util.List<Versioned<byte[]>>>> entries()
Description copied from interface: IStore
Get an iterator over pairs of entries in the store. The key is the first element in the pair and the versioned value is the second element. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Specified by:
entries in interface IStore<ByteArray,byte[]>
Returns:
An iterator over the entries in this StorageEngine.

put

public void put(ByteArray key,
                Versioned<byte[]> value)
         throws SyncException
Description copied from interface: IStore
Associate the value with the key and version in this store

Specified by:
put in interface IStore<ByteArray,byte[]>
Parameters:
key - The key to use
value - The value to store and its version.
Throws:
SyncException

getVersions

public java.util.List<IVersion> getVersions(ByteArray key)
                                     throws SyncException
Description copied from interface: IStore
Get a list of the versions associated with the given key

Specified by:
getVersions in interface IStore<ByteArray,byte[]>
Parameters:
key - the key
Returns:
the list of IVersion objects
Throws:
SyncException

getName

public java.lang.String getName()
Specified by:
getName in interface IStore<ByteArray,byte[]>
Returns:
The name of the store.

close

public void close()
           throws SyncException
Description copied from interface: IStore
Close the store.

Specified by:
close in interface IStore<ByteArray,byte[]>
Throws:
SyncException - If closing fails.