org.sdnplatform.sync
Interface ISyncService

All Superinterfaces:
IFloodlightService
All Known Implementing Classes:
AbstractSyncManager, RemoteSyncManager, SyncManager

public interface ISyncService
extends IFloodlightService

The sync service provides a high-performance in-memory database for fault and partition-tolerant replication of state data. It provides eventually consistent semantics with versioning through vector clocks and allows custom handling of resolution of inconsistent writes. An important caveat to keep in mind is that keys should not be constructed using any hash tables, because the serialized version will contain a a potentially-inconsistent ordering of elements resulting in a failure for keys to match. Using a java bean or a JsonNode will avoid this problem. Using strings as keys also avoids this problem.

Author:
readams

Nested Class Summary
static class ISyncService.Scope
           
 
Method Summary
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass)
          Get a store client for the given store.
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, java.lang.Class<K> keyClass, java.lang.Class<V> valueClass, IInconsistencyResolver<Versioned<V>> resolver)
          Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, com.fasterxml.jackson.core.type.TypeReference<K> keyType, com.fasterxml.jackson.core.type.TypeReference<V> valueType)
          Get a store client for the given store.
<K,V> IStoreClient<K,V>
getStoreClient(java.lang.String storeName, com.fasterxml.jackson.core.type.TypeReference<K> keyType, com.fasterxml.jackson.core.type.TypeReference<V> valueType, IInconsistencyResolver<Versioned<V>> resolver)
          Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.
 void registerPersistentStore(java.lang.String storeName, ISyncService.Scope scope)
          Create a store with the given store name and scope that will be persistent across reboots.
 void registerStore(java.lang.String storeName, ISyncService.Scope scope)
          Create a store with the given store name and scope
 

Method Detail

registerStore

void registerStore(java.lang.String storeName,
                   ISyncService.Scope scope)
                   throws SyncException
Create a store with the given store name and scope

Parameters:
storeName - the name of the store
scope - the distribution scope for the data
Throws:
SyncException

registerPersistentStore

void registerPersistentStore(java.lang.String storeName,
                             ISyncService.Scope scope)
                             throws SyncException
Create a store with the given store name and scope that will be persistent across reboots. The performance will be dramatically slower

Parameters:
storeName - the name of the store
scope - the distribution scope for the data
Throws:
SyncException

getStoreClient

<K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                       java.lang.Class<K> keyClass,
                                       java.lang.Class<V> valueClass)
                                 throws UnknownStoreException
Get a store client for the given store. The store client will use a default inconsistency resolution strategy which will use the timestamps of any concurrent updates and choose the later update

Parameters:
storeName - the name of the store to retrieve
keyClass - the class for the underlying key needed for deserialization
valueClass - the class for the underlying value needed for deserialization
Returns:
the store client
Throws:
UnknownStoreException

getStoreClient

<K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                       java.lang.Class<K> keyClass,
                                       java.lang.Class<V> valueClass,
                                       IInconsistencyResolver<Versioned<V>> resolver)
                                 throws UnknownStoreException
Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.

Parameters:
storeName - the name of the store to retrieve
keyClass - the class for the underlying key needed for deserialization
valueClass - the class for the underlying value needed for deserialization
resolver - the inconsistency resolver to use for the store
Returns:
the store client
Throws:
UnknownStoreException

getStoreClient

<K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                       com.fasterxml.jackson.core.type.TypeReference<K> keyType,
                                       com.fasterxml.jackson.core.type.TypeReference<V> valueType)
                                 throws UnknownStoreException
Get a store client for the given store. The store client will use a default inconsistency resolution strategy which will use the timestamps of any concurrent updates and choose the later update

Parameters:
storeName - the name of the store to retrieve
keyType - the type reference for the underlying key needed for deserialization
valueType - the type reference for the underlying value needed for deserialization
Returns:
the store client
Throws:
UnknownStoreException

getStoreClient

<K,V> IStoreClient<K,V> getStoreClient(java.lang.String storeName,
                                       com.fasterxml.jackson.core.type.TypeReference<K> keyType,
                                       com.fasterxml.jackson.core.type.TypeReference<V> valueType,
                                       IInconsistencyResolver<Versioned<V>> resolver)
                                 throws UnknownStoreException
Get a store client that will use the provided inconsistency resolver to resolve concurrent updates.

Parameters:
storeName - the name of the store to retrieve
keyType - the type reference for the underlying key needed for deserialization
valueType - the type reference for the underlying value needed for deserialization
resolver - the inconsistency resolver to use for the store
Returns:
the store client
Throws:
UnknownStoreException