Skip to content

Precedent ordering for generic vs. specific mapping indexes #43

Description

@stephen-dixon

Current logic flow insrc/handlers/mapping_handler.cpp: the incoming request path has concrete indices extracted and replaced with generic symbols (#) as one of the first steps in MappingHandler::map. Later, the generate_map_path helper function tries to match this (modified) exact string first before attempting other patterns using the find_mapping helper. find_mapping would then attempt to match with the actual index number if a generic case is not found first.

The motivating example is where for a given IDS path you want to express a generic pattern for the majority of index numbers (a general case) but where there are particular exceptions to that rule (alternate mappings for individually specified index numbers). I think this would typically be the expected behaviour (e.g. template specialisation in c++, specific overrides general).

e.g. for coils, where the solenoid is a special case, often treated very differently from other PF coils.

"some/mapping/path[#]/data" :  {
  "data_source": "MDSPLUS"
   "args": { 
    "signal": < some generic pattern >,
      ... },
  "slice": {{ index.0 }}
},
"some/mapping/path[5]/data" :  {
  "data_source": "MDSPLUS"
   "args": { 
    "signal": < some very specific alternate TDI logic >,
      ... },
},

The current behaviour means the general case always overrides a specific case, but I'd expect the opposite to be true.

Is there an explicit rationale for the current behaviour or can I change it?

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions