protobuf.echo.proto Maven / Gradle / Ivy
option java_package = "org.accidia.echo.protos";
option java_outer_classname = "Protos";
/**
A DataSource represents either a database in MySQL or an instance of Redis.
Datasources are used by Tenants for accessing data; an exmaple of a MySQL
datasource is the datasource used by TenantService for storing and retrieving
tenant data:
{
"name": "echo",
"storage_type": "mysql",
"is_readonly": false,
"metadata": {
"entries": [
{ "name": "username", "value": "echo" },
{ "name": "password", "value": "echo" },
{ "name": "host_and_port", "value": "localhost:3307" },
{ "name": "database", "value": "echo" },
{ "name": "connection_properties", "value": "useUnicode=true&characterEncoding=UTF-8" },
{ "name": "test_connection_on_checkout", "value": "true" },
],
}
}
*/
message DataSource {
// a unique name associated to this datasource
required string name = 1;
// metadata to be used by the storage engine (mostly for initialization
// and creating connection pools, etc.)
message MetaData {
// generic key/value pairs of strings
required string name = 1;
required string value = 2;
}
repeated MetaData metadata = 2;
// whether or not the datasource allows write/archive operations
required bool readonly = 3;
// type of the storage; currently only mysql and redis are supported
enum StorageType { MYSQL = 1; MYSQL_KEYVALUE = 2; REDIS = 3; MEMCACHE = 4;}
required StorageType storage_type = 4;
}
/**
*
*/
message Tenant {
// the tenant name; this is usually the protobuf message type name
required string name = 1;
// a namespace assigned to this tenant; this is the table name if datasource is mysql
required string namespace = 2;
// name of the datasource to use for accessing objects of this tenant
required string datasource_name = 3;
// the actual protocol buffer description of the message as a string
// this is copied into a file and the compiled into .desc file to extract
// the data schema
required string protobuf_message = 4;
}
message Template {
required string name = 1;
optional string body = 2;
optional string content_type = 3;
}
/**
* every object is abstracted as a 'EchoObject'
* which holds both the 'key' used for look up, and the
* value of the object stored in bytes.
*/
message ObjectResult {
required string key = 1;
required string class_name = 2;
optional bytes object = 3;
}
message ObjectJsonResult {
required string key = 1;
required string class_name = 2;
optional string object = 3; // in json
}
/*
* Operations which result in a list of objects, return
* an instance of 'ListResult'.
*/
message ListResult {
repeated ObjectResult objects = 1;
optional string next = 2;
}
/*
* Operations which result in a hash-map of objects, return
* an instance of 'MapResult'.
*/
//message HashResult {
// message Entry {
// required string key = 1;
// required ObjectResult object = 2;
// }
// repeated Entry entries = 1;
//}
/*
* Operations which result in a set of objects, return
* an instance of 'SetResult'.
*/
//message SetResult {
// repeated ObjectResult objects = 1;
//}
/*
* Operations which result in a sorted-set of objects/scores, return
* an instance of 'SortedSetResult'.
*/
//message SortedSetResult {
// message Entry {
// required double score = 1;
// required ObjectResult object = 2;
// }
// repeated Entry entries = 1;
//}