2. Type Safety and System Evolution

In some cases, it is desirable for types to evolve without breaking interoperability with deployed components already using those types. For example:

To support use cases such as the above, the type system introduces the concept of appendable (extensible) and mutable types. A type may be final, appendable (extensible), or mutable:

For example, suppose you have:

struct A { 
    @id(10) int32 a;
    @id(20) int32 b; 
    @id(30) int32 c; 
} 

and

struct B {
    @id(20) int32 b; 
    @id(10) int32 a; 
    @id(40) int32 x; 
} 

In this case, if a DataWriter writes [1, 2, 3], the DataReader will receive [2, 1, 0] (because 0 is the default value of x, which doesn't exist in A's sample).

The type being written and the type(s) being read may differ—maybe because the writing and reading applications have different needs, or maybe because the system and its data design have evolved across versions. Whatever the reason, the databus must detect the differences and mediate them appropriately. This process has several steps:

  1. Define what degree of difference is acceptable for a given type.
  2. Express your intention for compatibility at run time.
  3. Verify that the data can be safely converted.

At run time, the databus will compare the types it finds with the contracts you specified.

© 2020 RTI