Multitenant streams api (#72)

This commit is contained in:
Dominic Wong
2021-03-18 17:21:41 +00:00
committed by GitHub
parent 28ad626d91
commit 8dfe49f813
87 changed files with 1890 additions and 1064 deletions

View File

@@ -7,8 +7,13 @@ init:
go get github.com/micro/micro/v3/cmd/protoc-gen-micro
.PHONY: proto
proto:
protoc --proto_path=. --micro_out=. --go_out=:. proto/sentiment.proto
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/sentiment.proto
.PHONY: docs
docs:
protoc --openapi_out=. --proto_path=. --micro_out=. --go_out=:. proto/sentiment.proto
@redoc-cli bundle api-sentiment.json
.PHONY: build
build:
go build -o sentiment *.go

View File

@@ -1,129 +1,225 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.15.5
// source: proto/sentiment.proto
package sentiment
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type Request struct {
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
Lang string `protobuf:"bytes,2,opt,name=lang,proto3" json:"lang,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
Lang string `protobuf:"bytes,2,opt,name=lang,proto3" json:"lang,omitempty"`
}
func (m *Request) Reset() { *m = Request{} }
func (m *Request) String() string { return proto.CompactTextString(m) }
func (*Request) ProtoMessage() {}
func (x *Request) Reset() {
*x = Request{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_sentiment_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Request) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Request) ProtoMessage() {}
func (x *Request) ProtoReflect() protoreflect.Message {
mi := &file_proto_sentiment_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Request.ProtoReflect.Descriptor instead.
func (*Request) Descriptor() ([]byte, []int) {
return fileDescriptor_ab79e813d74ef963, []int{0}
return file_proto_sentiment_proto_rawDescGZIP(), []int{0}
}
func (m *Request) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Request.Unmarshal(m, b)
}
func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Request.Marshal(b, m, deterministic)
}
func (m *Request) XXX_Merge(src proto.Message) {
xxx_messageInfo_Request.Merge(m, src)
}
func (m *Request) XXX_Size() int {
return xxx_messageInfo_Request.Size(m)
}
func (m *Request) XXX_DiscardUnknown() {
xxx_messageInfo_Request.DiscardUnknown(m)
}
var xxx_messageInfo_Request proto.InternalMessageInfo
func (m *Request) GetText() string {
if m != nil {
return m.Text
func (x *Request) GetText() string {
if x != nil {
return x.Text
}
return ""
}
func (m *Request) GetLang() string {
if m != nil {
return m.Lang
func (x *Request) GetLang() string {
if x != nil {
return x.Lang
}
return ""
}
type Response struct {
Score float64 `protobuf:"fixed64,1,opt,name=score,proto3" json:"score,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Score float64 `protobuf:"fixed64,1,opt,name=score,proto3" json:"score,omitempty"`
}
func (m *Response) Reset() { *m = Response{} }
func (m *Response) String() string { return proto.CompactTextString(m) }
func (*Response) ProtoMessage() {}
func (x *Response) Reset() {
*x = Response{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_sentiment_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Response) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Response) ProtoMessage() {}
func (x *Response) ProtoReflect() protoreflect.Message {
mi := &file_proto_sentiment_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Response.ProtoReflect.Descriptor instead.
func (*Response) Descriptor() ([]byte, []int) {
return fileDescriptor_ab79e813d74ef963, []int{1}
return file_proto_sentiment_proto_rawDescGZIP(), []int{1}
}
func (m *Response) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Response.Unmarshal(m, b)
}
func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Response.Marshal(b, m, deterministic)
}
func (m *Response) XXX_Merge(src proto.Message) {
xxx_messageInfo_Response.Merge(m, src)
}
func (m *Response) XXX_Size() int {
return xxx_messageInfo_Response.Size(m)
}
func (m *Response) XXX_DiscardUnknown() {
xxx_messageInfo_Response.DiscardUnknown(m)
}
var xxx_messageInfo_Response proto.InternalMessageInfo
func (m *Response) GetScore() float64 {
if m != nil {
return m.Score
func (x *Response) GetScore() float64 {
if x != nil {
return x.Score
}
return 0
}
func init() {
proto.RegisterType((*Request)(nil), "sentiment.Request")
proto.RegisterType((*Response)(nil), "sentiment.Response")
var File_proto_sentiment_proto protoreflect.FileDescriptor
var file_proto_sentiment_proto_rawDesc = []byte{
0x0a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x6e,
0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65,
0x6e, 0x74, 0x22, 0x31, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a,
0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78,
0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6c, 0x61, 0x6e, 0x67, 0x22, 0x20, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01,
0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x32, 0x41, 0x0a, 0x09, 0x53, 0x65, 0x6e, 0x74, 0x69,
0x6d, 0x65, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x07, 0x41, 0x6e, 0x61, 0x6c, 0x79, 0x7a, 0x65, 0x12,
0x12, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x11, 0x5a, 0x0f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x3b, 0x73, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
func init() { proto.RegisterFile("proto/sentiment.proto", fileDescriptor_ab79e813d74ef963) }
var (
file_proto_sentiment_proto_rawDescOnce sync.Once
file_proto_sentiment_proto_rawDescData = file_proto_sentiment_proto_rawDesc
)
var fileDescriptor_ab79e813d74ef963 = []byte{
// 161 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2d, 0x28, 0xca, 0x2f,
0xc9, 0xd7, 0x2f, 0x4e, 0xcd, 0x2b, 0xc9, 0xcc, 0x4d, 0xcd, 0x2b, 0xd1, 0x03, 0xf3, 0x85, 0x38,
0xe1, 0x02, 0x4a, 0x86, 0x5c, 0xec, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c,
0x2c, 0x25, 0xa9, 0x15, 0x25, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0x36, 0x48, 0x2c,
0x27, 0x31, 0x2f, 0x5d, 0x82, 0x09, 0x22, 0x06, 0x62, 0x2b, 0x29, 0x70, 0x71, 0x04, 0xa5, 0x16,
0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x89, 0x70, 0xb1, 0x16, 0x27, 0xe7, 0x17, 0xa5, 0x82, 0x35,
0x31, 0x06, 0x41, 0x38, 0x46, 0x8e, 0x5c, 0x9c, 0xc1, 0x30, 0x1b, 0x84, 0x4c, 0xb8, 0xd8, 0x1d,
0xf3, 0x12, 0x73, 0x2a, 0xab, 0x52, 0x85, 0x84, 0xf4, 0x10, 0x2e, 0x81, 0xda, 0x2a, 0x25, 0x8c,
0x22, 0x06, 0x31, 0x56, 0x89, 0xc1, 0x49, 0x30, 0x8a, 0x1f, 0xec, 0x56, 0x6b, 0xb8, 0x6c, 0x12,
0x1b, 0x58, 0xc0, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x55, 0xd3, 0x83, 0xd5, 0x00, 0x00,
0x00,
func file_proto_sentiment_proto_rawDescGZIP() []byte {
file_proto_sentiment_proto_rawDescOnce.Do(func() {
file_proto_sentiment_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_sentiment_proto_rawDescData)
})
return file_proto_sentiment_proto_rawDescData
}
var file_proto_sentiment_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_proto_sentiment_proto_goTypes = []interface{}{
(*Request)(nil), // 0: sentiment.Request
(*Response)(nil), // 1: sentiment.Response
}
var file_proto_sentiment_proto_depIdxs = []int32{
0, // 0: sentiment.Sentiment.Analyze:input_type -> sentiment.Request
1, // 1: sentiment.Sentiment.Analyze:output_type -> sentiment.Response
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_proto_sentiment_proto_init() }
func file_proto_sentiment_proto_init() {
if File_proto_sentiment_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_proto_sentiment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Request); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_sentiment_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Response); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_sentiment_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_proto_sentiment_proto_goTypes,
DependencyIndexes: file_proto_sentiment_proto_depIdxs,
MessageInfos: file_proto_sentiment_proto_msgTypes,
}.Build()
File_proto_sentiment_proto = out.File
file_proto_sentiment_proto_rawDesc = nil
file_proto_sentiment_proto_goTypes = nil
file_proto_sentiment_proto_depIdxs = nil
}

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package sentiment;
option go_package = "proto;sentiment";
option go_package = "./proto;sentiment";
service Sentiment {
rpc Analyze(Request) returns (Response) {};