Introduction
The container for the OpenRAP 2.0 has been developed on top of ext-framework. The additions on top of ext-framework are:
...
Code Block |
---|
|
/* Method to get the instance of the download manager */
getInstance = function(String pluginId) : DownloadManager {};
/*
* Method to queue the download of a file
* @param file - The file to download
* @param path - Path to download the file
* @return downloadId - The download id reference
*/
download = function(String file, String path) : String {};
/*
* Method to queue the download of a file
* @param file - The file to download
* @param path - Path to download the file
* @return downloadId - The download id reference
*/
download = function(String[] files, String folder) : String {};
/*
* Method to get the status of the download
* @param downloadId String
* @return Download object
*/
get = function(String downloadId) : DownloadObject {};
/*
* Method to pause the download
* @param downloadId String
*/
pause = function(String downloadId) : Promise {};
/*
* Method to cancel the download
* @param downloadId String
*/
cancel = function(String downloadId) : Promise {};
/*
* Method to pause all the downloads for the given plugin
* @param downloadId String
*/
pauseAll = function() : Promise {};
/*
* Method to cancel all the downloads for the given plugin
* @param downloadId String
*/
cancelAll = function() : Promise {};
/*
* Method to list the download queue based on the status
* @param status String - The status of the download - Submitted, Complete, InProgress, Failed. Blank option will return all status
* @return Array - Array of download objects
*/
list = function(String status): DownloadObject[] {};
DownloadObject = {
id: String, // Download id
status: String, // Submitted, InProgress, Complete, Failed.
createdOn: Date,
updatedOn: Date,
stats: {
totalFiles: Number, // Total files to download
downloadedFiles: Number, // Total files downloaded so far
totalSize: Number, // Total number of bytes to download
downloadedSize: Number, // Total number of bytes downloaded so far
},
files: [{ // Status of each file within the given download
file: String, // File that is downloaded
source: String, // source from where it is downloaded
path: String, // Relative path where the file is downloaded to
size: Integer, // Total file size in bytes
downloaded: Integer // Downloaded until now
}]
}
// EVENTS
// Following are the events fired within the SDK
"<plugin>:download:complete"
EventManager.dispatch("sunbirded:download:complete", {
id: String, // Download Id
files: [{
file: String, // File that is downloaded
source: String, // source from where it is downloaded
path: String, // Relative path where the file is downloaded to
size: Integer // file size in bytes
}]
}); |
...
- Does encryption needs to be part of container or plugin
...
Database Schema
...
plugin_registry
Code Block |
---|
|
{
document: {
"_id": String, // Plugin Id
"config": {} // Plugin config
},
index: []
} |
...
settings
Code Block |
---|
|
{
document: {
"_id": String, // Setting id
"value": Object // Setting value
},
index: []
} |
...
telemetry
A document database is created for each plugin telemetry storage - <plugin_id>_telemetry
Code Block |
---|
|
{
document: {
"_id": String, // mid of the event
"event": {} // event
},
index: []
} |
...
telemetry_packets
Code Block |
---|
|
{
document: {
"_id": String, // packet id
"pluginId": String, // Plugin id the packet belongs to
"status": String, // status of the packet. Synced/NotSynced
"statusMsg": String, // Associated message to the status
"createdOn": Date, // Date of packet creation
"updatedOn": Date, // Date when the document is updated
"size": Number, // Size of the events in the packet
"events": [] // events
},
index: [pluginId, status, updatedOn]
} |
...
download_queue
Code Block |
---|
|
{
document: {
"_id": String, // Download Id
"pluginId": String, // Plugin id the download object belongs to
status: String, // Submitted, InProgress, Complete, Failed.
statusMsg: String, // Associated message to the status
createdOn: Date,
updatedOn: Date,
stats: {
totalFiles: Number, // Total files to download
downloadedFiles: Number, // Total files downloaded so far
totalSize: Number, // Total number of bytes to download
downloadedSize: Number, // Total number of bytes downloaded so far
},
files: [{ // Status of each file within the given download
file: String, // File that is downloaded
source: String, // source from where it is downloaded
path: String, // Relative path where the file is downloaded to
size: Integer, // Total file size in bytes
downloaded: Integer // Downloaded until now
}]
},
index: [pluginId, status, updatedOn]
} |
...