RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
Expand | ||
---|---|---|
Info | ||
| ||
|
...
LISA component is part of RDK DAC framework on STB and is an abbreviation for Local Inventory & Storage Manager of DAC Apps. Its responsibility is:
Lisa is implemented as Thunder out-of-process plugin. Can be run in a separate container
...
current git repo location :
...
current git repo location : https://github.com/rdkcentral/LISA
...
Not everything of api full design has been implemented in LISA code so far. Focus has been mainly on Minimum Viable Product
...
DEMO video of app installation from DAC cloud using cli tool. You can see in shell on button the logs of LISA in action.
https://drive.google.com/file/d/11QXXM9WBg8Sw76Eikg5FyodrpIfoBnkL/view
...
The refapp "resident App" that comes with RDK reference image uses lisa for downloading DAC bundles. It is a consumer of LISA api.
Here are pointers to its code on where/how it uses LISA
https://github.com/LibertyGlobal/refapp/search?q=LISA
TODO: Point to code where in resident UI of VA LISA is used (on RDK6.1 VA image)
LISA is an alternative to the Packager Thunder Plugin used to retrieve ipkg packages, see https://github.com/rdkcentral/rdkservices/blob/master/Packager/doc/PackagerPlugin.md
...
use getMetadata {"type":"application/LISA", "id":"lisa.dac.confg", "version":"0"} API to learn the recommended "dacBundlePlatformNameOverride" & "dacBundleFirmwareCompatibilityKey" for this platform and "configUrl" as kickstart Url to learn ASMS url
During integration (and not part of the design) we decided to define a specific app_id "lisa.dac.config" of type "application/LISA" in LISA that can be used by resident UI to learn the default platform parameters it should use towards DAC cloud when requesting bundle_url for the particular platform it is running on. This is to learn the "dacBundlePlatformNameOverride" & "dacBundleFirmwareCompatibilityKey" platform parameters. There is also "configUrl" parameter Resident UI will use as kick start URL from which it will learn ASMS environment URL to use. see code in Resident UI that uses this https://code.rdkcentral.com/r/plugins/gitiles/components/opensource/RDK_apps/+/refs/heads/6.1.0/accelerator-home-ui/src/api/LISAApi.js#75 (see Jira RDKUI-649 and RDKUI-620 )
Video Accelerator is the default UI on the RDKM Video Accelerator.
There is UI section which allows you to install DAC apps from DAC cloud. It use LISA API to support this use case (and to getlist of installed DAC app at init time)
see code where LISA API is being used
see video with an explanation of how to use that UI
The refapp "resident App" that comes with RDK reference image uses LISA for installing/deleting DAC bundles.
Here are pointers to its code on where/how it uses LISA
https://github.com/LibertyGlobal/refapp/search?q=LISA
DEMO video of app installation from DAC cloud using cli tool. You can see in shell on button the logs of LISA in action.
LISA provides logical tree/directory structure for its various type of data to store as visualized in diagram below.
The logical storages: [APPS] and [APPS_STORAGE] are configurable per platform as part of LISA thunder plugin config.
draw.io Diagram | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
files of App in App oci bundle are stored in [APPS] storage.
Paths:
Important, LISA's sqlite database of Apps and metadata can be located there eg : [APPS]/dac/db/{epoch}/apps.db
Apps persistent storage is located in [APPS_STORAGE].
Paths:
Apps' persistent storage: [APPS_STORAGE]/dac/{epoch}/{id}/
Epoch indicator {epoch} is used for easy invalidation of not supported or revoked format of apps on fundamental changes. May also be used for the antirollback (db authentication - TBD?)
LISA is able to handle the following data:
Before implementation, at the design stage, the following API in json schema has been defined LISA API .
In later design phase additional lock/unlock api allowing external application manager to signal LISA that a specific app from LISA database is in active use by End user and hence should not be deleted/upgraded at this moment, see description in LISA API Extension (Locking mechanism)#APISchema
Actual Thunder interface definition/api is in defined in dual COM RPC / JSON- RPC interface in https://github.com/rdkcentral/ThunderInterfaces/blob/R2/interfaces/ILISA.h with annotations to automatically autogenerate* the JSON RPC api at build time
In section below we provide more explanation with the API methods.
API is to be exposed in JSON-RPC over WebSocket like other JSON-RPC thunder services
For mat is of style :
Code Block | ||||
---|---|---|---|---|
| ||||
{"jsonrpc":"2.0","id":{id},"method":"com.lgi.dac.lisa.1.methodName", "params":{payload}} |
{id} - An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.
{payload} - A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
In many of below methods you need to enter "type" <string> of application you want do the method operation for. The only use case we defined for now is installing DAC apps, for that use type as defined in ASMS environment you are working against (that is what resident UI will do). in RDK ASMS instance this is "application/dac.native". (Note that in LG ASMS OneMW instance type "application/vnd.rdk-app.dac.native" is used for DAC apps)
Download the application bundle tarball from the given URL, unpack files to dedicated directory, create the db entries and persistent storage on success. Asynchronous operation, handle should be used for tracking the request. The id of an app is unique within the database. That means only one kind of (mime)type can be combined and saved with a specific app id.
Request payload: {"type":"<string>", "id":"<string>", "version":"<string>", "url":"<string>", "appName":"<string>", "category":"<string>"}
As per above comment "type" in RDKM environment will be "application/dac.native"
Result payload: {"handle":"<string>"}
parameter and errors | values |
---|---|
errors |
|
handle | handle to refer with the following requests |
Uninstall the application: remove application files and - optionally - persistent storage and db entry. Non-blocking operation, handle should be used for tracking the request.
Request payload: {"type":"<string>", "id":"<string>", "version":"<string>", "uninstallType
...
LISA is able to handle the following data:
Before implementation, at the design stage, the following API in json schema has been defined LISA API .
In later design phase additional lock/unlock api allowing external application manager to signal LISA that a specific app from LISA database is in active use by End user and hence should not be deleted/upgraded at this moment, see description in LISA API Extension (Locking mechanism)#APISchema
Actual Thunder interface definition/api is in defined in dual COM RPC / JSON- RPC interface in https://github.com/rdkcentral/ThunderInterfaces/blob/R2/interfaces/ILISA.h with annotations to automatically autogenerate* the JSON RPC api at build time
In section below we provide more explanation with the API methods.
API is to be exposed in JSON-RPC over WebSocket like other JSON-RPC thunder services
For mat is of style :
Code Block | ||||
---|---|---|---|---|
| ||||
{"jsonrpc":"2.0","id":{id},"method":"com.lgi.dac.lisa.1.methodName", "params":{payload}} |
{id} - An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.
{payload} - A Structured value that holds the parameter values to be used during the invocation of the method. This member MAY be omitted.
Download the application bundle tarball from the given URL, unpack files to dedicated directory, create the db entries and persistent storage on success. Asynchronous operation, handle should be used for tracking the request. The id of an app is unique within the database. That means only one kind of (mime)type can be combined and saved with a specific app id.
Request payload: {"type":"application/vnd.rdk-app.dac.native", "id":"<string>", "version":"<string>", "url":"<string>", "appName":"<string>", "category":"<string>"}
Result payload: {"handle":"<string>"}
...
...
"<string>"}
parameters and errors | values |
---|---|
uninstallType |
|
errors |
|
handle | handle to refer with the following requests |
Download arbitrary application's resource, e.g. icon. Resource are stored per application id/version. Asynchronous operation, handle should be used for tracking the request. If the resource of given resKey already exists it is replaced by the newly downloaded resource. If the resKey is unique, but the requested resource file already exists on the filesystem, the file should be stored under a different, unique filename, created by appending a suffix to the existing filename.
Request payload: {"type":"<string>", "id":"<string>", "version":"<string>", "resKey":"<string>", "url":"<string>"}
Result payload: {"handle":"<string>"}
parameters and errors | values |
---|---|
resKey |
|
Uninstall the application: remove application files and - optionally - persistent storage and db entry. Non-blocking operation, handle should be used for tracking the request.
Request payload: {"type":"application/vnd.rdk-app.dac.native", "id":"<string>", "version":"<string>", "uninstallType":"<string>"}
Result payload: {"handle":"<string>"}
errors |
|
handle | handle to refer with the following requests |
Deletes the content of the database and/or persistent storage and/or all resources for the application. Synchronous operation, returns response on success or failure. Optional parameters type, id, version are used to filter the applications on which the reset will be performed. If they are not given, the reset operation affects all the data. Synchronous operation, returns a response on success or failure. Download arbitrary application's resource, e.g. icon. Resource are stored per application id/version. Asynchronous operation, handle should be used for tracking the request. If the resource of given resKey already exists it is replaced by the newly downloaded resource. If the resKey is unique, but the requested resource file already exists on the filesystem, the file should be stored under a different, unique filename, created by appending a suffix to the existing filename.
Request payload: {"type":"application/vnd.rdk-app.dac.native", "id":"<string>", "version":"<string>", "resKeyresetType":"<string>", "url}
Response payload: {"status":"<string>"}
Result payload: {"handle":"<string>"}
parameters and errors | values |
---|---|
version |
|
resetType |
|
parameters and errors | values |
resKey |
|
errors |
|
handle | handle to refer with the following requests |
...
|
Returns information on the storage usage. Depending on provided parameters: overall storage usage, application id storage or application id/version storage. Synchronous operation, returns a response on success or failure. Notes on implementation:
Request payload: {"type":"application/vnd.rdk-app.dac.native", "id":"<string>", "version":"<string>", "resetType":"<string>"}
Response payload: {"status":"<string>"}
"<string>"}
Result payload: {"storage":"<storagePayload>"}
parameters and errors | values |
---|---|
type |
|
id |
|
version |
|
errors |
|
Returns information on the storage usage. Depending on provided parameters: overall storage usage, application id storage or application id/version storage. Synchronous operation, returns a response on success or failure. Notes on implementation:
storagePayload | {"apps":{"path":"<string>", "quotaKB":"<string>", "usedKB":"<string>"}, "persistent":{"path":"<string>", "quotaKB":"<string>", "usedKB":"<string>"}} |
Returns a list of installed applications filtered using optional filtering criteria: type, id, version, appName, category. Synchronous operation, returns a response on success or failure.
Request payload: {"type":"<string>Request payload: {"type":"application/vnd.rdk-app.dac.native", "id":"<string>", "version":"<string>","appName":"<string>","category":"<string>"}
Result payloadResultpayload: {"storageapps":"<storagePayload><appsPayload>"}
parameters and errors | values | ||
---|---|---|---|
type |
| ||
id |
| ||
version |
| version |
|
errors |
| ||
storagePayload | {"apps":{"path":"<string>", "quotaKB":"<string>", "usedKB":"<string>"}, "persistent":{"path":"<string>", "quotaKB":"<string>", "usedKB":"<string>"}} |
Returns a list of installed applications filtered using optional filtering criteria: type, id, version, appName, category. Synchronous operation, returns a response on success or failure.
...
| |
appName |
|
category |
|
status |
|
appsPayload | {"apps":["app":{"type":"<string>", "id":"<string>", "installed":[{"version":"<string>", "appName":"<string>", "category":"<string>" |
...
,"url":" |
...
<string>"} |
...
...
...
...
...
...
]}]}
|
Set an arbitrary key+value metadata for a given application. The existing metadata key is replaced (overwritten) by the provided key/value pair. Synchronous operation, returns a response on success or failure.
Request payload: {"type":"application/vnd.rdk-app.dac.native
...
", "id":"<string>",
...
"
...
version":"<string>","
...
key":
...
<string>
...
,"
...
value":
...
<string>}
Result payload: {}
parameters and errors | values |
---|---|
errors |
|
Get all metadata stored for given application version. Synchronous operation, returns a response on success or failure.
Request payload: {"type":"<string>", "id":"<string>", "version":"<string>"}
Response payload: {"status":"<string>","metadata":}
parameters and errors | values |
---|---|
errors |
|
metadataPayload | {"appName":"<string>", "category |
Set an arbitrary key+value metadata for a given application. The existing metadata key is replaced (overwritten) by the provided key/value pair. Synchronous operation, returns a response on success or failure.
...
":"<string>"," |
...
url":"<string>", |
...
"resources":[{"<string>":"<string>"}]},"auxMetadata":<auxMetadataPayload>}
|
Cancel previous asynchronous request.
Request payload: {"handle":"<string>"}
Response "value":<string>}Result payload: {"status":"<string>"}
parameters and errors | values |
---|---|
errors |
|
handle |
|
errors |
|
Get estimated progress of an asynchronous operation.Get all metadata stored for given application version. Synchronous operation, returns a response on success or failure.
Request payload: {"typehandle":"application/vnd.rdk-app.dac.native", "id":"<string>", "version":"<string>"}
Response payload: {"status":"<string>", "metadataprogress":<number>}
parameters and errors | values |
---|---|
errors |
| metadataPayload | {"appName
handle |
|
status |
|
progress |
|
Notification sent on the completion of asynchronous operation.
payload: {"handle":"<string>", "
...
status":"<string>", "
...
details":
...
"<string>
...
"
...
Cancel previous asynchronous request.
Request payload: {"handle":"<string>"}
Response payload: {"status":"<string>"}
...
...
Get estimated progress of an asynchronous operation.
Request payload: {"handle":"<string>"}
Response payload: {"status":"<string>", "progress":<number>}
...
...
...
}
parameters and errors | values |
---|---|
handle |
|
status |
|
details |
|
LISA is an alternative to the Packager Thunder Plugin used to retrieve ipkg packages, see https://github.com/rdkcentral/rdkservices/blob/master/Packager/doc/PackagerPlugin.md
Existing Packager API (RDK services github) | Proposed Packager API (DAC RDK wiki) | LISA API |
---|---|---|
install (package, version, architecture) | install (id, type, URL, token, listener) → (id, task, success) | install (type, id, version, URL, appName, category), → (status, handle) |
remove (id, listener) → (id, task, success) | uninstall (type, id, version, uninstallType), → (status, handle) | |
operationStatus→ (handle, status, details) | ||
cancel (task, listener) → (success) | cancel (handle) → (status) | |
isInstalled (id) → (success) | - | |
getInstallProgress (task) → ( percent) | getProgress (handle) → (status, percent) | |
getInstalled() → (applications) | getList (filter) → (array of {type, id, version, metadata}) | |
getPackageInfo(id) → (metadata) | getMetadata(type, id, version) → (metadata) | |
- | setMetadata(type, id, version, tag, metadata) | |
getAvaialbleSpace() → (space) | getStorageDetails() → (path, quota, size, persistentStoragePath, persistentStorageQuota, persistentStorageSize) | |
synchronize() | - |
Notification sent on the completion of asynchronous operation.
payload: {"handle":"<string>", "status":"<string>", "details":"<string>"}
...
draw.io Diagram | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
(is not IMPLEMENTED, was not required for MVP since bundles are encrypted and signed)
API to be implemented by the library:
|
(is not IMPLEMENTED, was not required for MVP since bundles are encrypted and signed)
API to be implemented by the library:
...
draw.io Diagram | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Note:
The 2 tables in the db schema (apps and installed_apps) are required to be able to correctly handle the case when the application is uninstalled, deleted because of corruption, deleted because of storage capacity issue, or not installed locally (launched from the cloud) but operator or user wants to keep persistent storage of given application intact (for later usage). In this case, an entry in apps table keeps tracking the persistent storage without introducing any other dirty hacks. This approach will also be useful for managing remote applications, for which we don't need to maintain the application's locally downloaded files, but persistent storage might be needed.
Code Block | ||||
---|---|---|---|---|
| ||||
-- enable support for foreign keys, available since sqlite version 3.6.19 (2009-10-14)
PRAGMA foreign_keys = ON |
...
Note:
The 2 tables in the db schema (apps and installed_apps) are required to be able to correctly handle the case when the application is uninstalled, deleted because of corruption, deleted because of storage capacity issue, or not installed locally (launched from the cloud) but operator or user wants to keep persistent storage of given application intact (for later usage). In this case, an entry in apps table keeps tracking the persistent storage without introducing any other dirty hacks. This approach will also be useful for managing remote applications, for which we don't need to maintain the application's locally downloaded files, but persistent storage might be needed.
Code Block | ||||
---|---|---|---|---|
| ||||
-- enable support for foreign keys, available since sqlite version 3.6.19 (2009-10-14) PRAGMA foreign_keys = ON; -- table for application ids and persistent storage CREATE TABLE IF NOT EXISTS apps( idx INTEGER PRIMARY KEY, -- unique index for the application type/id type TEXT NOT NULL, -- MIME type app_id TEXT UNIQUE NOT NULL, -- unique id of app within given MIME type data_path TEXT, -- path to app peristent storage, relative to [APPS_STORAGE]/{epoch} created TEXT NOT NULL -- unix epoch timestamp of when the application entry was created ); -- table for installedapplication applicationsids inand specificpersistent versionsstorage CREATE TABLE IF NOT EXISTS installed_apps ( idx INTEGER PRIMARY KEY, -- unique index for the application type/id/version app_ apps( idx INTEGER NOTPRIMARY NULLKEY, -- reference to apps table, unique index offor the application type/id versiontype TEXT NOT NULL, -- versionMIME oftype the application name app_id TEXT UNIQUE NOT NULL, -- nameunique id of theapp application category TEXT, -- category url TEXT, -- URL from which the application was downloaded appwithin given MIME type data_path TEXT, -- path to app peristent filesstorage, realtiverelative to [APPS_STORAGE]/{epoch} created TEXT NOT NULL, -- unix epoch timestamp of when the application entry was created ); -- table for installed resources TEXT applications in specific versions CREATE TABLE IF NOT EXISTS installed_apps ( idx INTEGER PRIMARY KEY, -- jsonunique objectindex withfor downloadedthe resources metadata metadata TEXTapplication type/id/version app_idx INTEGER NOT NULL, -- json object with auxiliary resources metadata FOREIGN KEY(app_idx) REFERENCES apps(idx), UNIQUE(app_idx, version) ); |
1. print tables
SELECT sql FROM sqlite_master WHERE name = 'apps';
SELECT sql FROM sqlite_master WHERE name = 'installed_apps';
2. insert app id
INSERT INTO apps VALUES(NULL, 'application/vnd.rdk-app.dac.native', 'com.lgi.app3', 'dac.native/com.lgi.app3/data', strftime('%s','now'));
3. get app_id of given app
SELECT idx,type,app_id FROM apps WHERE type = 'application/vnd.rdk-app.dac.native' AND app_id = 'com.lgi.app3';
4. insert new application version
INSERT INTO installed_apps VALUES(NULL, <app_idx>, '1.0.0', 'Super-app', 'Game', 'http://download.com/bundle1.tgz', 'dac.native/com.lgi.app3/1.0.0/app', strftime('%s','now'), NULL, NULL, NULL);
5. SELECT app version
SELECT DISTINCT apps.type,apps.app_id,installed_apps.version,installed_apps.metadata FROM installed_apps,apps WHERE apps.type='application/vnd.rdk-app.dac.native' AND apps.app_id='com.lgi.app3' AND installed_apps.version="1.0.0";
reference to apps table, index of the application type/id
version TEXT NOT NULL, -- version of the application
name TEXT NOT NULL, -- name of the application
category TEXT, -- category
url TEXT, -- URL from which the application was downloaded
app_path TEXT, -- path to app files, realtive to [APPS]/{epoch}
created TEXT NOT NULL, -- unix epoch timestamp of when the application was installed
resources TEXT, -- json object with downloaded resources metadata
metadata TEXT, -- json object with auxiliary resources metadata
FOREIGN KEY(app_idx) REFERENCES apps(idx),
UNIQUE(app_idx, version)
);
|
1. print tables
SELECT sql FROM sqlite_master WHERE name = 'apps';
SELECT sql FROM sqlite_master WHERE name = 'installed_apps';
2. insert app id
INSERT INTO apps VALUES(NULL, 6. set meatdata for given app/version
SELECT DISTINCT installed_apps.idx,installed_apps.metadata FROM installed_apps,apps WHERE apps.type= 'application/vnd.rdk-app.dac.native' AND apps.app_id=, 'com.lgi.app3' AND installed_apps.version="1.0.0";
UPDATE installed_apps SET metadata = '{[{"description","New nice application."},{"parental":"5"}]}' WHERE idx=<idx>;
The logical storages: [APPS] and [APPS_STORAGE] should be defined per platform, to use concrete physical storages.
files of App in App oci bundle are stored in [APPS] storage.
Paths:
Important, LISA's database can be located there eg : [APPS]/dac/db/{epoch}/apps.db
Apps persistent storage is located in [APPS_STORAGE].
Paths:
Apps' persistent storage: [APPS_STORAGE]/dac/{epoch}/{id}/
', 'dac.native/com.lgi.app3/data', strftime('%s','now'));
3. get app_id of given app
SELECT idx,type,app_id FROM apps WHERE type = 'application/vnd.rdk-app.dac.native' AND app_id = 'com.lgi.app3';
4. insert new application version
INSERT INTO installed_apps VALUES(NULL, <app_idx>, '1.0.0', 'Super-app', 'Game', 'http://download.com/bundle1.tgz', 'dac.native/com.lgi.app3/1.0.0/app', strftime('%s','now'), NULL, NULL, NULL);
5. SELECT app version
SELECT DISTINCT apps.type,apps.app_id,installed_apps.version,installed_apps.metadata FROM installed_apps,apps WHERE apps.type='application/vnd.rdk-app.dac.native' AND apps.app_id='com.lgi.app3' AND installed_apps.version="1.0.0";
6. set meatdata for given app/version
SELECT DISTINCT installed_apps.idx,installed_apps.metadata FROM installed_apps,apps WHERE apps.type='application/vnd.rdk-app.dac.native' AND apps.app_id='com.lgi.app3' AND installed_apps.version="1.0.0";
UPDATE installed_apps SET metadata = '{[{"description","New nice application."},{"parental":"5"}]}' WHERE idx=<idx>;Epoch indicator {epoch} is used for easy invalidation of not supported or revoked format of apps on fundamental changes. May also be used for the antirollback (db authentication - TBD?)
...