|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sdnplatform.sync.internal.AbstractSyncManager
org.sdnplatform.sync.internal.SyncManager
public class SyncManager
Implementation for ISyncService
that keeps local copies of the data
and will synchronize it to other nodes in the cluster
ISyncService
Nested Class Summary | |
---|---|
protected class |
SyncManager.AntientropyTask
Periodically perform antientropy |
protected class |
SyncManager.CleanupTask
Periodically perform cleanup |
protected class |
SyncManager.HintWorker
Worker thread that will drain the sync item queue and write the appropriate messages to the node I/O channels |
protected class |
SyncManager.UpdateConfigTask
Worker task to periodically rescan the configuration |
Nested classes/interfaces inherited from interface org.sdnplatform.sync.ISyncService |
---|
ISyncService.Scope |
Field Summary | |
---|---|
static IDebugCounter |
counterErrorProcessing
|
static IDebugCounter |
counterErrorRemote
|
static IDebugCounter |
counterGets
|
static IDebugCounter |
counterHints
Debug Counters |
static IDebugCounter |
counterIterators
|
static IDebugCounter |
counterPuts
|
static IDebugCounter |
counterReceivedValues
|
static IDebugCounter |
counterSentValues
|
protected IDebugCounterService |
debugCounter
|
protected static org.slf4j.Logger |
logger
|
protected RPCService |
rpcService
|
protected IThreadPoolService |
threadPool
|
Constructor Summary | |
---|---|
SyncManager()
|
Method Summary | |
---|---|
void |
addListener(java.lang.String storeName,
MappingStoreListener listener)
Add a listener to the specified store |
void |
antientropy()
Communicate with a random node and do a full synchronization of the all the stores on each node that have the appropriate scope. |
void |
antientropy(Node node)
Perform a synchronization with the node specified |
void |
cleanup()
Perform periodic scheduled cleanup. |
void |
closeCursor(Cursor cursor)
Close the given cursor and remove it from the map |
protected void |
doUpdateConfiguration()
|
ClusterConfig |
getClusterConfig()
Get the cluster configuration object |
Cursor |
getCursor(int cursorId)
Retrieve the cursor, if any, for the given cursor ID |
short |
getLocalNodeId()
Get the local ID of the local node |
java.util.Collection<java.lang.Class<? extends IFloodlightService>> |
getModuleDependencies()
Get a list of Modules that this module depends on. |
IStorageEngine<ByteArray,byte[]> |
getRawStore(java.lang.String storeName)
Get access to the raw storage engine. |
IStore<ByteArray,byte[]> |
getStore(java.lang.String storeName)
Get a store object corresponding to the given store name |
protected SynchronizingStorageEngine |
getStoreInternal(java.lang.String storeName)
|
IThreadPoolService |
getThreadPool()
Return the threadpool |
boolean |
handleSyncOffer(java.lang.String storeName,
byte[] key,
java.lang.Iterable<VectorClock> versions)
Check whether any of the specified versions for the key are not older than the versions we already have |
void |
init(FloodlightModuleContext context)
This is a hook for each module to do its internal initialization, e.g., call setService(context.getService("Service")) All module dependencies are resolved when this is called, but not every module is initialized. |
Cursor |
newCursor(java.lang.String storeName)
Allocate a new cursor for the given store name |
void |
queueSyncTask(SynchronizingStorageEngine e,
ByteArray key,
Versioned<byte[]> value)
Queue a synchronization of the specified KeyedValues to all nodes
assocatiated with the storage engine specified |
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 |
void |
shutdown()
Shut down the sync manager. |
void |
startUp(FloodlightModuleContext context)
This is a hook for each module to do its external initializations, e.g., register for callbacks or query for state in other modules It is expected that this function will not block and that modules that want non-event driven CPU will spawn their own threads. |
void |
updateConfiguration()
Update the node configuration to add or remove nodes |
void |
writeSyncValue(java.lang.String storeName,
ISyncService.Scope scope,
boolean persist,
byte[] key,
java.lang.Iterable<Versioned<byte[]>> values)
Write a value synchronized from another node, bypassing some of the usual logic when a client writes data. |
Methods inherited from class org.sdnplatform.sync.internal.AbstractSyncManager |
---|
getModuleServices, getServiceImpls, getStoreClient, getStoreClient, getStoreClient, getStoreClient, getStoreClient |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.slf4j.Logger logger
protected IThreadPoolService threadPool
protected IDebugCounterService debugCounter
protected RPCService rpcService
public static IDebugCounter counterHints
public static IDebugCounter counterSentValues
public static IDebugCounter counterReceivedValues
public static IDebugCounter counterPuts
public static IDebugCounter counterGets
public static IDebugCounter counterIterators
public static IDebugCounter counterErrorRemote
public static IDebugCounter counterErrorProcessing
Constructor Detail |
---|
public SyncManager()
Method Detail |
---|
public void registerStore(java.lang.String storeName, ISyncService.Scope scope)
ISyncService
storeName
- the name of the storescope
- the distribution scope for the datapublic void registerPersistentStore(java.lang.String storeName, ISyncService.Scope scope) throws PersistException
ISyncService
storeName
- the name of the storescope
- the distribution scope for the data
PersistException
public ClusterConfig getClusterConfig()
ClusterConfig
objectClusterConfig
public void cleanup() throws SyncException
SyncException
public void antientropy(Node node)
public void antientropy()
public void writeSyncValue(java.lang.String storeName, ISyncService.Scope scope, boolean persist, byte[] key, java.lang.Iterable<Versioned<byte[]>> values) throws PersistException
storeName
- the store namescope
- the scope for the storepersist
- TODOkey
- the key to writevalues
- a list of versions for the key to write
PersistException
public boolean handleSyncOffer(java.lang.String storeName, byte[] key, java.lang.Iterable<VectorClock> versions) throws SyncException
storeName
- the store to checkkey
- the key to checkversions
- an iterable over the versions
SyncException
public IStorageEngine<ByteArray,byte[]> getRawStore(java.lang.String storeName) throws UnknownStoreException
storeName
- the store name to get
IStorageEngine
UnknownStoreException
public IThreadPoolService getThreadPool()
IThreadPoolService
public void queueSyncTask(SynchronizingStorageEngine e, ByteArray key, Versioned<byte[]> value)
KeyedValues
to all nodes
assocatiated with the storage engine specified
e
- the storage engine for the valueskv
- the values to synchronizepublic void addListener(java.lang.String storeName, MappingStoreListener listener) throws UnknownStoreException
AbstractSyncManager
addListener
in class AbstractSyncManager
storeName
- the name of the storelistener
- the listener to add
UnknownStoreException
public void updateConfiguration()
FloodlightModuleException
public Cursor getCursor(int cursorId)
cursorId
- the cursor ID
Cursor
public Cursor newCursor(java.lang.String storeName) throws UnknownStoreException
storeName
- the store name
Cursor
SyncException
UnknownStoreException
public void closeCursor(Cursor cursor)
cursor
- the cursor to closepublic IStore<ByteArray,byte[]> getStore(java.lang.String storeName) throws UnknownStoreException
AbstractSyncManager
getStore
in class AbstractSyncManager
storeName
- the store name
IStore
UnknownStoreException
public short getLocalNodeId()
AbstractSyncManager
getLocalNodeId
in class AbstractSyncManager
public void shutdown()
AbstractSyncManager
shutdown
in class AbstractSyncManager
public void init(FloodlightModuleContext context) throws FloodlightModuleException
IFloodlightModule
FloodlightModuleException
public void startUp(FloodlightModuleContext context) throws FloodlightModuleException
IFloodlightModule
FloodlightModuleException
public java.util.Collection<java.lang.Class<? extends IFloodlightService>> getModuleDependencies()
IFloodlightModule
protected void doUpdateConfiguration() throws FloodlightModuleException
FloodlightModuleException
protected SynchronizingStorageEngine getStoreInternal(java.lang.String storeName) throws UnknownStoreException
UnknownStoreException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |