Global Resource Manager#
Overview#
Global Resource Manager (GRM) is used to manage global data in a secure collaborative system. The global data managed by GRM includes information about parties, table schemas, SCQL engine endpoints, and etc.
Why GRM?#
The SCQL system is only responsible for secure collaborative analytics, it does not own or manage data.
SCQL needs to know the following information when executing a query.
The schema information of the tables involved in the query includes detailed information such as the table columns and the data source type.
Data owner party node metadata, such as SCQLEngine endpoints.
Party identity management.
API#
VerifyTableOwnership#
When creating table, SCQL needs to verify whether the user holding the token owns the table specified by TID
Request#
Field |
Type |
Required |
Description |
|---|---|---|---|
tid |
string |
Y |
Table identifier provided by user when create table, read Create table for more information |
token |
string |
Y |
The token used to authenticate the user |
Response#
Field |
Type |
Required |
Description |
|---|---|---|---|
status |
Y |
Status of response |
|
is_owner |
bool |
Y |
True: user is the owner of the table |
Status#
Field |
Type |
Required |
Description |
|---|---|---|---|
code |
int32 |
Y |
The status code, 0 means success |
Messages |
string |
N |
Message for recording the error information. |
details |
protobuf.Any list |
N |
A list of messages for error details |
Example#
Request
{
"tid": "some_tid",
"token": "some_token"
}
Response
{
"status": {
"code": 0,
"message": "",
"details": []
},
"is_owner": true
}
GetTableMeta#
During creating table, after ensuring the ownership, SCQL needs to Get table schema from grm service.
Request#
Field |
Type |
Required |
Description |
|---|---|---|---|
tid |
string |
Y |
Unique table identifier |
request_party |
string |
Y |
The party code of request issuer |
token |
string |
Y |
The token used to authenticate the user |
Response#
Field |
Type |
Required |
Description |
|---|---|---|---|
status |
Y |
The status of response |
|
schema |
Y |
The party code of request issuer |
TableSchema#
Field |
Type |
Required |
Description |
|---|---|---|---|
db_name |
string |
Y |
The status of response |
table_name |
string |
Y |
The party code of request issuer |
columns |
ColumnDesc list |
Y |
The column info in the table |
ColumnDesc#
Field |
Type |
Required |
Description |
|---|---|---|---|
name |
string |
Y |
The column name |
type |
string |
Y |
The type of column value |
description |
string |
N |
The description of the column |
Example#
request
{
"tid": "1"
"request_party": "some_party",
"token": "some_token",
}
response
{
"status": {
"code": 0,
"message": "",
"details": []
},
"schema" {
"db_name": "some_da_name",
"table_name": "some_table_name"
"columns": [
{
"name": "col1",
"type": "long"
},
{
"name": "col2",
"type": "string"
}
]
}
}
GetEngines#
During executing the DQL submitted by the user holding the token, SCQL needs to get the engine information of the relevant parties.
Request#
Field |
Type |
Required |
Description |
|---|---|---|---|
party_codes |
string list |
Y |
Parties whose engine info need to be obtained |
token |
string |
Y |
Token used to authenticate the user |
Response#
Field |
Type |
Required |
Description |
|---|---|---|---|
status |
Y |
The status of response |
|
engine_infos |
EngineInfo list |
Y |
engine_infos[i] is engine info for party request.party_codes[i] |
EngineInfo#
Field |
Type |
Required |
Description |
|---|---|---|---|
endpoints |
string |
Y |
The url of engine |
credential |
string |
Y |
Credential used for engine to authenticate SCDB |
Example#
Request
{
"party_codes": ["party1", "party2"],
"token": "some_token"
}
Response
{
"status": {
"code": 0,
"message": "",
"details": []
},
"engine_infos": [
{
"endpoints": "party1_url",
"credential": "party1_credential"
},
{
"endpoints": "party2_url",
"credential": "party2_credential"
}
]
}