Package org.apache.storm.daemon.nimbus

# Class TopoCache

java.lang.Object
org.apache.storm.daemon.nimbus.TopoCache

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.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final org.slf4j.Logger`
  `LOG`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TopoCache(BlobStore store, Map<String,Object> conf)`

- ## Method Summary

  Modifier and Type
  Method
  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 .

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LOG

    public static final org.slf4j.Logger LOG

- ## Constructor Details

  - ### TopoCache

    public TopoCache(BlobStore store, Map<String,Object> conf)

- ## 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 read
      `who` - 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 blob
      `KeyNotFoundException` - 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 topology
      `who` - who is deleting it
    Throws:
      `AuthorizationException` - if who is not allowed to delete the blob
      `KeyNotFoundException` - 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 topology
      `who` - who is doing it
      `topo` - the topology itself
    Throws:
      `AuthorizationException` - if who is not allowed to add a topology
      `KeyAlreadyExistsException` - if the topology already exists
      `IOException` - 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 topology
      `who` - who is doing it
      `topo` - the new topology to save
    Throws:
      `AuthorizationException` - if who is not allowed to update a topology
      `KeyNotFoundException` - if the topology is not found in the blob store
      `IOException` - 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 for
      `who` - 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 blob
      `KeyNotFoundException` - 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 topology
      `who` - who is deleting it
    Throws:
      `AuthorizationException` - if who is not allowed to delete the topo conf
      `KeyNotFoundException` - 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, IOException
    Add a new topology config.
    Parameters:
      `topoId` - the id of the topology
      `who` - who is doing it
      `topoConf` - the topology conf itself
    Throws:
      `AuthorizationException` - if who is not allowed to add a topology conf
      `KeyAlreadyExistsException` - if the toplogy conf already exists in the blob store
      `IOException` - on any error interacting with the blob store.

  - ### updateTopoConf

    public void updateTopoConf(String topoId, Subject who, Map<String,Object> topoConf) throws AuthorizationException, KeyNotFoundException, IOException
    Update an existing topology conf.
    Parameters:
      `topoId` - the id of the topology
      `who` - who is doing it
      `topoConf` - the new topology conf to save
    Throws:
      `AuthorizationException` - if who is not allowed to update the topology conf
      `KeyNotFoundException` - if the topology conf is not found in the blob store
      `IOException` - 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.