/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ syntax = "proto3"; package storage; option java_package = "org.apache.horaedb.proto.internal"; option java_outer_classname = "Storage"; option go_package = "github.com/apache/incubator-horaedb-proto/golang/pkg/storagepb"; import "common.proto"; import "prometheus.proto"; service StorageService { rpc Route(RouteRequest) returns (RouteResponse) {} rpc Write(WriteRequest) returns (WriteResponse) {} rpc StreamWrite(stream WriteRequest) returns (WriteResponse) {} rpc SqlQuery(SqlQueryRequest) returns (SqlQueryResponse) {} rpc StreamSqlQuery(SqlQueryRequest) returns (stream SqlQueryResponse) {} rpc PromRemoteQuery(PrometheusRemoteQueryRequest) returns (PrometheusRemoteQueryResponse) {} // This interface is mainly for testing now rpc PromQuery(PrometheusQueryRequest) returns (PrometheusQueryResponse) {} } message RequestContext { string database = 1; } message RouteRequest { RequestContext context = 1; repeated string tables = 2; } message Endpoint { string ip = 1; uint32 port = 2; } message Route { string table = 1; Endpoint endpoint = 2; } message RouteResponse { common.ResponseHeader header = 1; repeated Route routes = 2; } message Value { oneof value { double float64_value = 1; string string_value = 2; int64 int64_value = 3; float float32_value = 4; int32 int32_value = 5; int32 int16_value = 6; int32 int8_value = 7; bool bool_value = 8; uint64 uint64_value = 9; uint32 uint32_value = 10; uint32 uint16_value = 11; uint32 uint8_value = 12; int64 timestamp_value = 13; bytes varbinary_value = 14; } } message Field { uint32 name_index = 1; Value value = 2; } message FieldGroup { int64 timestamp = 1; repeated Field fields = 2; } message Tag { uint32 name_index = 1; Value value = 2; } message WriteSeriesEntry { repeated Tag tags = 1; repeated FieldGroup field_groups = 2; } message WriteTableRequest { string table = 1; repeated string tag_names = 2; repeated string field_names = 3; repeated WriteSeriesEntry entries = 4; } message WriteRequest { RequestContext context = 1; repeated WriteTableRequest table_requests = 2; } message WriteResponse { common.ResponseHeader header = 1; uint32 success = 2; uint32 failed = 3; } message SqlQueryRequest { RequestContext context = 1; repeated string tables = 2; string sql = 3; } message SqlQueryResponse { common.ResponseHeader header = 1; oneof output { uint32 affected_rows = 2; ArrowPayload arrow = 3; } } message ArrowPayload { enum Compression { NONE = 0; ZSTD = 1; } repeated bytes record_batches = 1; Compression compression = 2; } message PrometheusQueryRequest { RequestContext context = 1; prometheus.Expr expr = 2; // use oneof to represent option for scalar value // https://github.com/protocolbuffers/protobuf/issues/1606 oneof lookback_delta { int64 delta = 3; } } message PrometheusQueryResponse { common.ResponseHeader header = 1; // Samples within a time series must be ordered by time. repeated prometheus.TimeSeries timeseries = 2; } message PrometheusRemoteQueryRequest { RequestContext context = 1; // Encoded query for // https://github.com/prometheus/prometheus/blob/v2.43.0/prompb/remote.proto#L67 bytes query = 2; } message PrometheusRemoteQueryResponse { common.ResponseHeader header = 1; // Encoded response for // https://github.com/prometheus/prometheus/blob/v2.43.0/prompb/remote.proto#L74 bytes response = 2; }