Component versioning

Code component as well as many other artifacts in the container can be versioned. This document explains the format and semantics of these versions and how they are referred.

Format

Versions are on the form

version ::=    major [ "." minor [ "." micro [ "." qualifier ]]]
Where major, minor, and micro are integers and qualifier is any string.

A version is appended to an id separated by a colon. In cases where a file is created for each component version, the colon is replaced by a dash in the file name.

Ordering

Versions are ordered first by major, then minor, then micro and then by doing a lexical ordering on the qualifier. This means that a:1 < a:1.0 < a:1.0.0 < a:1.1 < a:1.1.0 < a:2

Referencing a versioned Component

Whenever component is referenced by id (in code or configuration), a fully or partially specified version may be included in the reference by using the form id:versionSpecification. Such references are resolved using the following rules:

  • An id without any version specification resolves to the highest version not having a qualifier
  • A partially or full version specification resolves to the highest version not having a qualifier which matches the specification.
  • Versions with qualifiers are matched only by exact match.
Example: Given a component with id a having these versions: [1.1, 1.2, 1.2, 1.3.test, 2.0]
  • The reference a will resolve to a:2.0
  • The reference a:1 will resolve to a:1.2
  • The only way to resolve to the "test" qualified version is by using the exact reference a:1.3.test
  • These references will not resolve: a:1.3, a:3, 1.2.3

Merging specifications for chained Components

In some cases, there is a need for merging multiple references into one. An example is inheritance of chains of version references, where multiple inherited chains may reference the same component.

Two version references are said to be compatible if one is a prefix of the other. In this case the most specific version is used. If they are not compatible they are conflicting. Example:

<search>
    <searcher id="Searcher:2.3" class="com.yahoo.search.example.Searcher"/>
    <searcher id="Searcher:2.4" class="com.yahoo.search.example.Searcher"/>
    <chain id="parenta">
        <searcher id="Searcher:2"></searcher>
    </chain>
    <chain id="parentb">
        <searcher id="Searcher:2.3"></searcher>
    </chain>
    <chain id="parentc">
        <searcher id="Searcher:2.4"></searcher>
    </chain>

    <!-- This chain will get Searcher:2.3 -->
    <chain id="childa" inherits="parenta parentb" />

    <!-- Error, as Searcher:2.3 and Searcher:2.4 are conflicting -->
    <chain id="childb" inherits="parentb parentc" />
</search>