class Availability
Defined at line 213 of file ../../tools/fidl/fidlc/src/versioning_types.h
An availability represents the versions when a FIDL element was added (A),
deprecated (D), removed (R), and re-added as legacy (L) in a platform. These
versions break the platform's timeline into the following regions:
Present -- [A, R) and [L, +inf) if L is set
Available -- [A, D or R)
Deprecated -- [D, R) if D is set
Legacy -- [L, +inf) if L is set
Absent -- (-inf, A) and [R, L or +inf)
Here is what the timeline looks like for finite versions A, D, R:
-inf A-1 A D-1 D R-1 R +inf
o--- ... ---o---o--- ....... ---o---o--- ....... ---o---o--- ... ---o
| | |-- Available --| |-- Deprecated -| | |
|-- Absent -| |-------------- Present ------------| |-- Absent -|
Here is what the timeline looks like for a legacy element (L = LEGACY):
-inf A-1 A R-1 R L-1 L +inf
o--- ... ---o---o--- ....... ---o---o--- ... ---o----o---- ... ---o
| | |-- Available --| | | |-- Legacy --|
|-- Absent -| |--- Present ---| |-- Absent -| |-- Present -|
Here is what the timeline looks like for Availability::Unbounded():
-inf +inf
o-------------------------------------------------------------------o
|---------------------------- Available ----------------------------|
|----------------------------- Present -----------------------------|
Public Methods
void Availability ()
Defined at line 215 of file ../../tools/fidl/fidlc/src/versioning_types.h
Availability Unbounded ()
Returns an availability that exists forever. This only exists as the base
case for calling `Inherit`. It never occurs as a final result.
Defined at line 219 of file ../../tools/fidl/fidlc/src/versioning_types.h
std::set<Version> points ()
Returns the points demarcating the availability: `added`, `removed`,
`deprecated` (if deprecated), and LEGACY and +inf (if Legacy::kYes).
Must be in the kInherited or kNarrowed state.
VersionSet set ()
Returns the presence set: [added, removed) and possibly [LEGACY, +inf).
Must be in the kInherited or kNarrowed state.
VersionRange range ()
Returns the presence range: [added, removed). Must be in the kNarrowed state.
bool is_deprecated ()
Returns true if the whole range is deprecated, and false if none of it is.
Must be in the kNarrowed state (where deprecation is all-or-nothing).
void Fail ()
Explicitly mark the availability as failed. Must not have called Init yet.
bool Init (InitArgs args)
Must be called first. Initializes the availability from
fields.
Returns false if they do not satisfy `added
<
= deprecated
<
removed`.
InheritResult Inherit (const Availability & parent)
Must be called second. Inherits unset fields from `parent`.
void SetLegacy ()
Optionally call this after Inherit to mark the availability as legacy=true.
TODO(https://fxbug.dev/42085274): This is temporary for the transition from
the LEGACY model to the RFC-0232 model. It will be removed.
void Narrow (VersionRange range)
Must be called third. Narrows the availability to the given range, which
must be a subset of range().
std::string Debug ()
Returns a string representation of the availability for debugging, of the
form "<added> <deprecated> <removed> <legacy>", using "_" for null values.
State state ()
Defined at line 245 of file ../../tools/fidl/fidlc/src/versioning_types.h
Ending ending ()
Returns the availability's ending. Must be in the kNarrowed state.
Defined at line 293 of file ../../tools/fidl/fidlc/src/versioning_types.h
Enumerations
enum class State : uint8_t
| Name | Value | Comments |
|---|---|---|
| kUnset | 0 |
1. Default constructed. All fields are null. |
| kInitialized | 1 |
2. `Init` succeeded. Some fields might be set, and they are in order. |
| kInherited | 2 |
3. `Inherit` succeeded. Now `added`, `removed`, `ending`, and `legacy` are always set. |
| kNarrowed | 3 |
4. `Narrow` succeeded. Now `deprecated` is unset or equal to `added`, and |
| kFailed | 4 |
One of the steps failed. |
An availability advances through four states. All reach kNarrowed on
success, except for library availabilities, which stay at kInherited
because libraries do not get decomposed.
Defined at line 231 of file ../../tools/fidl/fidlc/src/versioning_types.h
enum class Legacy : uint8_t
| Name | Value | Comments |
|---|---|---|
| kNotApplicable | 0 |
Not applicable because [added, removed) already includes LEGACY, |
| kNo | 1 |
No legacy support: do not re-add at LEGACY. |
| kYes | 2 |
Legacy support: re-add at LEGACY. |
Represents whether an availability includes legacy support.
Defined at line 267 of file ../../tools/fidl/fidlc/src/versioning_types.h
enum class Ending : uint8_t
| Name | Value | Comments |
|---|---|---|
| kNone | 0 |
This availability never ends, i.e. `removed` is +inf. |
| kRemoved | 1 |
Directly marked removed=N. Validate that there IS NOT an added=N replacement. |
| kReplaced | 2 |
Directly marked replaced=N. Validate that there IS an added=N replacement. |
| kInherited | 3 |
The availability ends because an ancestor was kRemoved or kReplaced. |
| kSplit | 4 |
During decomposition, only the last piece keeps the original ending. |
Meaning of the `removed` version, how this availability ends.
Defined at line 278 of file ../../tools/fidl/fidlc/src/versioning_types.h