|
6 | 6 | .. module:: datastore |
7 | 7 | :synopsis: Data persistence services |
8 | 8 |
|
9 | | -.. admonition:: Coming soon |
10 | | - :class: tip |
11 | | - |
12 | | - In this preview only data that has been saved in the factory data store is available for retrieval. For |
13 | | - the workshop, we have populated the ImageStore with several splashscreen background images. |
14 | | - |
15 | | -This module contains classes for managing storage and retrieval of application data. Persistent application |
16 | | -data is of two possible types: |
17 | | - |
18 | | - - *Factory settings:* Manufacturers can provision the DL-7450 with application data in the manufacturing |
19 | | - process, such as branded splashscreen backgrounds or the URL of a content provider. It |
20 | | - is also possible to provide unique-per-dock (UPD) data, such as enrolment tokens for IoT cloud service |
21 | | - providers. |
22 | | - - *Runtime settings:* Applications may store data that is not set in the factory, but which persists across |
23 | | - DL-7450 restarts. Such data may include access tokens for cloud providers or local network settings |
24 | | - that have been provisioned remotely after the dock has been deployed in an enterprise setting. |
| 9 | +This module contains classes for managing storage and retrieval of application |
| 10 | +data. Logically, the DL-7450 :py:mod:`datastore` is a single entity, with |
| 11 | +different partitions. There is an :py:class:`ImageStore` interface for |
| 12 | +retreiving images from the persistent data store. The image data is available |
| 13 | +as a python `bytearray` and the type is identified by one of the image type |
| 14 | +constants from the :py:mod:`image` module. Alternatively, a token may be used |
| 15 | +for later retreiving an image. This may reduce the number of copies of the |
| 16 | +image data created and used by your application. Simple key-value pairs can be |
| 17 | +stored and retrieved using the :py:class:`KvStore` interface. The python |
| 18 | +application itself also resides in the datastore, but is not explicitly |
| 19 | +accessible from the application. In later releases of the SDK, storage for |
| 20 | +futher types, such as fonts will be provided. |
| 21 | + |
| 22 | +Data may also be stored in different ways. Persistent application data is of |
| 23 | +two possible types: |
| 24 | + |
| 25 | + - *Factory settings* or *Read-only memory (ROM)* storage. Manufacturers can |
| 26 | + provision the DL-7450 with application data in the manufacturing process, |
| 27 | + such as branded splashscreen backgrounds or the URL of a content provider. |
| 28 | + It is also possible to provide unique-per-dock (UPD) data, such as |
| 29 | + enrolment tokens for IoT cloud service providers. |
| 30 | + - *Runtime settings:* Applications may store data that is not set in the |
| 31 | + factory, but which persists across DL-7450 restarts. Such data may include |
| 32 | + access tokens for cloud providers or local network settings that have been |
| 33 | + provisioned remotely after the dock has been deployed in an enterprise |
| 34 | + setting. |
25 | 35 |
|
26 | 36 | There is an additional non-persistent storage type: |
27 | 37 |
|
28 | | - - *Ephemeral settings:* Applications may store data that is useful at runtime, but is not essential to |
29 | | - store across dock restarts. For example, image data can be large, and it is not possible to keep many |
30 | | - on the Python runtime memory heap. In this case an application can store them in out-of-process memory |
31 | | - and retrieve them on demand. An example use-case is using the ephemeral storage area to avoid having |
32 | | - to make slow HTTP requests to obtain subsequent data. |
33 | | - |
34 | | -There is an :py:class:`ImageStore` interface for retreiving images from the persistent data stores. The image |
35 | | -data is available as a python `bytearray` and the type is identified by one of the image type constants from the |
36 | | -:py:mod:`image` module. Alternatively, a token may be used for later retreiving an image. This may reduce the number |
37 | | -of copies of the image data created and used by your application. |
38 | | - |
39 | | -Simple key-value pairs can be stored and retrieved using the :py:class:`KvStore` interface. |
40 | | - |
41 | | - |
42 | | -Constants |
43 | | ---------- |
44 | | - |
45 | | -.. data:: datastore.FACTORY_DATA |
46 | | - datastore.APPLICATION_DATA |
47 | | - |
48 | | - Pick whether to use application data or factory data. |
49 | | - |
50 | | -.. admonition:: Coming soon |
| 38 | + - *Ephemeral settings:* Applications may store data that is useful at |
| 39 | + runtime, but is not essential to store across dock restarts. For example, |
| 40 | + image data can be large, and it is not possible to keep many on the Python |
| 41 | + runtime memory storage. In this case an application can store them in |
| 42 | + out-of-process memory and retrieve them on demand. An example use-case is |
| 43 | + using the ephemeral storage area to avoid having to make slow HTTP |
| 44 | + requests to obtain subsequent data. |
| 45 | + |
| 46 | +When an application requests an item from the datastore, unless explicitly |
| 47 | +stated otherwise, there is an order of preference. For example if the |
| 48 | +application requests a splashscreen background with image tag *default_img*, |
| 49 | +first the ephemeral store will be checked, followed by the runtime store and |
| 50 | +finally the ROM/factory store. |
| 51 | + |
| 52 | +The amounts available for different types of data is currently as follows. |
| 53 | +There is no restriction on how data is distributed across the available |
| 54 | +storage, i.e. an applicaiton developer can use it as they see fit for code, |
| 55 | +images and key-value data. |
| 56 | + |
| 57 | + +--------------+----------------------------+ |
| 58 | + | Data Storage | Available | |
| 59 | + +==============+============================+ |
| 60 | + | Factory/ROM | 13MB | |
| 61 | + +--------------+----------------------------+ |
| 62 | + | Runtime | 13MB | |
| 63 | + +--------------+----------------------------+ |
| 64 | + | Ephemeral | 128MB | |
| 65 | + +--------------+----------------------------+ |
| 66 | + |
| 67 | + |
| 68 | +.. admonition:: Not-yet implemented |
51 | 69 | :class: tip |
52 | 70 |
|
53 | | - These constants aren't available in this preview, |
54 | | - and all data retrieval is from the factory data store. |
| 71 | + In the present version of the DL-7450 SDK only the application ROM store is |
| 72 | + implemented. |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +Application ROM Storage during development |
| 77 | +------------------------------------------ |
| 78 | + |
| 79 | +The Application ROM storage area, also referred to as *Factory storage* |
| 80 | +provides a mechanism to deploy a customer application and associated data in |
| 81 | +the manufacturing process. This enables the customer's DL-7450 dock to run the |
| 82 | +customer application on first boot after sale to the end user. The semantics of |
| 83 | +the application ROM store is as suggested by the name, a read-only data store. |
| 84 | +This supports a factory-reset operation on the dock. One usage pattern might be |
| 85 | +for a customer to ship a dock with a basic application in factory storage, |
| 86 | +which bootstraps another application that requires user-specific data in the |
| 87 | +field. Another usage pattern is that the application ROM store contains version |
| 88 | +N of the application, which can be updated to a later version which is stored |
| 89 | +in the runtime store. Yet another case is that the factory application might |
| 90 | +provide corporate imagery of the dock manufacturer, which can be overridden in |
| 91 | +the field by corporate imagery of the end-user. In all cases, a a factory reset |
| 92 | +will cause the application and its data to be restored to the state that it was |
| 93 | +manufactured in. |
| 94 | + |
| 95 | +Therefore, the :py:mod:`datastore` APIs in the DL-7450 SDK do not allow the ROM store |
| 96 | +area to be written to. While this is the required behaviour in a production |
| 97 | +docking station, it is too restrictive for development. To support development, |
| 98 | +DisplayLink has provided a REST API in our development cloud to populate the |
| 99 | +factory store. The details are provided with the :githubSamples:`supporting |
| 100 | +scripts </scripts/README.md>`. Note that the operation is atomic and |
| 101 | +destructive - i.e. the application ROM store is replaced in a single operation. |
| 102 | +This mechanism will not be available to docks in production. |
| 103 | + |
| 104 | +Ephemeral application code during development |
| 105 | +--------------------------------------------- |
| 106 | + |
| 107 | +To support development, DisplayLink provides a REST API to deploy new |
| 108 | +application code immediately to the dock. This makes use of ephemeral data |
| 109 | +storage. The details of how to use this API are given with the |
| 110 | +:githubSamples:`supporting scripts </scripts/README.md>`. |
55 | 111 |
|
56 | 112 |
|
57 | 113 | Classes |
|
0 commit comments