Mapping
Identifies a mapping for an interface. A mapping must consist at least of an endpoint and a type.
Properties Summary
| Property | Type | Description | Required |
|---|---|---|---|
| endpoint | string | The template of the path. This is a UNIX-like path (e.g. /my/path) and can be parametrized. Parameters are in the %{name} form, and can be used to create interfaces which represent dictionaries of mappings. When the interface aggregation is object, an object is composed by all the mappings for one specific parameter combination. | ✔ Yes |
| type | string | Defines the type of the mapping. | ✔ Yes |
| reliability | string | Useful only with datastream. Defines whether the sent data should be considered delivered when the transport successfully sends the data (unreliable), when we know that the data has been received at least once (guaranteed) or when we know that the data has been received exactly once (unique). unreliable by default. When using reliable data, consider you might incur in additional resource usage on both the transport and the device's end. | No, default: "unreliable" |
| explicit_timestamp | boolean | Allow to set a custom timestamp, otherwise a timestamp is added when the message is received. If true explicit timestamp will also be used for sorting. This feature is only supported on datastreams. | No, default: false |
| retention | string | Useful only with datastream. Defines whether the sent data should be discarded if the transport is temporarily uncapable of delivering it (discard) or should be kept in a cache in memory (volatile) or on disk (stored), and guaranteed to be delivered in the timeframe defined by the expiry. discard by default. | No, default: "discard" |
| expiry | integer | Useful when retention is stored. Defines after how many seconds a specific data entry should be kept before giving up and erasing it from the persistent cache. A value <= 0 means the persistent cache never expires, and is the default. | No, default: 0 |
| database_retention_policy | string | Useful only with datastream. Defines whether data is expired from the database after a given time to live interval. When "no_ttl" is used data are not expired. | No |
| database_retention_ttl | integer | Useful when database_retention_policy is "use_ttl". Defines how many seconds a specific data entry should be kept before erasing it from the database. | No |
| allow_unset | boolean | Used only with properties. Used with producers, it generates a method to unset the property. Used with consumers, it generates code to call an unset method when an empty payload is received. | No, default: false |
| description | string | An optional description of the mapping. | No |
| doc | string | A string containing documentation that will be injected in the generated client code. | No |
Additional properties are allowed.
Property Details
astarte.mapping.schema.endpoint ✔
The template of the path. This is a UNIX-like path (e.g. /my/path) and can be parametrized. Parameters are in the %{name} form, and can be used to create interfaces which represent dictionaries of mappings. When the interface aggregation is object, an object is composed by all the mappings for one specific parameter combination. Refer to the mapping section of the interfaces page for further details on allowed parameter substitution values.
- Type:
string - Required: Yes
- Minimum Length:
>= 2 - Allowed Pattern:
^(/(%{([a-zA-Z_][a-zA-Z0-9_]*)}|[a-zA-Z_][a-zA-Z0-9_]*)){1,64}$
astarte.mapping.schema.type ✔
Defines the type of the mapping.
- Type:
string - Required: Yes
- Allowed values:
"double""integer""boolean""longinteger""string""binaryblob""datetime""doublearray""integerarray""booleanarray""longintegerarray""stringarray""binaryblobarray""datetimearray"
astarte.mapping.schema.reliability
Useful only with datastream. Defines whether the sent data should be considered delivered when the transport successfully sends the data (unreliable), when we know that the data has been received at least once (guaranteed) or when we know that the data has been received exactly once (unique). unreliable by default. When using reliable data, consider you might incur in additional resource usage on both the transport and the device's end.
- Type:
string - Required: No, default:
"unreliable" - Allowed values:
"unreliable""guaranteed""unique"
astarte.mapping.schema.explicit_timestamp
Allow to set a custom timestamp, otherwise a timestamp is added when the message is received. If true explicit timestamp will also be used for sorting. This feature is only supported on datastreams.
- Type:
boolean - Required: No, default:
false
astarte.mapping.schema.retention
Useful only with datastream. Defines whether the sent data should be discarded if the transport is temporarily uncapable of delivering it (discard) or should be kept in a cache in memory (volatile) or on disk (stored), and guaranteed to be delivered in the timeframe defined by the expiry. discard by default.
- Type:
string - Required: No, default:
"discard" - Allowed values:
"discard""volatile""stored"
astarte.mapping.schema.expiry
Useful when retention is stored. Defines after how many seconds a specific data entry should be kept before giving up and erasing it from the persistent cache. A value <= 0 means the persistent cache never expires, and is the default.
- Type:
integer - Required: No, default:
0
astarte.mapping.schema.database_retention_policy
Useful only with datastream. Defines whether data is expired from the database after a given time to live interval. When "no_ttl" is used data are not expired.
- Type:
string - Required: No
astarte.mapping.schema.database_retention_ttl
Useful when database_retention_policy is "use_ttl". Defines how many seconds a specific data entry should be kept before erasing it from the database.
- Type:
integer - Required: No
astarte.mapping.schema.allow_unset
Used only with properties. Used with producers, it generates a method to unset the property. Used with consumers, it generates code to call an unset method when an empty payload is received.
- Type:
boolean - Required: No, default:
false
astarte.mapping.schema.description
An optional description of the mapping.
- Type:
string - Required: No
astarte.mapping.schema.doc
A string containing documentation that will be injected in the generated client code.
- Type:
string - Required: No