Class SnapshotDistribStateManager
- java.lang.Object
-
- org.apache.solr.cloud.autoscaling.sim.SnapshotDistribStateManager
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,DistribStateManager
,SolrCloseable
public class SnapshotDistribStateManager extends Object implements DistribStateManager
Read-only snapshot of anotherDistribStateManager
-
-
Constructor Summary
Constructors Constructor Description SnapshotDistribStateManager(Map<String,Object> snapshot)
Populate this instance from a previously generated snapshot.SnapshotDistribStateManager(Map<String,Object> snapshot, AutoScalingConfig config)
Populate this instance from a previously generated snapshot.SnapshotDistribStateManager(DistribStateManager other, AutoScalingConfig config)
Populate this instance from anotherDistribStateManager
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
String
createData(String path, byte[] data, org.apache.zookeeper.CreateMode mode)
AutoScalingConfig
getAutoScalingConfig(org.apache.zookeeper.Watcher watcher)
VersionedData
getData(String path, org.apache.zookeeper.Watcher watcher)
Map<String,Object>
getSnapshot(RedactionUtils.RedactionContext ctx)
Create a snapshot of all content in this instance.boolean
hasData(String path)
List<String>
listData(String path)
List<String>
listData(String path, org.apache.zookeeper.Watcher watcher)
List<String>
listTree(String path)
void
makePath(String path)
void
makePath(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, boolean failOnExists)
List<org.apache.zookeeper.OpResult>
multi(Iterable<org.apache.zookeeper.Op> ops)
void
removeData(String path, int version)
void
setData(String path, byte[] data, int version)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.client.solrj.cloud.DistribStateManager
getAutoScalingConfig, getData, removeRecursively
-
Methods inherited from interface org.apache.solr.common.SolrCloseable
isClosed
-
-
-
-
Constructor Detail
-
SnapshotDistribStateManager
public SnapshotDistribStateManager(DistribStateManager other, AutoScalingConfig config) throws Exception
Populate this instance from anotherDistribStateManager
instance.- Parameters:
other
- another instanceconfig
- optionalAutoScalingConfig
, which will overwrite any existing config.- Throws:
Exception
-
SnapshotDistribStateManager
public SnapshotDistribStateManager(Map<String,Object> snapshot)
Populate this instance from a previously generated snapshot.- Parameters:
snapshot
- previous snapshot created using this class.
-
SnapshotDistribStateManager
public SnapshotDistribStateManager(Map<String,Object> snapshot, AutoScalingConfig config)
Populate this instance from a previously generated snapshot.- Parameters:
snapshot
- previous snapshot created using this class.config
- optional config to override the one from snapshot, may be null
-
-
Method Detail
-
getSnapshot
public Map<String,Object> getSnapshot(RedactionUtils.RedactionContext ctx)
Create a snapshot of all content in this instance.
-
hasData
public boolean hasData(String path) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
hasData
in interfaceDistribStateManager
- Throws:
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
listData
public List<String> listData(String path) throws NoSuchElementException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
listData
in interfaceDistribStateManager
- Throws:
NoSuchElementException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
listTree
public List<String> listTree(String path)
- Specified by:
listTree
in interfaceDistribStateManager
-
listData
public List<String> listData(String path, org.apache.zookeeper.Watcher watcher) throws NoSuchElementException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
listData
in interfaceDistribStateManager
- Throws:
NoSuchElementException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
getData
public VersionedData getData(String path, org.apache.zookeeper.Watcher watcher) throws NoSuchElementException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
getData
in interfaceDistribStateManager
- Throws:
NoSuchElementException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
makePath
public void makePath(String path) throws AlreadyExistsException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
makePath
in interfaceDistribStateManager
- Throws:
AlreadyExistsException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
makePath
public void makePath(String path, byte[] data, org.apache.zookeeper.CreateMode createMode, boolean failOnExists) throws AlreadyExistsException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
makePath
in interfaceDistribStateManager
- Throws:
AlreadyExistsException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
createData
public String createData(String path, byte[] data, org.apache.zookeeper.CreateMode mode) throws AlreadyExistsException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
createData
in interfaceDistribStateManager
- Throws:
AlreadyExistsException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
removeData
public void removeData(String path, int version) throws NoSuchElementException, IOException, NotEmptyException, org.apache.zookeeper.KeeperException, InterruptedException, BadVersionException
- Specified by:
removeData
in interfaceDistribStateManager
- Throws:
NoSuchElementException
IOException
NotEmptyException
org.apache.zookeeper.KeeperException
InterruptedException
BadVersionException
-
setData
public void setData(String path, byte[] data, int version) throws BadVersionException, NoSuchElementException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
setData
in interfaceDistribStateManager
- Throws:
BadVersionException
NoSuchElementException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
multi
public List<org.apache.zookeeper.OpResult> multi(Iterable<org.apache.zookeeper.Op> ops) throws BadVersionException, NoSuchElementException, AlreadyExistsException, IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Specified by:
multi
in interfaceDistribStateManager
- Throws:
BadVersionException
NoSuchElementException
AlreadyExistsException
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
getAutoScalingConfig
public AutoScalingConfig getAutoScalingConfig(org.apache.zookeeper.Watcher watcher) throws InterruptedException, IOException
- Specified by:
getAutoScalingConfig
in interfaceDistribStateManager
- Throws:
InterruptedException
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-