public class TopoCache extends Object
Cache topologies and topology confs from the blob store. Makes reading this faster because it can skip deserialization in many cases.
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
TopoCache(BlobStore store,
Map<String,Object> conf) |
Modifier and Type | Method and Description |
---|---|
void |
addTopoConf(String topoId,
Subject who,
Map<String,Object> topoConf)
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.
|
Map<String,Object> |
readTopoConf(String topoId,
Subject who)
Read a topology conf.
|
StormTopology |
readTopology(String topoId,
Subject who)
Read a topology.
|
void |
updateTopoConf(String topoId,
Subject who,
Map<String,Object> topoConf)
Update an existing topology conf.
|
void |
updateTopology(String topoId,
Subject who,
StormTopology topo)
Update an existing topology .
|
public StormTopology readTopology(String topoId, Subject who) throws KeyNotFoundException, AuthorizationException, IOException
Read a topology.
topoId
- the id of the topology to readwho
- who to read it asIOException
- on any error while reading the blob.AuthorizationException
- if who is not allowed to read the blobKeyNotFoundException
- if the blob could not be foundpublic void deleteTopology(String topoId, Subject who) throws AuthorizationException, KeyNotFoundException
Delete a topology when we are done.
topoId
- the id of the topologywho
- who is deleting itAuthorizationException
- if who is not allowed to delete the blobKeyNotFoundException
- if the blob could not be foundpublic void addTopology(String topoId, Subject who, StormTopology topo) throws AuthorizationException, KeyAlreadyExistsException, IOException
Add a new topology.
topoId
- the id of the topologywho
- who is doing ittopo
- the topology itselfAuthorizationException
- if who is not allowed to add a topologyKeyAlreadyExistsException
- if the topology already existsIOException
- on any error interacting with the blob storepublic void updateTopology(String topoId, Subject who, StormTopology topo) throws AuthorizationException, KeyNotFoundException, IOException
Update an existing topology .
topoId
- the id of the topologywho
- who is doing ittopo
- the new topology to saveAuthorizationException
- 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 storepublic Map<String,Object> readTopoConf(String topoId, Subject who) throws KeyNotFoundException, AuthorizationException, IOException
Read a topology conf.
topoId
- the id of the topology to read the conf forwho
- who to read it asIOException
- on any error while reading the blob.AuthorizationException
- if who is not allowed to read the blobKeyNotFoundException
- if the blob could not be foundpublic void deleteTopoConf(String topoId, Subject who) throws AuthorizationException, KeyNotFoundException
Delete a topology conf when we are done.
topoId
- the id of the topologywho
- who is deleting itAuthorizationException
- if who is not allowed to delete the topo confKeyNotFoundException
- if the topo conf is not found in the blob storepublic void addTopoConf(String topoId, Subject who, Map<String,Object> topoConf) throws AuthorizationException, KeyAlreadyExistsException, IOException
Add a new topology config.
topoId
- the id of the topologywho
- who is doing ittopoConf
- the topology conf itselfAuthorizationException
- 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.public void updateTopoConf(String topoId, Subject who, Map<String,Object> topoConf) throws AuthorizationException, KeyNotFoundException, IOException
Update an existing topology conf.
topoId
- the id of the topologywho
- who is doing ittopoConf
- the new topology conf to saveAuthorizationException
- 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.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.
Copyright © 2022 The Apache Software Foundation. All rights reserved.