Class ParameterIdDb
- java.lang.Object
-
- org.yamcs.parameterarchive.ParameterIdDb
-
public class ParameterIdDb extends Object
Stores a map (parameter_fqn, type) -> parameter_idtype 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 Summary
Fields Modifier and Type Field Description static String
TIME_PARAMETER_FQN
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
createAndGet(String paramFqn, org.yamcs.protobuf.Yamcs.Value.Type engType)
get a parameter id for a parameter that only has engineering valueint
createAndGet(String paramFqn, org.yamcs.protobuf.Yamcs.Value.Type engType, org.yamcs.protobuf.Yamcs.Value.Type rawType)
Get the mapping from (parameterFqn, type) to pidint
createAndGetAggrray(String paramFqn, IntArray componenets)
Creates (if not already existing) an id for the aggregate or array parameter with the given qualified name and member ids.ParameterId[]
get(String fqn)
Get all parameters ids for a given qualified name return null if no parameter id exists for that fqn.ParameterId[]
getAggarrayComponents(int aggrayPid, int gid)
Get the array components of aggregate/array parameter pid which are member of the group gidorg.yamcs.parameterarchive.ParameterIdDb.Entry
getCachedEntryById(int pid)
String
getParameterFqnById(int parameterId)
returns the parameter FQN for the given parameterIdParameterGroupIdDb
getParameterGroupIdDb()
ParameterId
getParameterId(int pid)
returns ParameterId based on numeric id or null if it does not existint
getTimeParameterId()
void
iterate(BiFunction<String,ParameterId,Boolean> consumer)
Iterate over the parameter database, calling the function with the fqn and parameter id.void
print(PrintStream out)
int
size()
-
-
-
Field Detail
-
TIME_PARAMETER_FQN
public static final String TIME_PARAMETER_FQN
- See Also:
- Constant Field Values
-
-
Method Detail
-
createAndGet
public int createAndGet(String paramFqn, org.yamcs.protobuf.Yamcs.Value.Type engType, org.yamcs.protobuf.Yamcs.Value.Type rawType) throws ParameterArchiveException
Get the mapping from (parameterFqn, type) to pidIt 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, org.yamcs.protobuf.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, IntArray componenets)
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 parametercomponenets
- - 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 member of the group gid- Parameters:
aggrayPid
-gid
-- Returns:
-
-