Package org.apache.storm.daemon.nimbus
Class TopoCache
java.lang.Object
org.apache.storm.daemon.nimbus.TopoCache
Cache topologies and topology confs from the blob store.
Makes reading this faster because it can skip
deserialization in many cases.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a new topology config.void
addTopology
(String topoId, Subject who, StormTopology topo) Add a new topology.void
clear()
Clear all entries from the Cache.void
deleteTopoConf
(String topoId, Subject who) Delete a topology conf when we are done.void
deleteTopology
(String topoId, Subject who) Delete a topology when we are done.readTopoConf
(String topoId, Subject who) Read a topology conf.readTopology
(String topoId, Subject who) Read a topology.void
Update an existing topology conf.void
updateTopology
(String topoId, Subject who, StormTopology topo) Update an existing topology .
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG
-
-
Constructor Details
-
TopoCache
-
-
Method Details
-
readTopology
public StormTopology readTopology(String topoId, Subject who) throws KeyNotFoundException, AuthorizationException, IOException Read a topology.- Parameters:
topoId
- the id of the topology to readwho
- who to read it as- Returns:
- the deserialized topology.
- Throws:
IOException
- on any error while reading the blob.AuthorizationException
- if who is not allowed to read the blobKeyNotFoundException
- if the blob could not be found
-
deleteTopology
public void deleteTopology(String topoId, Subject who) throws AuthorizationException, KeyNotFoundException Delete a topology when we are done.- Parameters:
topoId
- the id of the topologywho
- who is deleting it- Throws:
AuthorizationException
- if who is not allowed to delete the blobKeyNotFoundException
- if the blob could not be found
-
addTopology
public void addTopology(String topoId, Subject who, StormTopology topo) throws AuthorizationException, KeyAlreadyExistsException, IOException Add a new topology.- Parameters:
topoId
- the id of the topologywho
- who is doing ittopo
- the topology itself- Throws:
AuthorizationException
- if who is not allowed to add a topologyKeyAlreadyExistsException
- if the topology already existsIOException
- on any error interacting with the blob store
-
updateTopology
public void updateTopology(String topoId, Subject who, StormTopology topo) throws AuthorizationException, KeyNotFoundException, IOException Update an existing topology .- Parameters:
topoId
- the id of the topologywho
- who is doing ittopo
- the new topology to save- Throws:
AuthorizationException
- if who is not allowed to update a topologyKeyNotFoundException
- if the topology is not found in the blob storeIOException
- on any error interacting with the blob store
-
readTopoConf
public Map<String,Object> readTopoConf(String topoId, Subject who) throws KeyNotFoundException, AuthorizationException, IOException Read a topology conf.- Parameters:
topoId
- the id of the topology to read the conf forwho
- who to read it as- Returns:
- the deserialized config.
- Throws:
IOException
- on any error while reading the blob.AuthorizationException
- if who is not allowed to read the blobKeyNotFoundException
- if the blob could not be found
-
deleteTopoConf
public void deleteTopoConf(String topoId, Subject who) throws AuthorizationException, KeyNotFoundException Delete a topology conf when we are done.- Parameters:
topoId
- the id of the topologywho
- who is deleting it- Throws:
AuthorizationException
- if who is not allowed to delete the topo confKeyNotFoundException
- if the topo conf is not found in the blob store
-
addTopoConf
public void addTopoConf(String topoId, Subject who, Map<String, Object> topoConf) throws AuthorizationException, KeyAlreadyExistsException, IOExceptionAdd a new topology config.- Parameters:
topoId
- the id of the topologywho
- who is doing ittopoConf
- the topology conf itself- Throws:
AuthorizationException
- if who is not allowed to add a topology confKeyAlreadyExistsException
- if the toplogy conf already exists in the blob storeIOException
- on any error interacting with the blob store.
-
updateTopoConf
public void updateTopoConf(String topoId, Subject who, Map<String, Object> topoConf) throws AuthorizationException, KeyNotFoundException, IOExceptionUpdate an existing topology conf.- Parameters:
topoId
- the id of the topologywho
- who is doing ittopoConf
- the new topology conf to save- Throws:
AuthorizationException
- if who is not allowed to update the topology confKeyNotFoundException
- if the topology conf is not found in the blob storeIOException
- on any error interacting with the blob store.
-
clear
public void clear()Clear all entries from the Cache. This typically happens right after becoming a leader, just to be sure nothing has changed while we were not the leader.
-