public interface SyncServiceNode
SyncServiceNode provides access nodes of SyncService. Users can
perform read/write/delete operations on the node. Users can also get access
to child nodes in the hierarchy.| Modifier and Type | Method and Description |
|---|---|
void |
delete(boolean force)
Delete node from distributed database
|
int |
getChildCount()
Get number of child nodes when the data was read by last invocation of
getData
|
Collection<SyncServiceNode> |
getChildren()
Get child nodes for node
|
Collection<SyncServiceNode> |
getChildren(SyncServiceUser watcher)
Get child nodes for node & register watch for changes to child nodes
|
long |
getCreateTime()
The time in milliseconds from epoch when this node was created.
|
byte[] |
getData()
Get data stored in the distributed database for this node
|
byte[] |
getData(SyncServiceUser watcher)
Get data stored in the distributed database for this node and set watch.
|
int |
getDataVersion()
Get version number of data read by last invocation of getData
|
SyncServiceNodePath |
getNodePath()
Get node's hierarchy in the distributed database from the root
|
void |
setData(byte[] data,
boolean force)
Write data to the node in the distributed database
|
boolean |
syncPath()
Sync the current node with other cluster zk instances
|
SyncServiceNodePath getNodePath()
byte[] getData()
throws ServiceNotAvailableException,
InterruptedException,
SyncServiceException.NodeNotFoundException
InterruptedException - Interrupted exceptionServiceNotAvailableException - Sync service is not UPSyncServiceException.NodeNotFoundException - Node not found exceptionbyte[] getData(SyncServiceUser watcher) throws ServiceNotAvailableException, InterruptedException, SyncServiceException.NodeNotFoundException
watcher - Watch is notified when node's data is changed or node is
deletedInterruptedException - Interrupted exceptionServiceNotAvailableException - Sync service is not UPSyncServiceException.NodeNotFoundException - Node not found exceptionint getDataVersion()
throws SyncServiceException.NodeNeverReadException
SyncServiceException.NodeNeverReadException - Node never read exceptionlong getCreateTime()
throws ServiceNotAvailableException,
SyncServiceException.NodeNotFoundException,
InterruptedException
ServiceNotAvailableException - Sync service not UPSyncServiceException.NodeNotFoundException - Node not found exceptionInterruptedException - Operation interrupted exceptionint getChildCount()
throws ServiceNotAvailableException,
SyncServiceException.NodeNotFoundException,
InterruptedException
ServiceNotAvailableException - Sync service not UPSyncServiceException.NodeNotFoundException - Node not found exceptionInterruptedException - Operation interrupted exceptionvoid setData(byte[] data,
boolean force)
throws SyncServiceException.NodeNeverReadException,
SyncServiceException.NodeChangedException,
SyncServiceException.NodeNotFoundException,
ServiceNotAvailableException,
InterruptedException
data - bytes to be writtenforce - if false, setData fails if data has changed since
it was last read. true will ignore any changes made after it was last
read and overwritesSyncServiceException.NodeNeverReadException - Node never read exceptionSyncServiceException.NodeChangedException - Node data changed exceptionSyncServiceException.NodeNotFoundException - Node not found exceptionServiceNotAvailableException - Sync service is not UPInterruptedException - Thread interrupted exceptionvoid delete(boolean force)
throws SyncServiceException.NodeNeverReadException,
ServiceNotAvailableException,
SyncServiceException.NodeHasChildrenException,
SyncServiceException.NodeNotFoundException,
SyncServiceException.NodeChangedException,
InterruptedException
force - if false, setData fails if data has changed since
it was last read. true will ignore any changes made after it was last
read and overwritesSyncServiceException.NodeNeverReadException - Node never read exceptionServiceNotAvailableException - Sync service is not UPSyncServiceException.NodeHasChildrenException - Node has children exceptionSyncServiceException.NodeNotFoundException - Node doesnt exist exceptionSyncServiceException.NodeChangedException - Node data changed exceptionInterruptedException - Operation interrupted exceptionCollection<SyncServiceNode> getChildren() throws ServiceNotAvailableException, SyncServiceException.NodeNotFoundException, InterruptedException
ServiceNotAvailableException - Sync service is not UPSyncServiceException.NodeNotFoundException - Node not found exceptionInterruptedException - Operation interrupted exceptionCollection<SyncServiceNode> getChildren(SyncServiceUser watcher) throws ServiceNotAvailableException, SyncServiceException.NodeNotFoundException, InterruptedException
watcher - Watcher object to be registered. Watch is triggered
when a child node is created or deleted or the node itself is deletedServiceNotAvailableException - Sync service is not UPSyncServiceException.NodeNotFoundException - Node not found exceptionInterruptedException - Operation interrupted exceptionboolean syncPath()
throws ServiceNotAvailableException,
InterruptedException
InterruptedException - Operation interrupted exceptionServiceNotAvailableException - Service not UpCopyright © 2014. All Rights Reserved.