syntax = "proto3";
package protolca.services;
option java_package = "org.openlca.proto.generated";
option csharp_namespace = "ProtoLCA.Services";
option go_package = ".;protolca";
import public "olca.proto";
message Empty {
}
message Status {
bool ok = 1;
string error = 2;
}
message RefStatus {
bool ok = 1;
protolca.Ref ref = 2;
string error = 3;
}
message ActorStatus {
bool ok = 1;
protolca.Actor actor = 2;
string error = 3;
}
message CategoryStatus {
bool ok = 1;
protolca.Category category = 2;
string error = 3;
}
message CurrencyStatus {
bool ok = 1;
protolca.Currency currency = 2;
string error = 3;
}
message DQSystemStatus {
bool ok = 1;
protolca.DQSystem dq_system = 2;
string error = 3;
}
message FlowStatus {
bool ok = 1;
protolca.Flow flow = 2;
string error = 3;
}
message FlowPropertyStatus {
bool ok = 1;
protolca.FlowProperty flow_property = 2;
string error = 3;
}
message ImpactCategoryStatus {
bool ok = 1;
protolca.ImpactCategory impact_category = 2;
string error = 3;
}
message ImpactMethodStatus {
bool ok = 1;
protolca.ImpactMethod impact_method = 2;
string error = 3;
}
message LocationStatus {
bool ok = 1;
protolca.Location location = 2;
string error = 3;
}
message ParameterStatus {
bool ok = 1;
protolca.Parameter parameter = 2;
string error = 3;
}
message ProcessStatus {
bool ok = 1;
protolca.Process process = 2;
string error = 3;
}
message ProductSystemStatus {
bool ok = 1;
protolca.ProductSystem product_system = 2;
string error = 3;
}
message ProjectStatus {
bool ok = 1;
protolca.Project project = 2;
string error = 3;
}
message SocialIndicatorStatus {
bool ok = 1;
protolca.SocialIndicator social_indicator = 2;
string error = 3;
}
message SourceStatus {
bool ok = 1;
protolca.Source source = 2;
string error = 3;
}
message UnitGroupStatus {
bool ok = 1;
protolca.UnitGroup unit_group = 2;
string error = 3;
}
// DescriptorRequest is a message type for getting descriptors from the data
// service. Note that all fields are optional and can have different meanings
// depending on the service function.
message DescriptorRequest {
// The model type of the requested descriptor(s).
ModelType type = 1;
// The ID of the requested descriptor.
string id = 2;
// The name of the requested descriptor(s).
string name = 3;
// The ID or full path of the category.
string category = 4;
}
message SearchRequest {
// The model type of the searched entities.
ModelType type = 1;
// The search query.
string query = 2;
}
message CreateSystemRequest {
enum DefaultProviders {
Prefer = 0;
Ignore = 1;
Only = 2;
}
// The (reference of the) process from which the product system should be
// generated. This will be the reference process of the product system
// with upstream and downstream processes added recursively.
Ref process = 1;
// Indicates how default providers of product inputs and waste outputs
// should be considered during the linking. `only` means that only
// product inputs and waste outputs should be linked that have a
// default provider and that this default provider is used. `prefer`
// means that a default provider is used during the linking if there
// are multiple options. `ignore` means that the default providers
// have no specific role.
DefaultProviders default_providers = 2;
// When there are multiple provider processes available for linking a
// product input or waste output the `preferred_type` indicates which
// type of process (LCI results or unit processes) should be preferred
// during the linking.
ProcessType preferred_type = 3;
}
service DataService {
// Deletes the object with the `id` and `type` of the given descriptor from
// the database. Note that the type is a string with the name of the
// corresponding model class, e.g. `Process` or `Flow`.
rpc Delete(protolca.Ref) returns (Status);
// Get all descriptors that match the given request.
rpc GetDescriptors(DescriptorRequest) returns (stream Ref);
// Get the first descriptor that matches the given request.
rpc GetDescriptor(DescriptorRequest) returns (RefStatus);
// Search for data sets.
rpc Search(SearchRequest) returns (stream Ref);
// Creates a new product system.
rpc CreateProductSystem(CreateSystemRequest) returns (RefStatus);
// methods for Actor
rpc GetActors(Empty) returns (stream protolca.Actor);
rpc GetActor(protolca.Ref) returns (ActorStatus);
rpc PutActor(protolca.Actor) returns (RefStatus);
// methods for Category
rpc GetCategories(Empty) returns (stream protolca.Category);
rpc GetCategory(protolca.Ref) returns (CategoryStatus);
rpc PutCategory(protolca.Category) returns (RefStatus);
// methods for Currency
rpc GetCurrencies(Empty) returns (stream protolca.Currency);
rpc GetCurrency(protolca.Ref) returns (CurrencyStatus);
rpc PutCurrency(protolca.Currency) returns (RefStatus);
// methods for DQSystem
rpc GetDQSystems(Empty) returns (stream protolca.DQSystem);
rpc GetDQSystem(protolca.Ref) returns (DQSystemStatus);
rpc PutDQSystem(protolca.DQSystem) returns (RefStatus);
// methods for Flow
rpc GetFlows(Empty) returns (stream protolca.Flow);
rpc GetFlow(protolca.Ref) returns (FlowStatus);
rpc PutFlow(protolca.Flow) returns (RefStatus);
// methods for FlowProperty
rpc GetFlowProperties(Empty) returns (stream protolca.FlowProperty);
rpc GetFlowProperty(protolca.Ref) returns (FlowPropertyStatus);
rpc PutFlowProperty(protolca.FlowProperty) returns (RefStatus);
// methods for ImpactCategory
rpc GetImpactCategories(Empty) returns (stream protolca.ImpactCategory);
rpc GetImpactCategory(protolca.Ref) returns (ImpactCategoryStatus);
rpc PutImpactCategory(protolca.ImpactCategory) returns (RefStatus);
// methods for ImpactMethod
rpc GetImpactMethods(Empty) returns (stream protolca.ImpactMethod);
rpc GetImpactMethod(protolca.Ref) returns (ImpactMethodStatus);
rpc PutImpactMethod(protolca.ImpactMethod) returns (RefStatus);
// methods for Location
rpc GetLocations(Empty) returns (stream protolca.Location);
rpc GetLocation(protolca.Ref) returns (LocationStatus);
rpc PutLocation(protolca.Location) returns (RefStatus);
// methods for Parameter
rpc GetParameters(Empty) returns (stream protolca.Parameter);
rpc GetParameter(protolca.Ref) returns (ParameterStatus);
rpc PutParameter(protolca.Parameter) returns (RefStatus);
// methods for Process
rpc GetProcesses(Empty) returns (stream protolca.Process);
rpc GetProcess(protolca.Ref) returns (ProcessStatus);
rpc PutProcess(protolca.Process) returns (RefStatus);
// methods for ProductSystem
rpc GetProductSystems(Empty) returns (stream protolca.ProductSystem);
rpc GetProductSystem(protolca.Ref) returns (ProductSystemStatus);
rpc PutProductSystem(protolca.ProductSystem) returns (RefStatus);
// methods for Project
rpc GetProjects(Empty) returns (stream protolca.Project);
rpc GetProject(protolca.Ref) returns (ProjectStatus);
rpc PutProject(protolca.Project) returns (RefStatus);
// methods for SocialIndicator
rpc GetSocialIndicators(Empty) returns (stream protolca.SocialIndicator);
rpc GetSocialIndicator(protolca.Ref) returns (SocialIndicatorStatus);
rpc PutSocialIndicator(protolca.SocialIndicator) returns (RefStatus);
// methods for Source
rpc GetSources(Empty) returns (stream protolca.Source);
rpc GetSource(protolca.Ref) returns (SourceStatus);
rpc PutSource(protolca.Source) returns (RefStatus);
// methods for UnitGroup
rpc GetUnitGroups(Empty) returns (stream protolca.UnitGroup);
rpc GetUnitGroup(protolca.Ref) returns (UnitGroupStatus);
rpc PutUnitGroup(protolca.UnitGroup) returns (RefStatus);
// Get possible providers for the given flow. For products
// these are processes with that product on the output side
// and for waste flows processes with that waste flow on the
// input side. For elementary flows, an empty stream is
// returned.
rpc GetProvidersFor(Ref) returns (stream Ref);
}
message FlowMapStatus {
bool ok = 1;
protolca.FlowMap flow_map = 2;
string error = 3;
}
message FlowMapInfo {
string name = 1;
}
service FlowMapService {
// Delete the flow map with the given name.
rpc Delete(FlowMapInfo) returns (Status);
// Get the flow map with the given name form the
// database.
rpc Get(FlowMapInfo) returns (FlowMapStatus);
// Get the information (basically just the names) of all
// flow maps that are available in the database.
rpc GetAll(Empty) returns (stream FlowMapInfo);
// Inserts the given flow map into the database. It overwrites
// an existing flow map if there is a flow map with the same
// name already available in the database.
rpc Put(protolca.FlowMap) returns (Status);
}
// A `Result` message is basically just a reference to a real result on the
// server side. As result data can be really large, we do not add them directly
// to the result. Instead you call the respective methods of the result service
// to get them. Because of this, you need to explicitly call `Dispose` when
// you do not need a result anymore. Otherwise you will create memory leaks
// as the result still exists on the server side.
message Result {
string id = 1 [json_name = "@id"];
}
message ResultStatus {
bool ok = 1;
Result result = 2;
string error = 3;
}
service ResultService {
// Calculates a result for the given calculation setup.
rpc Calculate(CalculationSetup) returns (ResultStatus);
// Get the inventory of the given result.
rpc GetInventory(Result) returns (stream FlowResult);
// Get the total impact assessment result of the given result.
rpc GetImpacts(Result) returns (stream ImpactResult);
// Disposes the given result on the server side.
rpc Dispose(Result) returns (Status);
}