Class ParameterIdDb

java.lang.Object
org.yamcs.parameterarchive.ParameterIdDb

public class ParameterIdDb extends Object
Stores a map (parameter_fqn, type) -> parameter_id

type is a 32 bit assigned corresponding (engType, rawType)

engType and rawType are one of the types from protobuf Value.Type - the numbers are used assuming that no more than 2^15 will ever exist.

The parameter_id is the tbsIndex from RocksdDb backed database.

The aggregates and arrays are also allocated parameter_ids (i.e. tbsIndex) but they do not contain any data, just a list of members parameter ids stored in the tablespace metadata. Backed by RocksDB

  • Field Details

  • Method Details

    • createAndGet

      public int createAndGet(String paramFqn, Yamcs.Value.Type engType, Yamcs.Value.Type rawType) throws ParameterArchiveException
      Get the mapping from (parameterFqn, type) to pid

      It creates it if it does not exist

      Parameters:
      paramFqn -
      engType -
      rawType -
      Returns:
      a parameter id for the given parameter name and type
      Throws:
      ParameterArchiveException - if there was an error creating and storing a new parameter_id
    • getParameterGroupIdDb

      public ParameterGroupIdDb getParameterGroupIdDb()
    • createAndGet

      public int createAndGet(String paramFqn, Yamcs.Value.Type engType)
      get a parameter id for a parameter that only has engineering value
      Parameters:
      paramFqn -
      engType -
      Returns:
      a parameter id for the given parameter name and type
    • getTimeParameterId

      public int getTimeParameterId()
    • print

      public void print(PrintStream out)
    • size

      public int size()
    • get

      public ParameterId[] get(String fqn)
      Get all parameters ids for a given qualified name return null if no parameter id exists for that fqn.
      Parameters:
      fqn - - fully qualified name of the parameter for which the ids are returned
      Returns:
      all parameters ids for a given qualified name or null if no parameter id exists for that fqn
    • getParameterFqnById

      public String getParameterFqnById(int parameterId)
      returns the parameter FQN for the given parameterId
      Parameters:
      parameterId -
      Returns:
      parameterFQN or null if there is no parameter with the given id
    • getParameterId

      public ParameterId getParameterId(int pid)
      returns ParameterId based on numeric id or null if it does not exist
    • getCachedEntryById

      public org.yamcs.parameterarchive.ParameterIdDb.Entry getCachedEntryById(int pid)
    • iterate

      public void iterate(BiFunction<String,ParameterId,Boolean> consumer)
      Iterate over the parameter database, calling the function with the fqn and parameter id.

      The iteration will continue as long as the function returns true

      Parameters:
      consumer -
    • createAndGetAggrray

      public int createAndGetAggrray(String paramFqn, Yamcs.Value.Type engType, Yamcs.Value.Type rawType, IntArray components)
      Creates (if not already existing) an id for the aggregate or array parameter with the given qualified name and member ids.

      If another parameter with the same name exists and the aggArray is either a subset or superset of the members of the existing parameter, it is considered the same and is returned.

      For example an array will have an id for each index of its elements a[0], a[1],.. The aggArray for that parameter will consist of the list of ids corresponding to the value which had the maximum number of elements.

      If a new value is encountered having more elements than the previous maximum, we do not want to create a new id for that parameter. We do however want to create a new id if the elements have a different type (and thus a[i] will have a different id)

      Parameters:
      paramFqn - - qualified name of the parameter
      engType - - the type of engineering value (ARRAY or AGGREGATE)
      rawType - - the type of the raw value - null if the parameter has no raw value
      components - - the parameter ids of the components of the aggregate or array
      Returns:
    • getAggarrayComponents

      public ParameterId[] getAggarrayComponents(int aggrayPid, int gid)
      Get the array components of aggregate/array parameter pid which are members of the group gid
      Parameters:
      aggrayPid -
      gid -
      Returns:
    • getAllPids

      public IntArray getAllPids()
      returns an array of all parameter ids (including the time pseudo-parameter id)