diff --git a/.github/generate.sh b/.github/generate.sh index 97a81de2..70a3a57b 100755 --- a/.github/generate.sh +++ b/.github/generate.sh @@ -9,7 +9,7 @@ curl -s -o proto/google/api/http.proto -L https://raw.githubusercontent.com/goog for PROTO in $PROTOS; do echo $PROTO - protoc -I./proto -I. -I$(dirname $PROTO) --go_out=plugins=grpc,paths=source_relative:. --micro_out=paths=source_relative:. $PROTO + protoc -I./proto -I. -I$(dirname $PROTO) --go-grpc_out=paths=source_relative:. --go_out=paths=source_relative:. --micro_out=paths=source_relative:. $PROTO done rm -r proto diff --git a/.golangci.yml b/.golangci.yml index 7baec796..5c65ecae 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,11 @@ run: deadline: 5m + modules-download-mode: readonly + skip-dirs: + - util/mdns.new + skip-files: + - ".*\\.pb\\.go$" + - ".*\\.pb\\.micro\\.go$" linters: disable-all: false enable-all: false @@ -24,4 +30,11 @@ linters: - interfacer - typecheck - dupl - +output: + format: colored-line-number + # print lines of code with issue, default is true + print-issued-lines: true + # print linter name in the end of issue text, default is true + print-linter-name: true + # make issues output unique by line, default is true + uniq-by-line: true diff --git a/api/api.go b/api/api.go index 402c938b..870932c9 100644 --- a/api/api.go +++ b/api/api.go @@ -5,8 +5,8 @@ import ( "regexp" "strings" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" ) type Api interface { diff --git a/api/handler/api/api.go b/api/handler/api/api.go index 06b45f31..377af367 100644 --- a/api/handler/api/api.go +++ b/api/handler/api/api.go @@ -4,13 +4,13 @@ package api import ( "net/http" - goapi "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/handler" - api "github.com/micro/go-micro/v3/api/proto" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/util/ctx" - "github.com/micro/go-micro/v3/util/router" + goapi "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/handler" + api "github.com/unistack-org/micro/v3/api/proto" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/util/ctx" + "github.com/unistack-org/micro/v3/util/router" ) type apiHandler struct { diff --git a/api/handler/api/util.go b/api/handler/api/util.go index 0f0c50db..aed7f970 100644 --- a/api/handler/api/util.go +++ b/api/handler/api/util.go @@ -7,7 +7,7 @@ import ( "net/http" "strings" - api "github.com/micro/go-micro/v3/api/proto" + api "github.com/unistack-org/micro/v3/api/proto" "github.com/oxtoacart/bpool" ) diff --git a/api/handler/event/event.go b/api/handler/event/event.go index 5977b525..0f0a0dad 100644 --- a/api/handler/event/event.go +++ b/api/handler/event/event.go @@ -11,9 +11,9 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/api/handler" - proto "github.com/micro/go-micro/v3/api/proto" - "github.com/micro/go-micro/v3/util/ctx" + "github.com/unistack-org/micro/v3/api/handler" + proto "github.com/unistack-org/micro/v3/api/proto" + "github.com/unistack-org/micro/v3/util/ctx" "github.com/oxtoacart/bpool" ) diff --git a/api/handler/http/http.go b/api/handler/http/http.go index 5accfab3..011acfec 100644 --- a/api/handler/http/http.go +++ b/api/handler/http/http.go @@ -9,9 +9,9 @@ import ( "net/http/httputil" "net/url" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/handler" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/handler" + "github.com/unistack-org/micro/v3/registry" ) const ( diff --git a/api/handler/http/http_test.go b/api/handler/http/http_test.go index 5c5c842f..7a788d77 100644 --- a/api/handler/http/http_test.go +++ b/api/handler/http/http_test.go @@ -6,13 +6,13 @@ import ( "net/http/httptest" "testing" - "github.com/micro/go-micro/v3/api/handler" - "github.com/micro/go-micro/v3/api/resolver" - "github.com/micro/go-micro/v3/api/resolver/vpath" - "github.com/micro/go-micro/v3/api/router" - regRouter "github.com/micro/go-micro/v3/api/router/registry" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/api/handler" + "github.com/unistack-org/micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/resolver/vpath" + "github.com/unistack-org/micro/v3/api/router" + regRouter "github.com/unistack-org/micro/v3/api/router/registry" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/memory" ) func testHttp(t *testing.T, path, service, ns string) { diff --git a/api/handler/options.go b/api/handler/options.go index 8e2d058a..4b1801a6 100644 --- a/api/handler/options.go +++ b/api/handler/options.go @@ -1,9 +1,9 @@ package handler import ( - "github.com/micro/go-micro/v3/api/router" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/client/grpc" + "github.com/unistack-org/micro/v3/api/router" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/client/grpc" ) var ( diff --git a/api/handler/rpc/rpc.go b/api/handler/rpc/rpc.go index 5a22ed54..0e9f3df1 100644 --- a/api/handler/rpc/rpc.go +++ b/api/handler/rpc/rpc.go @@ -9,19 +9,19 @@ import ( "strings" jsonpatch "github.com/evanphx/json-patch/v5" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/handler" - "github.com/micro/go-micro/v3/api/internal/proto" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/jsonrpc" - "github.com/micro/go-micro/v3/codec/protorpc" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/util/ctx" - "github.com/micro/go-micro/v3/util/qson" - "github.com/micro/go-micro/v3/util/router" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/handler" + "github.com/unistack-org/micro/v3/api/internal/proto" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/jsonrpc" + "github.com/unistack-org/micro/v3/codec/protorpc" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/util/ctx" + "github.com/unistack-org/micro/v3/util/qson" + "github.com/unistack-org/micro/v3/util/router" "github.com/oxtoacart/bpool" ) diff --git a/api/handler/rpc/rpc_test.go b/api/handler/rpc/rpc_test.go index 8b6cd0b6..a375ab3b 100644 --- a/api/handler/rpc/rpc_test.go +++ b/api/handler/rpc/rpc_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/golang/protobuf/proto" - go_api "github.com/micro/go-micro/v3/api/proto" + go_api "github.com/unistack-org/micro/v3/api/proto" ) func TestRequestPayloadFromRequest(t *testing.T) { diff --git a/api/handler/rpc/stream.go b/api/handler/rpc/stream.go index 25d6789f..6eb089ef 100644 --- a/api/handler/rpc/stream.go +++ b/api/handler/rpc/stream.go @@ -12,11 +12,11 @@ import ( "github.com/gobwas/httphead" "github.com/gobwas/ws" "github.com/gobwas/ws/wsutil" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/client" - raw "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/util/router" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/client" + raw "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/util/router" ) // serveWebsocket will stream rpc back over websockets assuming json diff --git a/api/handler/web/web.go b/api/handler/web/web.go index ace2654e..41b27bde 100644 --- a/api/handler/web/web.go +++ b/api/handler/web/web.go @@ -12,9 +12,9 @@ import ( "net/url" "strings" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/handler" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/handler" + "github.com/unistack-org/micro/v3/registry" ) const ( diff --git a/api/proto/api.pb.go b/api/proto/api.pb.go index e5d88473..f2a109e4 100644 --- a/api/proto/api.pb.go +++ b/api/proto/api.pb.go @@ -1,68 +1,81 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: api/proto/api.proto package go_api 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 Pair struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` } -func (m *Pair) Reset() { *m = Pair{} } -func (m *Pair) String() string { return proto.CompactTextString(m) } -func (*Pair) ProtoMessage() {} +func (x *Pair) Reset() { + *x = Pair{} + if protoimpl.UnsafeEnabled { + mi := &file_api_proto_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Pair) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pair) ProtoMessage() {} + +func (x *Pair) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_api_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 Pair.ProtoReflect.Descriptor instead. func (*Pair) Descriptor() ([]byte, []int) { - return fileDescriptor_2df576b66d12087a, []int{0} + return file_api_proto_api_proto_rawDescGZIP(), []int{0} } -func (m *Pair) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Pair.Unmarshal(m, b) -} -func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Pair.Marshal(b, m, deterministic) -} -func (m *Pair) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pair.Merge(m, src) -} -func (m *Pair) XXX_Size() int { - return xxx_messageInfo_Pair.Size(m) -} -func (m *Pair) XXX_DiscardUnknown() { - xxx_messageInfo_Pair.DiscardUnknown(m) -} - -var xxx_messageInfo_Pair proto.InternalMessageInfo - -func (m *Pair) GetKey() string { - if m != nil { - return m.Key +func (x *Pair) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *Pair) GetValues() []string { - if m != nil { - return m.Values +func (x *Pair) GetValues() []string { + if x != nil { + return x.Values } return nil } @@ -70,88 +83,96 @@ func (m *Pair) GetValues() []string { // A HTTP request as RPC // Forward by the api handler type Request struct { - Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` - Header map[string]*Pair `protobuf:"bytes,3,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Get map[string]*Pair `protobuf:"bytes,4,rep,name=get,proto3" json:"get,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Post map[string]*Pair `protobuf:"bytes,5,rep,name=post,proto3" json:"post,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Body string `protobuf:"bytes,6,opt,name=body,proto3" json:"body,omitempty"` - Url string `protobuf:"bytes,7,opt,name=url,proto3" json:"url,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` + Header map[string]*Pair `protobuf:"bytes,3,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Get map[string]*Pair `protobuf:"bytes,4,rep,name=get,proto3" json:"get,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Post map[string]*Pair `protobuf:"bytes,5,rep,name=post,proto3" json:"post,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Body string `protobuf:"bytes,6,opt,name=body,proto3" json:"body,omitempty"` // raw request body; if not application/x-www-form-urlencoded + Url string `protobuf:"bytes,7,opt,name=url,proto3" json:"url,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_api_proto_api_proto_msgTypes[1] + 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_api_proto_api_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 Request.ProtoReflect.Descriptor instead. func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_2df576b66d12087a, []int{1} + return file_api_proto_api_proto_rawDescGZIP(), []int{1} } -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) GetMethod() string { - if m != nil { - return m.Method +func (x *Request) GetMethod() string { + if x != nil { + return x.Method } return "" } -func (m *Request) GetPath() string { - if m != nil { - return m.Path +func (x *Request) GetPath() string { + if x != nil { + return x.Path } return "" } -func (m *Request) GetHeader() map[string]*Pair { - if m != nil { - return m.Header +func (x *Request) GetHeader() map[string]*Pair { + if x != nil { + return x.Header } return nil } -func (m *Request) GetGet() map[string]*Pair { - if m != nil { - return m.Get +func (x *Request) GetGet() map[string]*Pair { + if x != nil { + return x.Get } return nil } -func (m *Request) GetPost() map[string]*Pair { - if m != nil { - return m.Post +func (x *Request) GetPost() map[string]*Pair { + if x != nil { + return x.Post } return nil } -func (m *Request) GetBody() string { - if m != nil { - return m.Body +func (x *Request) GetBody() string { + if x != nil { + return x.Body } return "" } -func (m *Request) GetUrl() string { - if m != nil { - return m.Url +func (x *Request) GetUrl() string { + if x != nil { + return x.Url } return "" } @@ -159,56 +180,64 @@ func (m *Request) GetUrl() string { // A HTTP response as RPC // Expected response for the api handler type Response struct { - StatusCode int32 `protobuf:"varint,1,opt,name=statusCode,proto3" json:"statusCode,omitempty"` - Header map[string]*Pair `protobuf:"bytes,2,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StatusCode int32 `protobuf:"varint,1,opt,name=statusCode,proto3" json:"statusCode,omitempty"` + Header map[string]*Pair `protobuf:"bytes,2,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,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_api_proto_api_proto_msgTypes[2] + 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_api_proto_api_proto_msgTypes[2] + 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_2df576b66d12087a, []int{2} + return file_api_proto_api_proto_rawDescGZIP(), []int{2} } -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) GetStatusCode() int32 { - if m != nil { - return m.StatusCode +func (x *Response) GetStatusCode() int32 { + if x != nil { + return x.StatusCode } return 0 } -func (m *Response) GetHeader() map[string]*Pair { - if m != nil { - return m.Header +func (x *Response) GetHeader() map[string]*Pair { + if x != nil { + return x.Header } return nil } -func (m *Response) GetBody() string { - if m != nil { - return m.Body +func (x *Response) GetBody() string { + if x != nil { + return x.Body } return "" } @@ -216,6 +245,10 @@ func (m *Response) GetBody() string { // A HTTP event as RPC // Forwarded by the event handler type Event struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // e.g login Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // uuid @@ -225,111 +258,254 @@ type Event struct { // event headers Header map[string]*Pair `protobuf:"bytes,4,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // the event data - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` } -func (m *Event) Reset() { *m = Event{} } -func (m *Event) String() string { return proto.CompactTextString(m) } -func (*Event) ProtoMessage() {} +func (x *Event) Reset() { + *x = Event{} + if protoimpl.UnsafeEnabled { + mi := &file_api_proto_api_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_api_proto_api_proto_msgTypes[3] + 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 Event.ProtoReflect.Descriptor instead. func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_2df576b66d12087a, []int{3} + return file_api_proto_api_proto_rawDescGZIP(), []int{3} } -func (m *Event) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Event.Unmarshal(m, b) -} -func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Event.Marshal(b, m, deterministic) -} -func (m *Event) XXX_Merge(src proto.Message) { - xxx_messageInfo_Event.Merge(m, src) -} -func (m *Event) XXX_Size() int { - return xxx_messageInfo_Event.Size(m) -} -func (m *Event) XXX_DiscardUnknown() { - xxx_messageInfo_Event.DiscardUnknown(m) -} - -var xxx_messageInfo_Event proto.InternalMessageInfo - -func (m *Event) GetName() string { - if m != nil { - return m.Name +func (x *Event) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Event) GetId() string { - if m != nil { - return m.Id +func (x *Event) GetId() string { + if x != nil { + return x.Id } return "" } -func (m *Event) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Event) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Event) GetHeader() map[string]*Pair { - if m != nil { - return m.Header +func (x *Event) GetHeader() map[string]*Pair { + if x != nil { + return x.Header } return nil } -func (m *Event) GetData() string { - if m != nil { - return m.Data +func (x *Event) GetData() string { + if x != nil { + return x.Data } return "" } -func init() { - proto.RegisterType((*Pair)(nil), "go.api.Pair") - proto.RegisterType((*Request)(nil), "go.api.Request") - proto.RegisterMapType((map[string]*Pair)(nil), "go.api.Request.GetEntry") - proto.RegisterMapType((map[string]*Pair)(nil), "go.api.Request.HeaderEntry") - proto.RegisterMapType((map[string]*Pair)(nil), "go.api.Request.PostEntry") - proto.RegisterType((*Response)(nil), "go.api.Response") - proto.RegisterMapType((map[string]*Pair)(nil), "go.api.Response.HeaderEntry") - proto.RegisterType((*Event)(nil), "go.api.Event") - proto.RegisterMapType((map[string]*Pair)(nil), "go.api.Event.HeaderEntry") +var File_api_proto_api_proto protoreflect.FileDescriptor + +var file_api_proto_api_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x22, 0x30, 0x0a, + 0x04, 0x50, 0x61, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, + 0xc1, 0x03, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, + 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x33, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x03, + 0x67, 0x65, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x03, 0x67, 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x74, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x72, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x1a, 0x47, 0x0a, + 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x44, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x69, + 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x45, 0x0a, 0x09, + 0x50, 0x6f, 0x73, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x67, 0x6f, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xbd, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, + 0x12, 0x34, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x1a, 0x47, 0x0a, 0x0b, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x67, 0x6f, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xd9, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x31, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x47, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x67, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("api/proto/api.proto", fileDescriptor_2df576b66d12087a) } +var ( + file_api_proto_api_proto_rawDescOnce sync.Once + file_api_proto_api_proto_rawDescData = file_api_proto_api_proto_rawDesc +) -var fileDescriptor_2df576b66d12087a = []byte{ - // 393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcd, 0xce, 0xd3, 0x30, - 0x10, 0x54, 0xe2, 0x24, 0x6d, 0xb6, 0x08, 0x21, 0x23, 0x21, 0x53, 0x2a, 0x54, 0xe5, 0x54, 0x21, - 0x91, 0x42, 0xcb, 0x01, 0x71, 0x85, 0xaa, 0x1c, 0x2b, 0xbf, 0x81, 0xab, 0x58, 0x6d, 0x44, 0x13, - 0x9b, 0xd8, 0xa9, 0xd4, 0x87, 0xe3, 0xc0, 0x63, 0xf0, 0x36, 0xc8, 0x1b, 0xf7, 0xe7, 0xab, 0xfa, - 0x5d, 0xbe, 0xaf, 0xb7, 0x89, 0x3d, 0x3b, 0x3b, 0x3b, 0xeb, 0xc0, 0x6b, 0xa1, 0xcb, 0xa9, 0x6e, - 0x94, 0x55, 0x53, 0xa1, 0xcb, 0x1c, 0x11, 0x4d, 0x36, 0x2a, 0x17, 0xba, 0xcc, 0x3e, 0x41, 0xb4, - 0x12, 0x65, 0x43, 0x5f, 0x01, 0xf9, 0x25, 0x0f, 0x2c, 0x18, 0x07, 0x93, 0x94, 0x3b, 0x48, 0xdf, - 0x40, 0xb2, 0x17, 0xbb, 0x56, 0x1a, 0x16, 0x8e, 0xc9, 0x24, 0xe5, 0xfe, 0x2b, 0xfb, 0x4b, 0xa0, - 0xc7, 0xe5, 0xef, 0x56, 0x1a, 0xeb, 0x38, 0x95, 0xb4, 0x5b, 0x55, 0xf8, 0x42, 0xff, 0x45, 0x29, - 0x44, 0x5a, 0xd8, 0x2d, 0x0b, 0xf1, 0x14, 0x31, 0x9d, 0x43, 0xb2, 0x95, 0xa2, 0x90, 0x0d, 0x23, - 0x63, 0x32, 0x19, 0xcc, 0xde, 0xe5, 0x9d, 0x85, 0xdc, 0x8b, 0xe5, 0x3f, 0xf1, 0x76, 0x51, 0xdb, - 0xe6, 0xc0, 0x3d, 0x95, 0x7e, 0x00, 0xb2, 0x91, 0x96, 0x45, 0x58, 0xc1, 0xae, 0x2b, 0x96, 0xd2, - 0x76, 0x74, 0x47, 0xa2, 0x1f, 0x21, 0xd2, 0xca, 0x58, 0x16, 0x23, 0xf9, 0xed, 0x35, 0x79, 0xa5, - 0x8c, 0x67, 0x23, 0xcd, 0x79, 0x5c, 0xab, 0xe2, 0xc0, 0x92, 0xce, 0xa3, 0xc3, 0x2e, 0x85, 0xb6, - 0xd9, 0xb1, 0x5e, 0x97, 0x42, 0xdb, 0xec, 0x86, 0x4b, 0x18, 0x5c, 0xf8, 0xba, 0x11, 0x53, 0x06, - 0x31, 0x06, 0x83, 0xb3, 0x0e, 0x66, 0x2f, 0x8e, 0x6d, 0x5d, 0xaa, 0xbc, 0xbb, 0xfa, 0x16, 0x7e, - 0x0d, 0x86, 0x3f, 0xa0, 0x7f, 0xb4, 0xfb, 0x0c, 0x95, 0x05, 0xa4, 0xa7, 0x39, 0x9e, 0x2e, 0x93, - 0xfd, 0x09, 0xa0, 0xcf, 0xa5, 0xd1, 0xaa, 0x36, 0x92, 0xbe, 0x07, 0x30, 0x56, 0xd8, 0xd6, 0x7c, - 0x57, 0x85, 0x44, 0xb5, 0x98, 0x5f, 0x9c, 0xd0, 0x2f, 0xa7, 0xc5, 0x85, 0x98, 0xec, 0xe8, 0x9c, - 0x6c, 0xa7, 0x70, 0x73, 0x73, 0xc7, 0x78, 0xc9, 0x39, 0xde, 0xbb, 0x85, 0x99, 0xfd, 0x0b, 0x20, - 0x5e, 0xec, 0x65, 0x8d, 0x5b, 0xac, 0x45, 0x25, 0xbd, 0x08, 0x62, 0xfa, 0x12, 0xc2, 0xb2, 0xf0, - 0x6f, 0x2f, 0x2c, 0x0b, 0x3a, 0x82, 0xd4, 0x96, 0x95, 0x34, 0x56, 0x54, 0x1a, 0xfd, 0x10, 0x7e, - 0x3e, 0xa0, 0x9f, 0x4f, 0xe3, 0x45, 0x0f, 0x1f, 0x0e, 0x36, 0x78, 0x6c, 0xb6, 0x42, 0x58, 0xc1, - 0xe2, 0xae, 0xa9, 0xc3, 0x77, 0x9b, 0x6d, 0x9d, 0xe0, 0x0f, 0x3a, 0xff, 0x1f, 0x00, 0x00, 0xff, - 0xff, 0xd4, 0x6d, 0x70, 0x51, 0xb7, 0x03, 0x00, 0x00, +func file_api_proto_api_proto_rawDescGZIP() []byte { + file_api_proto_api_proto_rawDescOnce.Do(func() { + file_api_proto_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_proto_api_proto_rawDescData) + }) + return file_api_proto_api_proto_rawDescData +} + +var file_api_proto_api_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_api_proto_api_proto_goTypes = []interface{}{ + (*Pair)(nil), // 0: go.api.Pair + (*Request)(nil), // 1: go.api.Request + (*Response)(nil), // 2: go.api.Response + (*Event)(nil), // 3: go.api.Event + nil, // 4: go.api.Request.HeaderEntry + nil, // 5: go.api.Request.GetEntry + nil, // 6: go.api.Request.PostEntry + nil, // 7: go.api.Response.HeaderEntry + nil, // 8: go.api.Event.HeaderEntry +} +var file_api_proto_api_proto_depIdxs = []int32{ + 4, // 0: go.api.Request.header:type_name -> go.api.Request.HeaderEntry + 5, // 1: go.api.Request.get:type_name -> go.api.Request.GetEntry + 6, // 2: go.api.Request.post:type_name -> go.api.Request.PostEntry + 7, // 3: go.api.Response.header:type_name -> go.api.Response.HeaderEntry + 8, // 4: go.api.Event.header:type_name -> go.api.Event.HeaderEntry + 0, // 5: go.api.Request.HeaderEntry.value:type_name -> go.api.Pair + 0, // 6: go.api.Request.GetEntry.value:type_name -> go.api.Pair + 0, // 7: go.api.Request.PostEntry.value:type_name -> go.api.Pair + 0, // 8: go.api.Response.HeaderEntry.value:type_name -> go.api.Pair + 0, // 9: go.api.Event.HeaderEntry.value:type_name -> go.api.Pair + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_api_proto_api_proto_init() } +func file_api_proto_api_proto_init() { + if File_api_proto_api_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_proto_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Pair); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_proto_api_proto_msgTypes[1].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_api_proto_api_proto_msgTypes[2].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 + } + } + file_api_proto_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Event); 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_api_proto_api_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_api_proto_api_proto_goTypes, + DependencyIndexes: file_api_proto_api_proto_depIdxs, + MessageInfos: file_api_proto_api_proto_msgTypes, + }.Build() + File_api_proto_api_proto = out.File + file_api_proto_api_proto_rawDesc = nil + file_api_proto_api_proto_goTypes = nil + file_api_proto_api_proto_depIdxs = nil } diff --git a/api/resolver/grpc/grpc.go b/api/resolver/grpc/grpc.go index 61d3ae9e..f06be716 100644 --- a/api/resolver/grpc/grpc.go +++ b/api/resolver/grpc/grpc.go @@ -6,7 +6,7 @@ import ( "net/http" "strings" - "github.com/micro/go-micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/resolver" ) type Resolver struct { diff --git a/api/resolver/host/host.go b/api/resolver/host/host.go index 501f35f8..519fbceb 100644 --- a/api/resolver/host/host.go +++ b/api/resolver/host/host.go @@ -4,7 +4,7 @@ package host import ( "net/http" - "github.com/micro/go-micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/resolver" ) type Resolver struct { diff --git a/api/resolver/options.go b/api/resolver/options.go index 68a8774d..115c1f22 100644 --- a/api/resolver/options.go +++ b/api/resolver/options.go @@ -1,7 +1,7 @@ package resolver import ( - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type Options struct { diff --git a/api/resolver/path/path.go b/api/resolver/path/path.go index b91fefbb..0b219298 100644 --- a/api/resolver/path/path.go +++ b/api/resolver/path/path.go @@ -5,7 +5,7 @@ import ( "net/http" "strings" - "github.com/micro/go-micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/resolver" ) type Resolver struct { diff --git a/api/resolver/subdomain/subdomain.go b/api/resolver/subdomain/subdomain.go index c2c381a0..8a2a8c61 100644 --- a/api/resolver/subdomain/subdomain.go +++ b/api/resolver/subdomain/subdomain.go @@ -7,8 +7,8 @@ import ( "net/http" "strings" - "github.com/micro/go-micro/v3/api/resolver" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/logger" "golang.org/x/net/publicsuffix" ) diff --git a/api/resolver/subdomain/subdomain_test.go b/api/resolver/subdomain/subdomain_test.go index 2a33fa60..79fadd30 100644 --- a/api/resolver/subdomain/subdomain_test.go +++ b/api/resolver/subdomain/subdomain_test.go @@ -5,7 +5,7 @@ import ( "net/url" "testing" - "github.com/micro/go-micro/v3/api/resolver/vpath" + "github.com/unistack-org/micro/v3/api/resolver/vpath" "github.com/stretchr/testify/assert" ) diff --git a/api/resolver/vpath/vpath.go b/api/resolver/vpath/vpath.go index d0b6496f..f87e3289 100644 --- a/api/resolver/vpath/vpath.go +++ b/api/resolver/vpath/vpath.go @@ -7,7 +7,7 @@ import ( "regexp" "strings" - "github.com/micro/go-micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/resolver" ) func NewResolver(opts ...resolver.Option) resolver.Resolver { diff --git a/api/router/options.go b/api/router/options.go index f5993419..0209e437 100644 --- a/api/router/options.go +++ b/api/router/options.go @@ -1,10 +1,10 @@ package router import ( - "github.com/micro/go-micro/v3/api/resolver" - "github.com/micro/go-micro/v3/api/resolver/vpath" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/resolver/vpath" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/mdns" ) type Options struct { diff --git a/api/router/registry/registry.go b/api/router/registry/registry.go index 63885e1e..da465cd9 100644 --- a/api/router/registry/registry.go +++ b/api/router/registry/registry.go @@ -10,13 +10,13 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/router" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/cache" - util "github.com/micro/go-micro/v3/util/router" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/router" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/cache" + util "github.com/unistack-org/micro/v3/util/router" ) // endpoint struct, that holds compiled pcre diff --git a/api/router/registry/registry_test.go b/api/router/registry/registry_test.go index a1ae14d1..354c7d67 100644 --- a/api/router/registry/registry_test.go +++ b/api/router/registry/registry_test.go @@ -3,7 +3,7 @@ package registry import ( "testing" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" "github.com/stretchr/testify/assert" ) diff --git a/api/router/router.go b/api/router/router.go index cf119512..bb9d1d2c 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -4,7 +4,7 @@ package router import ( "net/http" - "github.com/micro/go-micro/v3/api" + "github.com/unistack-org/micro/v3/api" ) // Router is used to determine an endpoint for a request diff --git a/api/router/router_test.go b/api/router/router_test.go index be802c33..e74a1032 100644 --- a/api/router/router_test.go +++ b/api/router/router_test.go @@ -9,20 +9,20 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/handler" - "github.com/micro/go-micro/v3/api/handler/rpc" - "github.com/micro/go-micro/v3/api/router" - rregistry "github.com/micro/go-micro/v3/api/router/registry" - rstatic "github.com/micro/go-micro/v3/api/router/static" - "github.com/micro/go-micro/v3/client" - gcli "github.com/micro/go-micro/v3/client/grpc" - rmemory "github.com/micro/go-micro/v3/registry/memory" - rt "github.com/micro/go-micro/v3/router" - regRouter "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/server" - gsrv "github.com/micro/go-micro/v3/server/grpc" - pb "github.com/micro/go-micro/v3/server/grpc/proto" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/handler" + "github.com/unistack-org/micro/v3/api/handler/rpc" + "github.com/unistack-org/micro/v3/api/router" + rregistry "github.com/unistack-org/micro/v3/api/router/registry" + rstatic "github.com/unistack-org/micro/v3/api/router/static" + "github.com/unistack-org/micro/v3/client" + gcli "github.com/unistack-org/micro/v3/client/grpc" + rmemory "github.com/unistack-org/micro/v3/registry/memory" + rt "github.com/unistack-org/micro/v3/router" + regRouter "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/server" + gsrv "github.com/unistack-org/micro/v3/server/grpc" + pb "github.com/unistack-org/micro/v3/server/grpc/proto" ) // server is used to implement helloworld.GreeterServer. diff --git a/api/router/static/static.go b/api/router/static/static.go index 1425dd1c..e2d60dc5 100644 --- a/api/router/static/static.go +++ b/api/router/static/static.go @@ -8,13 +8,13 @@ import ( "strings" "sync" - "github.com/micro/go-micro/v3/api" - "github.com/micro/go-micro/v3/api/router" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/registry" - rutil "github.com/micro/go-micro/v3/util/registry" - util "github.com/micro/go-micro/v3/util/router" + "github.com/unistack-org/micro/v3/api" + "github.com/unistack-org/micro/v3/api/router" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/registry" + rutil "github.com/unistack-org/micro/v3/util/registry" + util "github.com/unistack-org/micro/v3/util/router" ) type endpoint struct { diff --git a/api/server/acme/autocert/autocert.go b/api/server/acme/autocert/autocert.go index ab9be09a..ac277a45 100644 --- a/api/server/acme/autocert/autocert.go +++ b/api/server/acme/autocert/autocert.go @@ -7,8 +7,8 @@ import ( "net" "os" - "github.com/micro/go-micro/v3/api/server/acme" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/api/server/acme" + "github.com/unistack-org/micro/v3/logger" "golang.org/x/crypto/acme/autocert" ) diff --git a/api/server/acme/certmagic/certmagic.go b/api/server/acme/certmagic/certmagic.go index 3a2803d3..85ad9b65 100644 --- a/api/server/acme/certmagic/certmagic.go +++ b/api/server/acme/certmagic/certmagic.go @@ -8,8 +8,8 @@ import ( "time" "github.com/caddyserver/certmagic" - "github.com/micro/go-micro/v3/api/server/acme" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/api/server/acme" + "github.com/unistack-org/micro/v3/logger" ) type certmagicProvider struct { diff --git a/api/server/acme/certmagic/storage.go b/api/server/acme/certmagic/storage.go index 2a79516f..384d1b97 100644 --- a/api/server/acme/certmagic/storage.go +++ b/api/server/acme/certmagic/storage.go @@ -10,8 +10,8 @@ import ( "time" "github.com/caddyserver/certmagic" - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/sync" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/sync" ) // File represents a "File" that will be stored in store.Store - the contents and last modified time diff --git a/api/server/http/http.go b/api/server/http/http.go index 90eed2fa..42737456 100644 --- a/api/server/http/http.go +++ b/api/server/http/http.go @@ -9,9 +9,9 @@ import ( "sync" "github.com/gorilla/handlers" - "github.com/micro/go-micro/v3/api/server" - "github.com/micro/go-micro/v3/api/server/cors" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/api/server" + "github.com/unistack-org/micro/v3/api/server/cors" + "github.com/unistack-org/micro/v3/logger" ) type httpServer struct { diff --git a/api/server/options.go b/api/server/options.go index d6168a40..644cc386 100644 --- a/api/server/options.go +++ b/api/server/options.go @@ -4,8 +4,8 @@ import ( "crypto/tls" "net/http" - "github.com/micro/go-micro/v3/api/resolver" - "github.com/micro/go-micro/v3/api/server/acme" + "github.com/unistack-org/micro/v3/api/resolver" + "github.com/unistack-org/micro/v3/api/server/acme" ) type Option func(o *Options) diff --git a/api/service/proto/api.pb.go b/api/service/proto/api.pb.go index 7cdff499..ff8f88f7 100644 --- a/api/service/proto/api.pb.go +++ b/api/service/proto/api.pb.go @@ -1,268 +1,249 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: api/service/proto/api.proto package go_micro_api import ( - context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 Endpoint struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Host []string `protobuf:"bytes,2,rep,name=host,proto3" json:"host,omitempty"` - Path []string `protobuf:"bytes,3,rep,name=path,proto3" json:"path,omitempty"` - Method []string `protobuf:"bytes,4,rep,name=method,proto3" json:"method,omitempty"` - Stream bool `protobuf:"varint,5,opt,name=stream,proto3" json:"stream,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Host []string `protobuf:"bytes,2,rep,name=host,proto3" json:"host,omitempty"` + Path []string `protobuf:"bytes,3,rep,name=path,proto3" json:"path,omitempty"` + Method []string `protobuf:"bytes,4,rep,name=method,proto3" json:"method,omitempty"` + Stream bool `protobuf:"varint,5,opt,name=stream,proto3" json:"stream,omitempty"` } -func (m *Endpoint) Reset() { *m = Endpoint{} } -func (m *Endpoint) String() string { return proto.CompactTextString(m) } -func (*Endpoint) ProtoMessage() {} +func (x *Endpoint) Reset() { + *x = Endpoint{} + if protoimpl.UnsafeEnabled { + mi := &file_api_service_proto_api_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Endpoint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Endpoint) ProtoMessage() {} + +func (x *Endpoint) ProtoReflect() protoreflect.Message { + mi := &file_api_service_proto_api_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 Endpoint.ProtoReflect.Descriptor instead. func (*Endpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_c4a48b6b680b5c31, []int{0} + return file_api_service_proto_api_proto_rawDescGZIP(), []int{0} } -func (m *Endpoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Endpoint.Unmarshal(m, b) -} -func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Endpoint.Marshal(b, m, deterministic) -} -func (m *Endpoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_Endpoint.Merge(m, src) -} -func (m *Endpoint) XXX_Size() int { - return xxx_messageInfo_Endpoint.Size(m) -} -func (m *Endpoint) XXX_DiscardUnknown() { - xxx_messageInfo_Endpoint.DiscardUnknown(m) -} - -var xxx_messageInfo_Endpoint proto.InternalMessageInfo - -func (m *Endpoint) GetName() string { - if m != nil { - return m.Name +func (x *Endpoint) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Endpoint) GetHost() []string { - if m != nil { - return m.Host +func (x *Endpoint) GetHost() []string { + if x != nil { + return x.Host } return nil } -func (m *Endpoint) GetPath() []string { - if m != nil { - return m.Path +func (x *Endpoint) GetPath() []string { + if x != nil { + return x.Path } return nil } -func (m *Endpoint) GetMethod() []string { - if m != nil { - return m.Method +func (x *Endpoint) GetMethod() []string { + if x != nil { + return x.Method } return nil } -func (m *Endpoint) GetStream() bool { - if m != nil { - return m.Stream +func (x *Endpoint) GetStream() bool { + if x != nil { + return x.Stream } return false } type EmptyResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } -func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } -func (*EmptyResponse) ProtoMessage() {} +func (x *EmptyResponse) Reset() { + *x = EmptyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_service_proto_api_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EmptyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmptyResponse) ProtoMessage() {} + +func (x *EmptyResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_service_proto_api_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 EmptyResponse.ProtoReflect.Descriptor instead. func (*EmptyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c4a48b6b680b5c31, []int{1} + return file_api_service_proto_api_proto_rawDescGZIP(), []int{1} } -func (m *EmptyResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_EmptyResponse.Unmarshal(m, b) -} -func (m *EmptyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_EmptyResponse.Marshal(b, m, deterministic) -} -func (m *EmptyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_EmptyResponse.Merge(m, src) -} -func (m *EmptyResponse) XXX_Size() int { - return xxx_messageInfo_EmptyResponse.Size(m) -} -func (m *EmptyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_EmptyResponse.DiscardUnknown(m) +var File_api_service_proto_api_proto protoreflect.FileDescriptor + +var file_api_service_proto_api_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x67, + 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x22, 0x76, 0x0a, 0x08, 0x45, + 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, + 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x22, 0x0f, 0x0a, 0x0d, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8d, 0x01, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x41, 0x0a, 0x08, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x43, 0x0a, 0x0a, 0x44, 0x65, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x1a, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo +var ( + file_api_service_proto_api_proto_rawDescOnce sync.Once + file_api_service_proto_api_proto_rawDescData = file_api_service_proto_api_proto_rawDesc +) -func init() { - proto.RegisterType((*Endpoint)(nil), "go.micro.api.Endpoint") - proto.RegisterType((*EmptyResponse)(nil), "go.micro.api.EmptyResponse") +func file_api_service_proto_api_proto_rawDescGZIP() []byte { + file_api_service_proto_api_proto_rawDescOnce.Do(func() { + file_api_service_proto_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_service_proto_api_proto_rawDescData) + }) + return file_api_service_proto_api_proto_rawDescData } -func init() { proto.RegisterFile("api/service/proto/api.proto", fileDescriptor_c4a48b6b680b5c31) } - -var fileDescriptor_c4a48b6b680b5c31 = []byte{ - // 212 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0xd0, 0xc1, 0x4a, 0x03, 0x31, - 0x10, 0x80, 0x61, 0xd7, 0xad, 0x65, 0x1d, 0x14, 0x21, 0x87, 0x12, 0xec, 0x65, 0xd9, 0x53, 0x4f, - 0x59, 0xd0, 0x27, 0x28, 0xda, 0x17, 0xd8, 0x37, 0x88, 0xed, 0xd0, 0x9d, 0x43, 0x32, 0x43, 0x32, - 0x14, 0x7c, 0x08, 0xdf, 0x59, 0x12, 0x2b, 0x2c, 0x5e, 0xbd, 0xfd, 0xf3, 0x1d, 0x86, 0x61, 0x60, - 0xeb, 0x85, 0xc6, 0x8c, 0xe9, 0x42, 0x47, 0x1c, 0x25, 0xb1, 0xf2, 0xe8, 0x85, 0x5c, 0x2d, 0xf3, - 0x70, 0x66, 0x17, 0xe8, 0x98, 0xd8, 0x79, 0xa1, 0xe1, 0x02, 0xdd, 0x21, 0x9e, 0x84, 0x29, 0xaa, - 0x31, 0xb0, 0x8a, 0x3e, 0xa0, 0x6d, 0xfa, 0x66, 0x77, 0x3f, 0xd5, 0x2e, 0x36, 0x73, 0x56, 0x7b, - 0xdb, 0xb7, 0xc5, 0x4a, 0x17, 0x13, 0xaf, 0xb3, 0x6d, 0x7f, 0xac, 0xb4, 0xd9, 0xc0, 0x3a, 0xa0, - 0xce, 0x7c, 0xb2, 0xab, 0xaa, 0xd7, 0xa9, 0x78, 0xd6, 0x84, 0x3e, 0xd8, 0xbb, 0xbe, 0xd9, 0x75, - 0xd3, 0x75, 0x1a, 0x9e, 0xe0, 0xf1, 0x10, 0x44, 0x3f, 0x27, 0xcc, 0xc2, 0x31, 0xe3, 0xcb, 0x57, - 0x03, 0xed, 0x5e, 0xc8, 0xec, 0xa1, 0x9b, 0xf0, 0x4c, 0x59, 0x31, 0x99, 0x8d, 0x5b, 0xde, 0xea, - 0x7e, 0x0f, 0x7d, 0xde, 0xfe, 0xf1, 0xe5, 0xa2, 0xe1, 0xc6, 0xbc, 0x01, 0xbc, 0x63, 0xfa, 0xdf, - 0x92, 0x8f, 0x75, 0xfd, 0xd6, 0xeb, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x46, 0x62, 0x67, 0x30, - 0x4c, 0x01, 0x00, 0x00, +var file_api_service_proto_api_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_api_service_proto_api_proto_goTypes = []interface{}{ + (*Endpoint)(nil), // 0: go.micro.api.Endpoint + (*EmptyResponse)(nil), // 1: go.micro.api.EmptyResponse +} +var file_api_service_proto_api_proto_depIdxs = []int32{ + 0, // 0: go.micro.api.Api.Register:input_type -> go.micro.api.Endpoint + 0, // 1: go.micro.api.Api.Deregister:input_type -> go.micro.api.Endpoint + 1, // 2: go.micro.api.Api.Register:output_type -> go.micro.api.EmptyResponse + 1, // 3: go.micro.api.Api.Deregister:output_type -> go.micro.api.EmptyResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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 } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ApiClient is the client API for Api service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ApiClient interface { - Register(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) - Deregister(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) -} - -type apiClient struct { - cc *grpc.ClientConn -} - -func NewApiClient(cc *grpc.ClientConn) ApiClient { - return &apiClient{cc} -} - -func (c *apiClient) Register(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) { - out := new(EmptyResponse) - err := c.cc.Invoke(ctx, "/go.micro.api.Api/Register", in, out, opts...) - if err != nil { - return nil, err +func init() { file_api_service_proto_api_proto_init() } +func file_api_service_proto_api_proto_init() { + if File_api_service_proto_api_proto != nil { + return } - return out, nil -} - -func (c *apiClient) Deregister(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) { - out := new(EmptyResponse) - err := c.cc.Invoke(ctx, "/go.micro.api.Api/Deregister", in, out, opts...) - if err != nil { - return nil, err + if !protoimpl.UnsafeEnabled { + file_api_service_proto_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Endpoint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_service_proto_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EmptyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - return out, nil -} - -// ApiServer is the server API for Api service. -type ApiServer interface { - Register(context.Context, *Endpoint) (*EmptyResponse, error) - Deregister(context.Context, *Endpoint) (*EmptyResponse, error) -} - -// UnimplementedApiServer can be embedded to have forward compatible implementations. -type UnimplementedApiServer struct { -} - -func (*UnimplementedApiServer) Register(ctx context.Context, req *Endpoint) (*EmptyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") -} -func (*UnimplementedApiServer) Deregister(ctx context.Context, req *Endpoint) (*EmptyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deregister not implemented") -} - -func RegisterApiServer(s *grpc.Server, srv ApiServer) { - s.RegisterService(&_Api_serviceDesc, srv) -} - -func _Api_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Endpoint) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ApiServer).Register(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.api.Api/Register", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ApiServer).Register(ctx, req.(*Endpoint)) - } - return interceptor(ctx, in, info, handler) -} - -func _Api_Deregister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Endpoint) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ApiServer).Deregister(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.api.Api/Deregister", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ApiServer).Deregister(ctx, req.(*Endpoint)) - } - return interceptor(ctx, in, info, handler) -} - -var _Api_serviceDesc = grpc.ServiceDesc{ - ServiceName: "go.micro.api.Api", - HandlerType: (*ApiServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Register", - Handler: _Api_Register_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_service_proto_api_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, }, - { - MethodName: "Deregister", - Handler: _Api_Deregister_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/service/proto/api.proto", + GoTypes: file_api_service_proto_api_proto_goTypes, + DependencyIndexes: file_api_service_proto_api_proto_depIdxs, + MessageInfos: file_api_service_proto_api_proto_msgTypes, + }.Build() + File_api_service_proto_api_proto = out.File + file_api_service_proto_api_proto_rawDesc = nil + file_api_service_proto_api_proto_goTypes = nil + file_api_service_proto_api_proto_depIdxs = nil } diff --git a/api/service/proto/api.pb.micro.go b/api/service/proto/api.pb.micro.go index dd683cf7..5e01e426 100644 --- a/api/service/proto/api.pb.micro.go +++ b/api/service/proto/api.pb.micro.go @@ -11,9 +11,9 @@ import ( import ( context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/service/proto/api_grpc.pb.go b/api/service/proto/api_grpc.pb.go new file mode 100644 index 00000000..caafc8c3 --- /dev/null +++ b/api/service/proto/api_grpc.pb.go @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package go_micro_api + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ApiClient is the client API for Api service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ApiClient interface { + Register(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) + Deregister(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) +} + +type apiClient struct { + cc grpc.ClientConnInterface +} + +func NewApiClient(cc grpc.ClientConnInterface) ApiClient { + return &apiClient{cc} +} + +func (c *apiClient) Register(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) { + out := new(EmptyResponse) + err := c.cc.Invoke(ctx, "/go.micro.api.Api/Register", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *apiClient) Deregister(ctx context.Context, in *Endpoint, opts ...grpc.CallOption) (*EmptyResponse, error) { + out := new(EmptyResponse) + err := c.cc.Invoke(ctx, "/go.micro.api.Api/Deregister", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ApiServer is the server API for Api service. +// All implementations must embed UnimplementedApiServer +// for forward compatibility +type ApiServer interface { + Register(context.Context, *Endpoint) (*EmptyResponse, error) + Deregister(context.Context, *Endpoint) (*EmptyResponse, error) + mustEmbedUnimplementedApiServer() +} + +// UnimplementedApiServer must be embedded to have forward compatible implementations. +type UnimplementedApiServer struct { +} + +func (*UnimplementedApiServer) Register(context.Context, *Endpoint) (*EmptyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") +} +func (*UnimplementedApiServer) Deregister(context.Context, *Endpoint) (*EmptyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deregister not implemented") +} +func (*UnimplementedApiServer) mustEmbedUnimplementedApiServer() {} + +func RegisterApiServer(s *grpc.Server, srv ApiServer) { + s.RegisterService(&_Api_serviceDesc, srv) +} + +func _Api_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Endpoint) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiServer).Register(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.api.Api/Register", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiServer).Register(ctx, req.(*Endpoint)) + } + return interceptor(ctx, in, info, handler) +} + +func _Api_Deregister_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Endpoint) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ApiServer).Deregister(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.api.Api/Deregister", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ApiServer).Deregister(ctx, req.(*Endpoint)) + } + return interceptor(ctx, in, info, handler) +} + +var _Api_serviceDesc = grpc.ServiceDesc{ + ServiceName: "go.micro.api.Api", + HandlerType: (*ApiServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Register", + Handler: _Api_Register_Handler, + }, + { + MethodName: "Deregister", + Handler: _Api_Deregister_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/service/proto/api.proto", +} diff --git a/auth/jwt/jwt.go b/auth/jwt/jwt.go index ab14728f..5fe77d5c 100644 --- a/auth/jwt/jwt.go +++ b/auth/jwt/jwt.go @@ -5,9 +5,9 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/util/token" - "github.com/micro/go-micro/v3/util/token/jwt" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/util/token" + "github.com/unistack-org/micro/v3/util/token/jwt" ) // NewAuth returns a new instance of the Auth service diff --git a/auth/noop/noop.go b/auth/noop/noop.go index 573f4ca7..4ac670c3 100644 --- a/auth/noop/noop.go +++ b/auth/noop/noop.go @@ -2,7 +2,7 @@ package noop import ( "github.com/google/uuid" - "github.com/micro/go-micro/v3/auth" + "github.com/unistack-org/micro/v3/auth" ) func NewAuth(opts ...auth.Option) auth.Auth { diff --git a/auth/options.go b/auth/options.go index e1bda400..dd50c988 100644 --- a/auth/options.go +++ b/auth/options.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) func NewOptions(opts ...Option) Options { diff --git a/broker/http/http.go b/broker/http/http.go index 2b59de5b..e7044ec4 100644 --- a/broker/http/http.go +++ b/broker/http/http.go @@ -18,15 +18,15 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/codec/json" - merr "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/cache" - "github.com/micro/go-micro/v3/registry/mdns" - maddr "github.com/micro/go-micro/v3/util/addr" - mnet "github.com/micro/go-micro/v3/util/net" - mls "github.com/micro/go-micro/v3/util/tls" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/codec/json" + merr "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/cache" + "github.com/unistack-org/micro/v3/registry/mdns" + maddr "github.com/unistack-org/micro/v3/util/addr" + mnet "github.com/unistack-org/micro/v3/util/net" + mls "github.com/unistack-org/micro/v3/util/tls" "golang.org/x/net/http2" ) diff --git a/broker/http/http_test.go b/broker/http/http_test.go index ea43e1f5..0995f439 100644 --- a/broker/http/http_test.go +++ b/broker/http/http_test.go @@ -6,9 +6,9 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/memory" ) var ( diff --git a/broker/http/options.go b/broker/http/options.go index 89a10f6f..4c14dab0 100644 --- a/broker/http/options.go +++ b/broker/http/options.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/micro/go-micro/v3/broker" + "github.com/unistack-org/micro/v3/broker" ) // Handle registers the handler for the given pattern. diff --git a/broker/memory/memory.go b/broker/memory/memory.go index 8d90e933..60bc04fc 100644 --- a/broker/memory/memory.go +++ b/broker/memory/memory.go @@ -9,9 +9,9 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/broker" - maddr "github.com/micro/go-micro/v3/util/addr" - mnet "github.com/micro/go-micro/v3/util/net" + "github.com/unistack-org/micro/v3/broker" + maddr "github.com/unistack-org/micro/v3/util/addr" + mnet "github.com/unistack-org/micro/v3/util/net" ) type memoryBroker struct { diff --git a/broker/memory/memory_test.go b/broker/memory/memory_test.go index d9c22c2c..be16fce4 100644 --- a/broker/memory/memory_test.go +++ b/broker/memory/memory_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/micro/go-micro/v3/broker" + "github.com/unistack-org/micro/v3/broker" ) func TestMemoryBroker(t *testing.T) { diff --git a/broker/nats/context.go b/broker/nats/context.go index 2432291a..c79b9186 100644 --- a/broker/nats/context.go +++ b/broker/nats/context.go @@ -3,7 +3,7 @@ package nats import ( "context" - "github.com/micro/go-micro/v3/broker" + "github.com/unistack-org/micro/v3/broker" ) // setBrokerOption returns a function to setup a context with given value diff --git a/broker/nats/nats.go b/broker/nats/nats.go index d9907c10..deec578e 100644 --- a/broker/nats/nats.go +++ b/broker/nats/nats.go @@ -7,10 +7,10 @@ import ( "strings" "sync" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/codec/json" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/codec/json" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/registry/mdns" nats "github.com/nats-io/nats.go" ) diff --git a/broker/nats/nats_test.go b/broker/nats/nats_test.go index 2c3f0f0d..24bb62d3 100644 --- a/broker/nats/nats_test.go +++ b/broker/nats/nats_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/micro/go-micro/v3/broker" + "github.com/unistack-org/micro/v3/broker" nats "github.com/nats-io/nats.go" ) diff --git a/broker/nats/options.go b/broker/nats/options.go index debd7e65..27d9f89c 100644 --- a/broker/nats/options.go +++ b/broker/nats/options.go @@ -1,7 +1,7 @@ package nats import ( - "github.com/micro/go-micro/v3/broker" + "github.com/unistack-org/micro/v3/broker" nats "github.com/nats-io/nats.go" ) diff --git a/broker/options.go b/broker/options.go index 514ec5ab..757b61a8 100644 --- a/broker/options.go +++ b/broker/options.go @@ -4,8 +4,8 @@ import ( "context" "crypto/tls" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/registry" ) type Options struct { diff --git a/build/docker/docker.go b/build/docker/docker.go index 02774d09..d8a16776 100644 --- a/build/docker/docker.go +++ b/build/docker/docker.go @@ -9,8 +9,8 @@ import ( "path/filepath" docker "github.com/fsouza/go-dockerclient" - "github.com/micro/go-micro/v3/build" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/build" + "github.com/unistack-org/micro/v3/logger" ) type dockerBuild struct { diff --git a/build/golang/golang.go b/build/golang/golang.go index 5af763fd..830acd4e 100644 --- a/build/golang/golang.go +++ b/build/golang/golang.go @@ -6,7 +6,7 @@ import ( "os/exec" "path/filepath" - "github.com/micro/go-micro/v3/build" + "github.com/unistack-org/micro/v3/build" ) type goBuild struct { diff --git a/build/tar/tar.go b/build/tar/tar.go index 6cfa0730..cc190314 100644 --- a/build/tar/tar.go +++ b/build/tar/tar.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - "github.com/micro/go-micro/v3/build" + "github.com/unistack-org/micro/v3/build" ) type tarBuild struct{} diff --git a/cache/memcache/memcache.go b/cache/memcache/memcache.go index 8536924c..92e39a52 100644 --- a/cache/memcache/memcache.go +++ b/cache/memcache/memcache.go @@ -5,7 +5,7 @@ import ( "encoding/json" "github.com/bradfitz/gomemcache/memcache" - "github.com/micro/go-micro/v3/cache" + "github.com/unistack-org/micro/v3/cache" ) type memcacheCache struct { diff --git a/cache/memory/memory.go b/cache/memory/memory.go index 5769707a..949337c6 100644 --- a/cache/memory/memory.go +++ b/cache/memory/memory.go @@ -4,8 +4,8 @@ package memory import ( "sync" - "github.com/micro/go-micro/v3/cache" - "github.com/micro/go-micro/v3/errors" + "github.com/unistack-org/micro/v3/cache" + "github.com/unistack-org/micro/v3/errors" ) type memoryCache struct { diff --git a/client/backoff.go b/client/backoff.go index d20ec778..5a401453 100644 --- a/client/backoff.go +++ b/client/backoff.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/micro/go-micro/v3/util/backoff" + "github.com/unistack-org/micro/v3/util/backoff" ) type BackoffFunc func(ctx context.Context, req Request, attempts int) (time.Duration, error) diff --git a/client/cache.go b/client/cache.go index dfcff812..62448ee8 100644 --- a/client/cache.go +++ b/client/cache.go @@ -7,7 +7,7 @@ import ( "hash/fnv" "time" - "github.com/micro/go-micro/v3/metadata" + "github.com/unistack-org/micro/v3/metadata" cache "github.com/patrickmn/go-cache" ) diff --git a/client/cache_test.go b/client/cache_test.go index 8125e67e..decd0ce0 100644 --- a/client/cache_test.go +++ b/client/cache_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/metadata" + "github.com/unistack-org/micro/v3/metadata" ) func TestCache(t *testing.T) { diff --git a/client/client.go b/client/client.go index 2b18f279..4ce1911f 100644 --- a/client/client.go +++ b/client/client.go @@ -5,7 +5,7 @@ import ( "context" "time" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) // Client is the interface used to make requests to services. diff --git a/client/grpc/codec.go b/client/grpc/codec.go index c3775455..63f60d29 100644 --- a/client/grpc/codec.go +++ b/client/grpc/codec.go @@ -9,8 +9,8 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" "github.com/oxtoacart/bpool" "google.golang.org/grpc" "google.golang.org/grpc/encoding" diff --git a/client/grpc/error.go b/client/grpc/error.go index 7b690b38..9685c611 100644 --- a/client/grpc/error.go +++ b/client/grpc/error.go @@ -1,7 +1,7 @@ package grpc import ( - "github.com/micro/go-micro/v3/errors" + "github.com/unistack-org/micro/v3/errors" "google.golang.org/grpc/status" ) diff --git a/client/grpc/grpc.go b/client/grpc/grpc.go index f230fa46..fd5dbcd8 100644 --- a/client/grpc/grpc.go +++ b/client/grpc/grpc.go @@ -11,11 +11,11 @@ import ( "sync/atomic" "time" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/client" - raw "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/metadata" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/client" + raw "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/metadata" "google.golang.org/grpc" "google.golang.org/grpc/credentials" diff --git a/client/grpc/grpc_test.go b/client/grpc/grpc_test.go index 1b05ae83..52a3ddc5 100644 --- a/client/grpc/grpc_test.go +++ b/client/grpc/grpc_test.go @@ -5,12 +5,12 @@ import ( "net" "testing" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" - regRouter "github.com/micro/go-micro/v3/router/registry" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" + regRouter "github.com/unistack-org/micro/v3/router/registry" pgrpc "google.golang.org/grpc" pb "google.golang.org/grpc/examples/helloworld/helloworld" ) diff --git a/client/grpc/message.go b/client/grpc/message.go index cdcc3bd0..7b477426 100644 --- a/client/grpc/message.go +++ b/client/grpc/message.go @@ -1,7 +1,7 @@ package grpc import ( - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" ) type grpcEvent struct { diff --git a/client/grpc/options.go b/client/grpc/options.go index 220f7583..a4d55117 100644 --- a/client/grpc/options.go +++ b/client/grpc/options.go @@ -5,7 +5,7 @@ import ( "context" "crypto/tls" - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" "google.golang.org/grpc" "google.golang.org/grpc/encoding" ) diff --git a/client/grpc/request.go b/client/grpc/request.go index e957eb19..91ac35b8 100644 --- a/client/grpc/request.go +++ b/client/grpc/request.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/codec" ) type grpcRequest struct { diff --git a/client/grpc/response.go b/client/grpc/response.go index 1a871c92..633806bf 100644 --- a/client/grpc/response.go +++ b/client/grpc/response.go @@ -3,8 +3,8 @@ package grpc import ( "strings" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" "google.golang.org/grpc" "google.golang.org/grpc/encoding" ) diff --git a/client/grpc/stream.go b/client/grpc/stream.go index d27493b3..59f0614f 100644 --- a/client/grpc/stream.go +++ b/client/grpc/stream.go @@ -5,7 +5,7 @@ import ( "io" "sync" - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" "google.golang.org/grpc" ) diff --git a/client/lookup.go b/client/lookup.go index 32161b2c..90de314b 100644 --- a/client/lookup.go +++ b/client/lookup.go @@ -4,8 +4,8 @@ import ( "context" "sort" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/router" ) // LookupFunc is used to lookup routes for a service diff --git a/client/mucp/common_test.go b/client/mucp/common_test.go index 24837dd2..c7287b23 100644 --- a/client/mucp/common_test.go +++ b/client/mucp/common_test.go @@ -1,7 +1,7 @@ package mucp import ( - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) var ( diff --git a/client/mucp/mucp.go b/client/mucp/mucp.go index b961f25c..0293384f 100644 --- a/client/mucp/mucp.go +++ b/client/mucp/mucp.go @@ -8,15 +8,15 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/codec" - raw "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/util/buf" - "github.com/micro/go-micro/v3/util/pool" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/codec" + raw "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/util/buf" + "github.com/unistack-org/micro/v3/util/pool" ) type rpcClient struct { diff --git a/client/mucp/mucp_codec.go b/client/mucp/mucp_codec.go index 14754f76..ccb87ca6 100644 --- a/client/mucp/mucp_codec.go +++ b/client/mucp/mucp_codec.go @@ -4,16 +4,16 @@ import ( "bytes" errs "errors" - "github.com/micro/go-micro/v3/codec" - raw "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/codec/grpc" - "github.com/micro/go-micro/v3/codec/json" - "github.com/micro/go-micro/v3/codec/jsonrpc" - "github.com/micro/go-micro/v3/codec/proto" - "github.com/micro/go-micro/v3/codec/protorpc" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/codec" + raw "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec/grpc" + "github.com/unistack-org/micro/v3/codec/json" + "github.com/unistack-org/micro/v3/codec/jsonrpc" + "github.com/unistack-org/micro/v3/codec/proto" + "github.com/unistack-org/micro/v3/codec/protorpc" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/transport" ) const ( diff --git a/client/mucp/mucp_message.go b/client/mucp/mucp_message.go index 9336f2fd..8b6aabdd 100644 --- a/client/mucp/mucp_message.go +++ b/client/mucp/mucp_message.go @@ -1,7 +1,7 @@ package mucp import ( - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" ) type message struct { diff --git a/client/mucp/mucp_request.go b/client/mucp/mucp_request.go index 35b30e1e..8ff9ff85 100644 --- a/client/mucp/mucp_request.go +++ b/client/mucp/mucp_request.go @@ -1,8 +1,8 @@ package mucp import ( - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/codec" ) type rpcRequest struct { diff --git a/client/mucp/mucp_request_test.go b/client/mucp/mucp_request_test.go index f3f975c2..62b3162e 100644 --- a/client/mucp/mucp_request_test.go +++ b/client/mucp/mucp_request_test.go @@ -3,7 +3,7 @@ package mucp import ( "testing" - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" ) func TestRequestOptions(t *testing.T) { diff --git a/client/mucp/mucp_response.go b/client/mucp/mucp_response.go index 0925e5f0..77996133 100644 --- a/client/mucp/mucp_response.go +++ b/client/mucp/mucp_response.go @@ -1,8 +1,8 @@ package mucp import ( - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/transport" ) type rpcResponse struct { diff --git a/client/mucp/mucp_stream.go b/client/mucp/mucp_stream.go index 04a630c1..5a2ab2e8 100644 --- a/client/mucp/mucp_stream.go +++ b/client/mucp/mucp_stream.go @@ -5,8 +5,8 @@ import ( "io" "sync" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/codec" ) // Implements the streamer interface diff --git a/client/mucp/mucp_test.go b/client/mucp/mucp_test.go index 72735095..25589437 100644 --- a/client/mucp/mucp_test.go +++ b/client/mucp/mucp_test.go @@ -5,12 +5,12 @@ import ( "fmt" "testing" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" - regRouter "github.com/micro/go-micro/v3/router/registry" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" + regRouter "github.com/unistack-org/micro/v3/router/registry" ) func newTestRouter() router.Router { diff --git a/client/mucp/options_test.go b/client/mucp/options_test.go index 29b76791..1b6bd53e 100644 --- a/client/mucp/options_test.go +++ b/client/mucp/options_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/transport" ) func TestCallOptions(t *testing.T) { diff --git a/client/options.go b/client/options.go index 3fc5a3f2..65f8fa51 100644 --- a/client/options.go +++ b/client/options.go @@ -4,16 +4,16 @@ import ( "context" "time" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/broker/http" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/router" - regRouter "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/selector" - "github.com/micro/go-micro/v3/selector/random" - "github.com/micro/go-micro/v3/transport" - thttp "github.com/micro/go-micro/v3/transport/http" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/broker/http" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/router" + regRouter "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/selector" + "github.com/unistack-org/micro/v3/selector/random" + "github.com/unistack-org/micro/v3/transport" + thttp "github.com/unistack-org/micro/v3/transport/http" ) type Options struct { diff --git a/client/retry.go b/client/retry.go index e23dc1aa..34632073 100644 --- a/client/retry.go +++ b/client/retry.go @@ -3,7 +3,7 @@ package client import ( "context" - "github.com/micro/go-micro/v3/errors" + "github.com/unistack-org/micro/v3/errors" ) // note that returning either false or a non-nil error will result in the call not being retried diff --git a/client/service/proto/client.pb.go b/client/service/proto/client.pb.go index 8d82354e..0f962eda 100644 --- a/client/service/proto/client.pb.go +++ b/client/service/proto/client.pb.go @@ -1,402 +1,339 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: client/service/proto/client.proto package go_micro_client import ( - context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 { - Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` - Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,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_client_service_proto_client_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_client_service_proto_client_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_27c3d425ddd1a066, []int{0} + return file_client_service_proto_client_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) GetService() string { - if m != nil { - return m.Service +func (x *Request) GetService() string { + if x != nil { + return x.Service } return "" } -func (m *Request) GetEndpoint() string { - if m != nil { - return m.Endpoint +func (x *Request) GetEndpoint() string { + if x != nil { + return x.Endpoint } return "" } -func (m *Request) GetContentType() string { - if m != nil { - return m.ContentType +func (x *Request) GetContentType() string { + if x != nil { + return x.ContentType } return "" } -func (m *Request) GetBody() []byte { - if m != nil { - return m.Body +func (x *Request) GetBody() []byte { + if x != nil { + return x.Body } return nil } type Response struct { - Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,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_client_service_proto_client_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_client_service_proto_client_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_27c3d425ddd1a066, []int{1} + return file_client_service_proto_client_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) GetBody() []byte { - if m != nil { - return m.Body +func (x *Response) GetBody() []byte { + if x != nil { + return x.Body } return nil } type Message struct { - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` - ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` + ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` } -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_client_service_proto_client_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_client_service_proto_client_proto_msgTypes[2] + 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 Message.ProtoReflect.Descriptor instead. func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_27c3d425ddd1a066, []int{2} + return file_client_service_proto_client_proto_rawDescGZIP(), []int{2} } -func (m *Message) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Message.Unmarshal(m, b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return xxx_messageInfo_Message.Size(m) -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func (m *Message) GetTopic() string { - if m != nil { - return m.Topic +func (x *Message) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *Message) GetContentType() string { - if m != nil { - return m.ContentType +func (x *Message) GetContentType() string { + if x != nil { + return x.ContentType } return "" } -func (m *Message) GetBody() []byte { - if m != nil { - return m.Body +func (x *Message) GetBody() []byte { + if x != nil { + return x.Body } return nil } -func init() { - proto.RegisterType((*Request)(nil), "go.micro.client.Request") - proto.RegisterType((*Response)(nil), "go.micro.client.Response") - proto.RegisterType((*Message)(nil), "go.micro.client.Message") +var File_client_service_proto_client_proto protoreflect.FileDescriptor + +var file_client_service_proto_client_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x22, 0x76, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x1e, 0x0a, 0x08, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x56, 0x0a, 0x07, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x21, 0x0a, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, + 0x62, 0x6f, 0x64, 0x79, 0x32, 0xcd, 0x01, 0x0a, 0x06, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, + 0x3d, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x18, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, + 0x72, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x19, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, + 0x0a, 0x06, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, + 0x01, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x07, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x12, 0x18, + 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("client/service/proto/client.proto", fileDescriptor_27c3d425ddd1a066) } +var ( + file_client_service_proto_client_proto_rawDescOnce sync.Once + file_client_service_proto_client_proto_rawDescData = file_client_service_proto_client_proto_rawDesc +) -var fileDescriptor_27c3d425ddd1a066 = []byte{ - // 267 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xc1, 0x4b, 0xc3, 0x30, - 0x14, 0xc6, 0x97, 0x6d, 0xb6, 0xf3, 0x39, 0x10, 0x1e, 0x1e, 0x62, 0x0f, 0xb2, 0xf5, 0xd4, 0x53, - 0x2b, 0x7a, 0x16, 0x0f, 0x3d, 0x0b, 0x52, 0xc5, 0xab, 0xb4, 0xd9, 0x63, 0x06, 0xba, 0x24, 0x36, - 0xd9, 0xa0, 0x7f, 0xa4, 0xff, 0x93, 0x90, 0x46, 0x27, 0xba, 0x5d, 0xbc, 0xe5, 0xfb, 0x7e, 0xe4, - 0x7b, 0x2f, 0x5f, 0x60, 0x29, 0x5a, 0x49, 0xca, 0x15, 0x96, 0xba, 0x9d, 0x14, 0x54, 0x98, 0x4e, - 0x3b, 0x5d, 0x0c, 0x66, 0xee, 0x05, 0x9e, 0xaf, 0x75, 0xbe, 0x91, 0xa2, 0xd3, 0xf9, 0x60, 0xa7, - 0x3b, 0x88, 0x2b, 0x7a, 0xdf, 0x92, 0x75, 0xc8, 0x21, 0x0e, 0x37, 0x39, 0x5b, 0xb0, 0xec, 0xb4, - 0xfa, 0x92, 0x98, 0xc0, 0x8c, 0xd4, 0xca, 0x68, 0xa9, 0x1c, 0x1f, 0x7b, 0xf4, 0xad, 0x71, 0x09, - 0x73, 0xa1, 0x95, 0x23, 0xe5, 0x5e, 0x5d, 0x6f, 0x88, 0x4f, 0x3c, 0x3f, 0x0b, 0xde, 0x73, 0x6f, - 0x08, 0x11, 0xa6, 0x8d, 0x5e, 0xf5, 0x7c, 0xba, 0x60, 0xd9, 0xbc, 0xf2, 0xe7, 0xf4, 0x0a, 0x66, - 0x15, 0x59, 0xa3, 0x95, 0xdd, 0x73, 0xf6, 0x83, 0xbf, 0x40, 0xfc, 0x40, 0xd6, 0xd6, 0x6b, 0xc2, - 0x0b, 0x38, 0x71, 0xda, 0x48, 0x11, 0xb6, 0x1a, 0xc4, 0x9f, 0xb9, 0xe3, 0xe3, 0x73, 0x27, 0xfb, - 0xdc, 0x9b, 0x0f, 0x06, 0x51, 0xe9, 0x9f, 0x8e, 0x77, 0x30, 0x2d, 0xeb, 0xb6, 0x45, 0x9e, 0xff, - 0x2a, 0x25, 0x0f, 0x8d, 0x24, 0x97, 0x07, 0xc8, 0xb0, 0x73, 0x3a, 0xc2, 0x12, 0xa2, 0x27, 0xd7, - 0x51, 0xbd, 0xf9, 0x67, 0x40, 0xc6, 0xae, 0x19, 0xde, 0x43, 0xfc, 0xb8, 0x6d, 0x5a, 0x69, 0xdf, - 0x0e, 0xa4, 0x84, 0x02, 0x92, 0xa3, 0x24, 0x1d, 0x35, 0x91, 0xff, 0xd7, 0xdb, 0xcf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xd6, 0x3f, 0xc3, 0xa1, 0xfc, 0x01, 0x00, 0x00, +func file_client_service_proto_client_proto_rawDescGZIP() []byte { + file_client_service_proto_client_proto_rawDescOnce.Do(func() { + file_client_service_proto_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_service_proto_client_proto_rawDescData) + }) + return file_client_service_proto_client_proto_rawDescData } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ClientClient is the client API for Client service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ClientClient interface { - // Call allows a single request to be made - Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - // Stream is a bidirectional stream - Stream(ctx context.Context, opts ...grpc.CallOption) (Client_StreamClient, error) - // Publish publishes a message and returns an empty Message - Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) +var file_client_service_proto_client_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_client_service_proto_client_proto_goTypes = []interface{}{ + (*Request)(nil), // 0: go.micro.client.Request + (*Response)(nil), // 1: go.micro.client.Response + (*Message)(nil), // 2: go.micro.client.Message +} +var file_client_service_proto_client_proto_depIdxs = []int32{ + 0, // 0: go.micro.client.Client.Call:input_type -> go.micro.client.Request + 0, // 1: go.micro.client.Client.Stream:input_type -> go.micro.client.Request + 2, // 2: go.micro.client.Client.Publish:input_type -> go.micro.client.Message + 1, // 3: go.micro.client.Client.Call:output_type -> go.micro.client.Response + 1, // 4: go.micro.client.Client.Stream:output_type -> go.micro.client.Response + 2, // 5: go.micro.client.Client.Publish:output_type -> go.micro.client.Message + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] 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 } -type clientClient struct { - cc *grpc.ClientConn -} - -func NewClientClient(cc *grpc.ClientConn) ClientClient { - return &clientClient{cc} -} - -func (c *clientClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - out := new(Response) - err := c.cc.Invoke(ctx, "/go.micro.client.Client/Call", in, out, opts...) - if err != nil { - return nil, err +func init() { file_client_service_proto_client_proto_init() } +func file_client_service_proto_client_proto_init() { + if File_client_service_proto_client_proto != nil { + return } - return out, nil -} - -func (c *clientClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Client_StreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_Client_serviceDesc.Streams[0], "/go.micro.client.Client/Stream", opts...) - if err != nil { - return nil, err + if !protoimpl.UnsafeEnabled { + file_client_service_proto_client_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_client_service_proto_client_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 + } + } + file_client_service_proto_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - x := &clientStreamClient{stream} - return x, nil -} - -type Client_StreamClient interface { - Send(*Request) error - Recv() (*Response, error) - grpc.ClientStream -} - -type clientStreamClient struct { - grpc.ClientStream -} - -func (x *clientStreamClient) Send(m *Request) error { - return x.ClientStream.SendMsg(m) -} - -func (x *clientStreamClient) Recv() (*Response, error) { - m := new(Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *clientClient) Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) { - out := new(Message) - err := c.cc.Invoke(ctx, "/go.micro.client.Client/Publish", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ClientServer is the server API for Client service. -type ClientServer interface { - // Call allows a single request to be made - Call(context.Context, *Request) (*Response, error) - // Stream is a bidirectional stream - Stream(Client_StreamServer) error - // Publish publishes a message and returns an empty Message - Publish(context.Context, *Message) (*Message, error) -} - -// UnimplementedClientServer can be embedded to have forward compatible implementations. -type UnimplementedClientServer struct { -} - -func (*UnimplementedClientServer) Call(ctx context.Context, req *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") -} -func (*UnimplementedClientServer) Stream(srv Client_StreamServer) error { - return status.Errorf(codes.Unimplemented, "method Stream not implemented") -} -func (*UnimplementedClientServer) Publish(ctx context.Context, req *Message) (*Message, error) { - return nil, status.Errorf(codes.Unimplemented, "method Publish not implemented") -} - -func RegisterClientServer(s *grpc.Server, srv ClientServer) { - s.RegisterService(&_Client_serviceDesc, srv) -} - -func _Client_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClientServer).Call(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.client.Client/Call", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClientServer).Call(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Client_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClientServer).Stream(&clientStreamServer{stream}) -} - -type Client_StreamServer interface { - Send(*Response) error - Recv() (*Request, error) - grpc.ServerStream -} - -type clientStreamServer struct { - grpc.ServerStream -} - -func (x *clientStreamServer) Send(m *Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *clientStreamServer) Recv() (*Request, error) { - m := new(Request) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Client_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Message) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClientServer).Publish(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.client.Client/Publish", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClientServer).Publish(ctx, req.(*Message)) - } - return interceptor(ctx, in, info, handler) -} - -var _Client_serviceDesc = grpc.ServiceDesc{ - ServiceName: "go.micro.client.Client", - HandlerType: (*ClientServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Call", - Handler: _Client_Call_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_client_service_proto_client_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, }, - { - MethodName: "Publish", - Handler: _Client_Publish_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Stream", - Handler: _Client_Stream_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "client/service/proto/client.proto", + GoTypes: file_client_service_proto_client_proto_goTypes, + DependencyIndexes: file_client_service_proto_client_proto_depIdxs, + MessageInfos: file_client_service_proto_client_proto_msgTypes, + }.Build() + File_client_service_proto_client_proto = out.File + file_client_service_proto_client_proto_rawDesc = nil + file_client_service_proto_client_proto_goTypes = nil + file_client_service_proto_client_proto_depIdxs = nil } diff --git a/client/service/proto/client.pb.micro.go b/client/service/proto/client.pb.micro.go index bdfe1081..89c6f502 100644 --- a/client/service/proto/client.pb.micro.go +++ b/client/service/proto/client.pb.micro.go @@ -11,9 +11,9 @@ import ( import ( context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/client/service/proto/client_grpc.pb.go b/client/service/proto/client_grpc.pb.go new file mode 100644 index 00000000..1253b4b8 --- /dev/null +++ b/client/service/proto/client_grpc.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package go_micro_client + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ClientClient is the client API for Client service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ClientClient interface { + // Call allows a single request to be made + Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + // Stream is a bidirectional stream + Stream(ctx context.Context, opts ...grpc.CallOption) (Client_StreamClient, error) + // Publish publishes a message and returns an empty Message + Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) +} + +type clientClient struct { + cc grpc.ClientConnInterface +} + +func NewClientClient(cc grpc.ClientConnInterface) ClientClient { + return &clientClient{cc} +} + +func (c *clientClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/go.micro.client.Client/Call", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *clientClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Client_StreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_Client_serviceDesc.Streams[0], "/go.micro.client.Client/Stream", opts...) + if err != nil { + return nil, err + } + x := &clientStreamClient{stream} + return x, nil +} + +type Client_StreamClient interface { + Send(*Request) error + Recv() (*Response, error) + grpc.ClientStream +} + +type clientStreamClient struct { + grpc.ClientStream +} + +func (x *clientStreamClient) Send(m *Request) error { + return x.ClientStream.SendMsg(m) +} + +func (x *clientStreamClient) Recv() (*Response, error) { + m := new(Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *clientClient) Publish(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) { + out := new(Message) + err := c.cc.Invoke(ctx, "/go.micro.client.Client/Publish", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ClientServer is the server API for Client service. +// All implementations must embed UnimplementedClientServer +// for forward compatibility +type ClientServer interface { + // Call allows a single request to be made + Call(context.Context, *Request) (*Response, error) + // Stream is a bidirectional stream + Stream(Client_StreamServer) error + // Publish publishes a message and returns an empty Message + Publish(context.Context, *Message) (*Message, error) + mustEmbedUnimplementedClientServer() +} + +// UnimplementedClientServer must be embedded to have forward compatible implementations. +type UnimplementedClientServer struct { +} + +func (*UnimplementedClientServer) Call(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") +} +func (*UnimplementedClientServer) Stream(Client_StreamServer) error { + return status.Errorf(codes.Unimplemented, "method Stream not implemented") +} +func (*UnimplementedClientServer) Publish(context.Context, *Message) (*Message, error) { + return nil, status.Errorf(codes.Unimplemented, "method Publish not implemented") +} +func (*UnimplementedClientServer) mustEmbedUnimplementedClientServer() {} + +func RegisterClientServer(s *grpc.Server, srv ClientServer) { + s.RegisterService(&_Client_serviceDesc, srv) +} + +func _Client_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClientServer).Call(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.client.Client/Call", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClientServer).Call(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Client_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ClientServer).Stream(&clientStreamServer{stream}) +} + +type Client_StreamServer interface { + Send(*Response) error + Recv() (*Request, error) + grpc.ServerStream +} + +type clientStreamServer struct { + grpc.ServerStream +} + +func (x *clientStreamServer) Send(m *Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *clientStreamServer) Recv() (*Request, error) { + m := new(Request) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Client_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Message) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ClientServer).Publish(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.client.Client/Publish", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ClientServer).Publish(ctx, req.(*Message)) + } + return interceptor(ctx, in, info, handler) +} + +var _Client_serviceDesc = grpc.ServiceDesc{ + ServiceName: "go.micro.client.Client", + HandlerType: (*ClientServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Call", + Handler: _Client_Call_Handler, + }, + { + MethodName: "Publish", + Handler: _Client_Publish_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Stream", + Handler: _Client_Stream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "client/service/proto/client.proto", +} diff --git a/client/test_request.go b/client/test_request.go index 80e1d175..82b9b258 100644 --- a/client/test_request.go +++ b/client/test_request.go @@ -1,7 +1,7 @@ package client import ( - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type testRequest struct { diff --git a/cmd/protoc-gen-micro/.gitignore b/cmd/protoc-gen-micro/.gitignore new file mode 100644 index 00000000..7335acd5 --- /dev/null +++ b/cmd/protoc-gen-micro/.gitignore @@ -0,0 +1,33 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test +_build + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +# ignore go build and test outputs +coverage.txt +coverage.out + +# ignore locally built binaries +protoc-gen-micro +dist diff --git a/cmd/protoc-gen-micro/README.md b/cmd/protoc-gen-micro/README.md new file mode 100644 index 00000000..4c202e86 --- /dev/null +++ b/cmd/protoc-gen-micro/README.md @@ -0,0 +1,138 @@ +# protoc-gen-micro + +This is protobuf code generation for micro. We use protoc-gen-micro to reduce boilerplate code. + +## Install + +``` +go get github.com/micro/micro/v3/cmd/protoc-gen-micro@master +``` + +Also required: + +- [protoc](https://github.com/google/protobuf) +- [protoc-gen-go](https://github.com/golang/protobuf) + +## Usage + +Define your service as `greeter.proto` + +``` +syntax = "proto3"; + +service Greeter { + rpc Hello(Request) returns (Response) {} +} + +message Request { + string name = 1; +} + +message Response { + string msg = 1; +} +``` + +Generate the code + +``` +protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. greeter.proto +``` + +Your output result should be: + +``` +./ + greeter.proto # original protobuf file + greeter.pb.go # auto-generated by protoc-gen-go + greeter.micro.go # auto-generated by protoc-gen-micro +``` + +The micro generated code includes clients and handlers which reduce boiler plate code + +### Server + +Register the handler with your micro server + +```go +type Greeter struct{} + +func (g *Greeter) Hello(ctx context.Context, req *proto.Request, rsp *proto.Response) error { + rsp.Msg = "Hello " + req.Name + return nil +} + +proto.RegisterGreeterHandler(service.Server(), &Greeter{}) +``` + +### Client + +Create a service client with your micro client + +```go +client := proto.NewGreeterService("greeter", service.Client()) +``` + +### Errors + +If you see an error about `protoc-gen-micro` not being found or executable, it's likely your environment may not be configured correctly. If you've already installed `protoc`, `protoc-gen-go`, and `protoc-gen-micro` ensure you've included `$GOPATH/bin` in your `PATH`. + +Alternative specify the Go plugin paths as arguments to the `protoc` command + +``` +protoc --plugin=protoc-gen-go=$GOPATH/bin/protoc-gen-go --plugin=protoc-gen-micro=$GOPATH/bin/protoc-gen-micro --proto_path=$GOPATH/src:. --micro_out=. --go_out=. greeter.proto +``` + +### Endpoint + +Add a micro API endpoint which routes directly to an RPC method + +Usage: + +1. Clone `github.com/googleapis/googleapis` to use this feature as it requires http annotations. +2. The protoc command must include `-I$GOPATH/src/github.com/googleapis/googleapis` for the annotations import. + +```diff +syntax = "proto3"; + +import "google/api/annotations.proto"; + +service Greeter { + rpc Hello(Request) returns (Response) { + option (google.api.http) = { post: "/hello"; body: "*"; }; + } +} + +message Request { + string name = 1; +} + +message Response { + string msg = 1; +} +``` + +The proto generates a `RegisterGreeterHandler` function with a [api.Endpoint](https://godoc.org/github.com/micro/go-micro/api#Endpoint). + +```diff +func RegisterGreeterHandler(s server.Server, hdlr GreeterHandler, opts ...server.HandlerOption) error { + type greeter interface { + Hello(ctx context.Context, in *Request, out *Response) error + } + type Greeter struct { + greeter + } + h := &greeterHandler{hdlr} + opts = append(opts, api.WithEndpoint(&api.Endpoint{ + Name: "Greeter.Hello", + Path: []string{"/hello"}, + Method: []string{"POST"}, + Handler: "rpc", + })) + return s.Handle(s.NewHandler(&Greeter{h}, opts...)) +} +``` + +## LICENSE + +protoc-gen-micro is a liberal reuse of protoc-gen-go hence we maintain the original license diff --git a/cmd/protoc-gen-micro/examples/greeter/greeter.pb.go b/cmd/protoc-gen-micro/examples/greeter/greeter.pb.go new file mode 100644 index 00000000..44a8e1f5 --- /dev/null +++ b/cmd/protoc-gen-micro/examples/greeter/greeter.pb.go @@ -0,0 +1,223 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 +// source: cmd/protoc-gen-micro/examples/greeter/greeter.proto + +package greeter + +import ( + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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 that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type Request struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Request) Reset() { + *x = Request{} + if protoimpl.UnsafeEnabled { + mi := &file_cmd_protoc_gen_micro_examples_greeter_greeter_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_cmd_protoc_gen_micro_examples_greeter_greeter_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 file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescGZIP(), []int{0} +} + +func (x *Request) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type Response struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` +} + +func (x *Response) Reset() { + *x = Response{} + if protoimpl.UnsafeEnabled { + mi := &file_cmd_protoc_gen_micro_examples_greeter_greeter_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_cmd_protoc_gen_micro_examples_greeter_greeter_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 file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescGZIP(), []int{1} +} + +func (x *Response) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +var File_cmd_protoc_gen_micro_examples_greeter_greeter_proto protoreflect.FileDescriptor + +var file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDesc = []byte{ + 0x0a, 0x33, 0x63, 0x6d, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, + 0x2d, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, + 0x67, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x1d, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x22, 0x1c, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, + 0x32, 0x6e, 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x05, 0x48, + 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x08, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x0b, 0x22, 0x06, 0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x3a, 0x01, 0x2a, 0x12, 0x32, 0x0a, 0x06, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x08, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x09, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x09, 0x12, 0x07, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x28, 0x01, 0x30, 0x01, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescOnce sync.Once + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescData = file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDesc +) + +func file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescGZIP() []byte { + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescOnce.Do(func() { + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescData = protoimpl.X.CompressGZIP(file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescData) + }) + return file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDescData +} + +var file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_goTypes = []interface{}{ + (*Request)(nil), // 0: Request + (*Response)(nil), // 1: Response +} +var file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_depIdxs = []int32{ + 0, // 0: Greeter.Hello:input_type -> Request + 0, // 1: Greeter.Stream:input_type -> Request + 1, // 2: Greeter.Hello:output_type -> Response + 1, // 3: Greeter.Stream:output_type -> Response + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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_cmd_protoc_gen_micro_examples_greeter_greeter_proto_init() } +func file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_init() { + if File_cmd_protoc_gen_micro_examples_greeter_greeter_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_cmd_protoc_gen_micro_examples_greeter_greeter_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_cmd_protoc_gen_micro_examples_greeter_greeter_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_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_goTypes, + DependencyIndexes: file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_depIdxs, + MessageInfos: file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_msgTypes, + }.Build() + File_cmd_protoc_gen_micro_examples_greeter_greeter_proto = out.File + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_rawDesc = nil + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_goTypes = nil + file_cmd_protoc_gen_micro_examples_greeter_greeter_proto_depIdxs = nil +} diff --git a/cmd/protoc-gen-micro/examples/greeter/greeter.pb.micro.go b/cmd/protoc-gen-micro/examples/greeter/greeter.pb.micro.go new file mode 100644 index 00000000..12e02a86 --- /dev/null +++ b/cmd/protoc-gen-micro/examples/greeter/greeter.pb.micro.go @@ -0,0 +1,222 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: cmd/protoc-gen-micro/examples/greeter/greeter.proto + +package greeter + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + math "math" +) + +import ( + context "context" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// 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 + +// Reference imports to suppress errors if they are not otherwise used. +var _ api.Endpoint +var _ context.Context +var _ client.Option +var _ server.Option + +// Api Endpoints for Greeter service + +func NewGreeterEndpoints() []*api.Endpoint { + return []*api.Endpoint{ + &api.Endpoint{ + Name: "Greeter.Hello", + Path: []string{"/hello"}, + Method: []string{"POST"}, + Body: "*", + Handler: "rpc", + }, + &api.Endpoint{ + Name: "Greeter.Stream", + Path: []string{"/stream"}, + Method: []string{"GET"}, + Stream: true, + Handler: "rpc", + }, + } +} + +// Client API for Greeter service + +type GreeterService interface { + Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) + Stream(ctx context.Context, opts ...client.CallOption) (Greeter_StreamService, error) +} + +type greeterService struct { + c client.Client + name string +} + +func NewGreeterService(name string, c client.Client) GreeterService { + return &greeterService{ + c: c, + name: name, + } +} + +func (c *greeterService) Hello(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) { + req := c.c.NewRequest(c.name, "Greeter.Hello", in) + out := new(Response) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *greeterService) Stream(ctx context.Context, opts ...client.CallOption) (Greeter_StreamService, error) { + req := c.c.NewRequest(c.name, "Greeter.Stream", &Request{}) + stream, err := c.c.Stream(ctx, req, opts...) + if err != nil { + return nil, err + } + return &greeterServiceStream{stream}, nil +} + +type Greeter_StreamService interface { + Context() context.Context + SendMsg(interface{}) error + RecvMsg(interface{}) error + Close() error + Send(*Request) error + Recv() (*Response, error) +} + +type greeterServiceStream struct { + stream client.Stream +} + +func (x *greeterServiceStream) Close() error { + return x.stream.Close() +} + +func (x *greeterServiceStream) Context() context.Context { + return x.stream.Context() +} + +func (x *greeterServiceStream) SendMsg(m interface{}) error { + return x.stream.Send(m) +} + +func (x *greeterServiceStream) RecvMsg(m interface{}) error { + return x.stream.Recv(m) +} + +func (x *greeterServiceStream) Send(m *Request) error { + return x.stream.Send(m) +} + +func (x *greeterServiceStream) Recv() (*Response, error) { + m := new(Response) + err := x.stream.Recv(m) + if err != nil { + return nil, err + } + return m, nil +} + +// Server API for Greeter service + +type GreeterHandler interface { + Hello(context.Context, *Request, *Response) error + Stream(context.Context, Greeter_StreamStream) error +} + +func RegisterGreeterHandler(s server.Server, hdlr GreeterHandler, opts ...server.HandlerOption) error { + type greeter interface { + Hello(ctx context.Context, in *Request, out *Response) error + Stream(ctx context.Context, stream server.Stream) error + } + type Greeter struct { + greeter + } + h := &greeterHandler{hdlr} + opts = append(opts, api.WithEndpoint(&api.Endpoint{ + Name: "Greeter.Hello", + Path: []string{"/hello"}, + Method: []string{"POST"}, + Body: "*", + Handler: "rpc", + })) + opts = append(opts, api.WithEndpoint(&api.Endpoint{ + Name: "Greeter.Stream", + Path: []string{"/stream"}, + Method: []string{"GET"}, + Stream: true, + Handler: "rpc", + })) + return s.Handle(s.NewHandler(&Greeter{h}, opts...)) +} + +type greeterHandler struct { + GreeterHandler +} + +func (h *greeterHandler) Hello(ctx context.Context, in *Request, out *Response) error { + return h.GreeterHandler.Hello(ctx, in, out) +} + +func (h *greeterHandler) Stream(ctx context.Context, stream server.Stream) error { + return h.GreeterHandler.Stream(ctx, &greeterStreamStream{stream}) +} + +type Greeter_StreamStream interface { + Context() context.Context + SendMsg(interface{}) error + RecvMsg(interface{}) error + Close() error + Send(*Response) error + Recv() (*Request, error) +} + +type greeterStreamStream struct { + stream server.Stream +} + +func (x *greeterStreamStream) Close() error { + return x.stream.Close() +} + +func (x *greeterStreamStream) Context() context.Context { + return x.stream.Context() +} + +func (x *greeterStreamStream) SendMsg(m interface{}) error { + return x.stream.Send(m) +} + +func (x *greeterStreamStream) RecvMsg(m interface{}) error { + return x.stream.Recv(m) +} + +func (x *greeterStreamStream) Send(m *Response) error { + return x.stream.Send(m) +} + +func (x *greeterStreamStream) Recv() (*Request, error) { + m := new(Request) + if err := x.stream.Recv(m); err != nil { + return nil, err + } + return m, nil +} diff --git a/cmd/protoc-gen-micro/examples/greeter/greeter.proto b/cmd/protoc-gen-micro/examples/greeter/greeter.proto new file mode 100644 index 00000000..8bbb1e57 --- /dev/null +++ b/cmd/protoc-gen-micro/examples/greeter/greeter.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +import "google/api/annotations.proto"; + +service Greeter { + rpc Hello(Request) returns (Response) { + option (google.api.http) = { post: "/hello"; body: "*"; }; + } + rpc Stream(stream Request) returns (stream Response) { + option (google.api.http) = { get: "/stream"; }; + } +} + +message Request { + string name = 1; +} + +message Response { + string msg = 1; +} diff --git a/cmd/protoc-gen-micro/examples/greeter/greeter_grpc.pb.go b/cmd/protoc-gen-micro/examples/greeter/greeter_grpc.pb.go new file mode 100644 index 00000000..36fc6c02 --- /dev/null +++ b/cmd/protoc-gen-micro/examples/greeter/greeter_grpc.pb.go @@ -0,0 +1,159 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package greeter + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// GreeterClient is the client API for Greeter service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type GreeterClient interface { + Hello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + Stream(ctx context.Context, opts ...grpc.CallOption) (Greeter_StreamClient, error) +} + +type greeterClient struct { + cc grpc.ClientConnInterface +} + +func NewGreeterClient(cc grpc.ClientConnInterface) GreeterClient { + return &greeterClient{cc} +} + +func (c *greeterClient) Hello(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/Greeter/Hello", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *greeterClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Greeter_StreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_Greeter_serviceDesc.Streams[0], "/Greeter/Stream", opts...) + if err != nil { + return nil, err + } + x := &greeterStreamClient{stream} + return x, nil +} + +type Greeter_StreamClient interface { + Send(*Request) error + Recv() (*Response, error) + grpc.ClientStream +} + +type greeterStreamClient struct { + grpc.ClientStream +} + +func (x *greeterStreamClient) Send(m *Request) error { + return x.ClientStream.SendMsg(m) +} + +func (x *greeterStreamClient) Recv() (*Response, error) { + m := new(Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// GreeterServer is the server API for Greeter service. +// All implementations must embed UnimplementedGreeterServer +// for forward compatibility +type GreeterServer interface { + Hello(context.Context, *Request) (*Response, error) + Stream(Greeter_StreamServer) error + mustEmbedUnimplementedGreeterServer() +} + +// UnimplementedGreeterServer must be embedded to have forward compatible implementations. +type UnimplementedGreeterServer struct { +} + +func (*UnimplementedGreeterServer) Hello(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented") +} +func (*UnimplementedGreeterServer) Stream(Greeter_StreamServer) error { + return status.Errorf(codes.Unimplemented, "method Stream not implemented") +} +func (*UnimplementedGreeterServer) mustEmbedUnimplementedGreeterServer() {} + +func RegisterGreeterServer(s *grpc.Server, srv GreeterServer) { + s.RegisterService(&_Greeter_serviceDesc, srv) +} + +func _Greeter_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GreeterServer).Hello(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Greeter/Hello", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GreeterServer).Hello(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Greeter_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(GreeterServer).Stream(&greeterStreamServer{stream}) +} + +type Greeter_StreamServer interface { + Send(*Response) error + Recv() (*Request, error) + grpc.ServerStream +} + +type greeterStreamServer struct { + grpc.ServerStream +} + +func (x *greeterStreamServer) Send(m *Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *greeterStreamServer) Recv() (*Request, error) { + m := new(Request) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Greeter_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Greeter", + HandlerType: (*GreeterServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Hello", + Handler: _Greeter_Hello_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Stream", + Handler: _Greeter_Stream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "cmd/protoc-gen-micro/examples/greeter/greeter.proto", +} diff --git a/cmd/protoc-gen-micro/generator/Makefile b/cmd/protoc-gen-micro/generator/Makefile new file mode 100644 index 00000000..b5715c35 --- /dev/null +++ b/cmd/protoc-gen-micro/generator/Makefile @@ -0,0 +1,40 @@ +# Go support for Protocol Buffers - Google's data interchange format +# +# Copyright 2010 The Go Authors. All rights reserved. +# https://github.com/golang/protobuf +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include $(GOROOT)/src/Make.inc + +TARG=github.com/golang/protobuf/compiler/generator +GOFILES=\ + generator.go\ + +DEPS=../descriptor ../plugin ../../proto + +include $(GOROOT)/src/Make.pkg diff --git a/cmd/protoc-gen-micro/generator/generator.go b/cmd/protoc-gen-micro/generator/generator.go new file mode 100644 index 00000000..2eed227a --- /dev/null +++ b/cmd/protoc-gen-micro/generator/generator.go @@ -0,0 +1,2734 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/* + The code generator for the plugin for the Google protocol buffer compiler. + It generates Go code from the protocol buffer description files read by the + main routine. +*/ +package generator + +import ( + "bufio" + "bytes" + "compress/gzip" + "crypto/sha256" + "encoding/hex" + "fmt" + "go/ast" + "go/build" + "go/parser" + "go/printer" + "go/token" + "log" + "os" + "path" + "sort" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" +) + +// generatedCodeVersion indicates a version of the generated code. +// It is incremented whenever an incompatibility between the generated code and +// proto package is introduced; the generated code references +// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion). +const generatedCodeVersion = 3 + +// A Plugin provides functionality to add to the output during Go code generation, +// such as to produce RPC stubs. +type Plugin interface { + // Name identifies the plugin. + Name() string + // Init is called once after data structures are built but before + // code generation begins. + Init(g *Generator) + // Generate produces the code generated by the plugin for this file, + // except for the imports, by calling the generator's methods P, In, and Out. + Generate(file *FileDescriptor) + // GenerateImports produces the import declarations for this file. + // It is called after Generate. + GenerateImports(file *FileDescriptor, imports map[GoImportPath]GoPackageName) +} + +var plugins []Plugin + +// RegisterPlugin installs a (second-order) plugin to be run when the Go output is generated. +// It is typically called during initialization. +func RegisterPlugin(p Plugin) { + plugins = append(plugins, p) +} + +// A GoImportPath is the import path of a Go package. e.g., "google.golang.org/genproto/protobuf". +type GoImportPath string + +func (p GoImportPath) String() string { return strconv.Quote(string(p)) } + +// A GoPackageName is the name of a Go package. e.g., "protobuf". +type GoPackageName string + +// Each type we import as a protocol buffer (other than FileDescriptorProto) needs +// a pointer to the FileDescriptorProto that represents it. These types achieve that +// wrapping by placing each Proto inside a struct with the pointer to its File. The +// structs have the same names as their contents, with "Proto" removed. +// FileDescriptor is used to store the things that it points to. + +// The file and package name method are common to messages and enums. +type common struct { + file *FileDescriptor // File this object comes from. +} + +// GoImportPath is the import path of the Go package containing the type. +func (c *common) GoImportPath() GoImportPath { + return c.file.importPath +} + +func (c *common) File() *FileDescriptor { return c.file } + +func fileIsProto3(file *descriptor.FileDescriptorProto) bool { + return file.GetSyntax() == "proto3" +} + +func (c *common) proto3() bool { return fileIsProto3(c.file.FileDescriptorProto) } + +// Descriptor represents a protocol buffer message. +type Descriptor struct { + common + *descriptor.DescriptorProto + parent *Descriptor // The containing message, if any. + nested []*Descriptor // Inner messages, if any. + enums []*EnumDescriptor // Inner enums, if any. + ext []*ExtensionDescriptor // Extensions, if any. + typename []string // Cached typename vector. + index int // The index into the container, whether the file or another message. + path string // The SourceCodeInfo path as comma-separated integers. + group bool +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (d *Descriptor) TypeName() []string { + if d.typename != nil { + return d.typename + } + n := 0 + for parent := d; parent != nil; parent = parent.parent { + n++ + } + s := make([]string, n) + for parent := d; parent != nil; parent = parent.parent { + n-- + s[n] = parent.GetName() + } + d.typename = s + return s +} + +// EnumDescriptor describes an enum. If it's at top level, its parent will be nil. +// Otherwise it will be the descriptor of the message in which it is defined. +type EnumDescriptor struct { + common + *descriptor.EnumDescriptorProto + parent *Descriptor // The containing message, if any. + typename []string // Cached typename vector. + index int // The index into the container, whether the file or a message. + path string // The SourceCodeInfo path as comma-separated integers. +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (e *EnumDescriptor) TypeName() (s []string) { + if e.typename != nil { + return e.typename + } + name := e.GetName() + if e.parent == nil { + s = make([]string, 1) + } else { + pname := e.parent.TypeName() + s = make([]string, len(pname)+1) + copy(s, pname) + } + s[len(s)-1] = name + e.typename = s + return s +} + +// Everything but the last element of the full type name, CamelCased. +// The values of type Foo.Bar are call Foo_value1... not Foo_Bar_value1... . +func (e *EnumDescriptor) prefix() string { + if e.parent == nil { + // If the enum is not part of a message, the prefix is just the type name. + return CamelCase(*e.Name) + "_" + } + typeName := e.TypeName() + return CamelCaseSlice(typeName[0:len(typeName)-1]) + "_" +} + +// The integer value of the named constant in this enumerated type. +func (e *EnumDescriptor) integerValueAsString(name string) string { + for _, c := range e.Value { + if c.GetName() == name { + return fmt.Sprint(c.GetNumber()) + } + } + log.Fatal("cannot find value for enum constant") + return "" +} + +// ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil. +// Otherwise it will be the descriptor of the message in which it is defined. +type ExtensionDescriptor struct { + common + *descriptor.FieldDescriptorProto + parent *Descriptor // The containing message, if any. +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (e *ExtensionDescriptor) TypeName() (s []string) { + name := e.GetName() + if e.parent == nil { + // top-level extension + s = make([]string, 1) + } else { + pname := e.parent.TypeName() + s = make([]string, len(pname)+1) + copy(s, pname) + } + s[len(s)-1] = name + return s +} + +// DescName returns the variable name used for the generated descriptor. +func (e *ExtensionDescriptor) DescName() string { + // The full type name. + typeName := e.TypeName() + // Each scope of the extension is individually CamelCased, and all are joined with "_" with an "E_" prefix. + for i, s := range typeName { + typeName[i] = CamelCase(s) + } + return "E_" + strings.Join(typeName, "_") +} + +// ImportedDescriptor describes a type that has been publicly imported from another file. +type ImportedDescriptor struct { + common + o Object +} + +func (id *ImportedDescriptor) TypeName() []string { return id.o.TypeName() } + +// FileDescriptor describes an protocol buffer descriptor file (.proto). +// It includes slices of all the messages and enums defined within it. +// Those slices are constructed by WrapTypes. +type FileDescriptor struct { + *descriptor.FileDescriptorProto + desc []*Descriptor // All the messages defined in this file. + enum []*EnumDescriptor // All the enums defined in this file. + ext []*ExtensionDescriptor // All the top-level extensions defined in this file. + imp []*ImportedDescriptor // All types defined in files publicly imported by this file. + + // Comments, stored as a map of path (comma-separated integers) to the comment. + comments map[string]*descriptor.SourceCodeInfo_Location + + // The full list of symbols that are exported, + // as a map from the exported object to its symbols. + // This is used for supporting public imports. + exported map[Object][]symbol + + importPath GoImportPath // Import path of this file's package. + packageName GoPackageName // Name of this file's Go package. + + proto3 bool // whether to generate proto3 code for this file +} + +// VarName is the variable name we'll use in the generated code to refer +// to the compressed bytes of this descriptor. It is not exported, so +// it is only valid inside the generated package. +func (d *FileDescriptor) VarName() string { + h := sha256.Sum256([]byte(d.GetName())) + return fmt.Sprintf("fileDescriptor_%s", hex.EncodeToString(h[:8])) +} + +// goPackageOption interprets the file's go_package option. +// If there is no go_package, it returns ("", "", false). +// If there's a simple name, it returns ("", pkg, true). +// If the option implies an import path, it returns (impPath, pkg, true). +func (d *FileDescriptor) goPackageOption() (impPath GoImportPath, pkg GoPackageName, ok bool) { + opt := d.GetOptions().GetGoPackage() + if opt == "" { + return "", "", false + } + // A semicolon-delimited suffix delimits the import path and package name. + sc := strings.Index(opt, ";") + if sc >= 0 { + return GoImportPath(opt[:sc]), cleanPackageName(opt[sc+1:]), true + } + // The presence of a slash implies there's an import path. + slash := strings.LastIndex(opt, "/") + if slash >= 0 { + return GoImportPath(opt), cleanPackageName(opt[slash+1:]), true + } + return "", cleanPackageName(opt), true +} + +// goFileName returns the output name for the generated Go file. +func (d *FileDescriptor) goFileName(pathType pathType) string { + name := *d.Name + if ext := path.Ext(name); ext == ".proto" || ext == ".protodevel" { + name = name[:len(name)-len(ext)] + } + name += ".pb.micro.go" + + if pathType == pathTypeSourceRelative { + return name + } + + // Does the file have a "go_package" option? + // If it does, it may override the filename. + if impPath, _, ok := d.goPackageOption(); ok && impPath != "" { + // Replace the existing dirname with the declared import path. + _, name = path.Split(name) + name = path.Join(string(impPath), name) + return name + } + + return name +} + +func (d *FileDescriptor) addExport(obj Object, sym symbol) { + d.exported[obj] = append(d.exported[obj], sym) +} + +// symbol is an interface representing an exported Go symbol. +type symbol interface { + // GenerateAlias should generate an appropriate alias + // for the symbol from the named package. + GenerateAlias(g *Generator, filename string, pkg GoPackageName) +} + +type messageSymbol struct { + sym string + hasExtensions, isMessageSet bool + oneofTypes []string +} + +type getterSymbol struct { + name string + typ string + typeName string // canonical name in proto world; empty for proto.Message and similar + genType bool // whether typ contains a generated type (message/group/enum) +} + +func (ms *messageSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) { + g.P("// ", ms.sym, " from public import ", filename) + g.P("type ", ms.sym, " = ", pkg, ".", ms.sym) + for _, name := range ms.oneofTypes { + g.P("type ", name, " = ", pkg, ".", name) + } +} + +type enumSymbol struct { + name string + proto3 bool // Whether this came from a proto3 file. +} + +func (es enumSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) { + s := es.name + g.P("// ", s, " from public import ", filename) + g.P("type ", s, " = ", pkg, ".", s) + g.P("var ", s, "_name = ", pkg, ".", s, "_name") + g.P("var ", s, "_value = ", pkg, ".", s, "_value") +} + +type constOrVarSymbol struct { + sym string + typ string // either "const" or "var" + cast string // if non-empty, a type cast is required (used for enums) +} + +func (cs constOrVarSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) { + v := string(pkg) + "." + cs.sym + if cs.cast != "" { + v = cs.cast + "(" + v + ")" + } + g.P(cs.typ, " ", cs.sym, " = ", v) +} + +// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects. +type Object interface { + GoImportPath() GoImportPath + TypeName() []string + File() *FileDescriptor +} + +// Generator is the type whose methods generate the output, stored in the associated response structure. +type Generator struct { + *bytes.Buffer + + Request *plugin.CodeGeneratorRequest // The input. + Response *plugin.CodeGeneratorResponse // The output. + + Param map[string]string // Command-line parameters. + PackageImportPath string // Go import path of the package we're generating code for + ImportPrefix string // String to prefix to imported package file names. + ImportMap map[string]string // Mapping from .proto file name to import path + + Pkg map[string]string // The names under which we import support packages + + outputImportPath GoImportPath // Package we're generating code for. + allFiles []*FileDescriptor // All files in the tree + allFilesByName map[string]*FileDescriptor // All files by filename. + genFiles []*FileDescriptor // Those files we will generate output for. + file *FileDescriptor // The file we are compiling now. + packageNames map[GoImportPath]GoPackageName // Imported package names in the current file. + usedPackages map[GoImportPath]bool // Packages used in current file. + usedPackageNames map[GoPackageName]bool // Package names used in the current file. + addedImports map[GoImportPath]bool // Additional imports to emit. + typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. + init []string // Lines to emit in the init function. + indent string + pathType pathType // How to generate output filenames. + writeOutput bool +} + +type pathType int + +const ( + pathTypeImport pathType = iota + pathTypeSourceRelative +) + +// New creates a new generator and allocates the request and response protobufs. +func New() *Generator { + g := new(Generator) + g.Buffer = new(bytes.Buffer) + g.Request = new(plugin.CodeGeneratorRequest) + g.Response = new(plugin.CodeGeneratorResponse) + return g +} + +// Error reports a problem, including an error, and exits the program. +func (g *Generator) Error(err error, msgs ...string) { + s := strings.Join(msgs, " ") + ":" + err.Error() + log.Print("protoc-gen-micro: error:", s) + os.Exit(1) +} + +// Fail reports a problem and exits the program. +func (g *Generator) Fail(msgs ...string) { + s := strings.Join(msgs, " ") + log.Print("protoc-gen-micro: error:", s) + os.Exit(1) +} + +// CommandLineParameters breaks the comma-separated list of key=value pairs +// in the parameter (a member of the request protobuf) into a key/value map. +// It then sets file name mappings defined by those entries. +func (g *Generator) CommandLineParameters(parameter string) { + g.Param = make(map[string]string) + for _, p := range strings.Split(parameter, ",") { + if i := strings.Index(p, "="); i < 0 { + g.Param[p] = "" + } else { + g.Param[p[0:i]] = p[i+1:] + } + } + + g.ImportMap = make(map[string]string) + pluginList := "none" // Default list of plugin names to enable (empty means all). + for k, v := range g.Param { + switch k { + case "import_prefix": + g.ImportPrefix = v + case "import_path": + g.PackageImportPath = v + case "paths": + switch v { + case "import": + g.pathType = pathTypeImport + case "source_relative": + g.pathType = pathTypeSourceRelative + default: + g.Fail(fmt.Sprintf(`Unknown path type %q: want "import" or "source_relative".`, v)) + } + case "plugins": + pluginList = v + default: + if len(k) > 0 && k[0] == 'M' { + g.ImportMap[k[1:]] = v + } + } + } + if pluginList != "" { + // Amend the set of plugins. + enabled := map[string]bool{ + "micro": true, + } + for _, name := range strings.Split(pluginList, "+") { + enabled[name] = true + } + var nplugins []Plugin + for _, p := range plugins { + if enabled[p.Name()] { + nplugins = append(nplugins, p) + } + } + plugins = nplugins + } +} + +// DefaultPackageName returns the package name printed for the object. +// If its file is in a different package, it returns the package name we're using for this file, plus ".". +// Otherwise it returns the empty string. +func (g *Generator) DefaultPackageName(obj Object) string { + importPath := obj.GoImportPath() + if importPath == g.outputImportPath { + return "" + } + return string(g.GoPackageName(importPath)) + "." +} + +// GoPackageName returns the name used for a package. +func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName { + if name, ok := g.packageNames[importPath]; ok { + return name + } + name := cleanPackageName(baseName(string(importPath))) + for i, orig := 1, name; g.usedPackageNames[name] || isGoPredeclaredIdentifier[string(name)]; i++ { + name = orig + GoPackageName(strconv.Itoa(i)) + } + g.packageNames[importPath] = name + g.usedPackageNames[name] = true + return name +} + +// AddImport adds a package to the generated file's import section. +// It returns the name used for the package. +func (g *Generator) AddImport(importPath GoImportPath) GoPackageName { + g.addedImports[importPath] = true + return g.GoPackageName(importPath) +} + +var globalPackageNames = map[GoPackageName]bool{ + "fmt": true, + "math": true, + "proto": true, +} + +// Create and remember a guaranteed unique package name. Pkg is the candidate name. +// The FileDescriptor parameter is unused. +func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { + name := cleanPackageName(pkg) + for i, orig := 1, name; globalPackageNames[name]; i++ { + name = orig + GoPackageName(strconv.Itoa(i)) + } + globalPackageNames[name] = true + return string(name) +} + +var isGoKeyword = map[string]bool{ + "break": true, + "case": true, + "chan": true, + "const": true, + "continue": true, + "default": true, + "else": true, + "defer": true, + "fallthrough": true, + "for": true, + "func": true, + "go": true, + "goto": true, + "if": true, + "import": true, + "interface": true, + "map": true, + "package": true, + "range": true, + "return": true, + "select": true, + "struct": true, + "switch": true, + "type": true, + "var": true, +} + +var isGoPredeclaredIdentifier = map[string]bool{ + "append": true, + "bool": true, + "byte": true, + "cap": true, + "close": true, + "complex": true, + "complex128": true, + "complex64": true, + "copy": true, + "delete": true, + "error": true, + "false": true, + "float32": true, + "float64": true, + "imag": true, + "int": true, + "int16": true, + "int32": true, + "int64": true, + "int8": true, + "iota": true, + "len": true, + "make": true, + "new": true, + "nil": true, + "panic": true, + "print": true, + "println": true, + "real": true, + "recover": true, + "rune": true, + "string": true, + "true": true, + "uint": true, + "uint16": true, + "uint32": true, + "uint64": true, + "uint8": true, + "uintptr": true, +} + +func cleanPackageName(name string) GoPackageName { + name = strings.Map(badToUnderscore, name) + // Identifier must not be keyword or predeclared identifier: insert _. + if isGoKeyword[name] { + name = "_" + name + } + // Identifier must not begin with digit: insert _. + if r, _ := utf8.DecodeRuneInString(name); unicode.IsDigit(r) { + name = "_" + name + } + return GoPackageName(name) +} + +// defaultGoPackage returns the package name to use, +// derived from the import path of the package we're building code for. +func (g *Generator) defaultGoPackage() GoPackageName { + p := g.PackageImportPath + if i := strings.LastIndex(p, "/"); i >= 0 { + p = p[i+1:] + } + return cleanPackageName(p) +} + +// SetPackageNames sets the package name for this run. +// The package name must agree across all files being generated. +// It also defines unique package names for all imported files. +func (g *Generator) SetPackageNames() { + g.outputImportPath = g.genFiles[0].importPath + + defaultPackageNames := make(map[GoImportPath]GoPackageName) + for _, f := range g.genFiles { + if _, p, ok := f.goPackageOption(); ok { + defaultPackageNames[f.importPath] = p + } + } + for _, f := range g.genFiles { + if _, p, ok := f.goPackageOption(); ok { + // Source file: option go_package = "quux/bar"; + f.packageName = p + } else if p, ok := defaultPackageNames[f.importPath]; ok { + // A go_package option in another file in the same package. + // + // This is a poor choice in general, since every source file should + // contain a go_package option. Supported mainly for historical + // compatibility. + f.packageName = p + } else if p := g.defaultGoPackage(); p != "" { + // Command-line: import_path=quux/bar. + // + // The import_path flag sets a package name for files which don't + // contain a go_package option. + f.packageName = p + } else if p := f.GetPackage(); p != "" { + // Source file: package quux.bar; + f.packageName = cleanPackageName(p) + } else { + // Source filename. + f.packageName = cleanPackageName(baseName(f.GetName())) + } + } + + // Check that all files have a consistent package name and import path. + for _, f := range g.genFiles[1:] { + if a, b := g.genFiles[0].importPath, f.importPath; a != b { + g.Fail(fmt.Sprintf("inconsistent package import paths: %v, %v", a, b)) + } + if a, b := g.genFiles[0].packageName, f.packageName; a != b { + g.Fail(fmt.Sprintf("inconsistent package names: %v, %v", a, b)) + } + } + + // Names of support packages. These never vary (if there are conflicts, + // we rename the conflicting package), so this could be removed someday. + g.Pkg = map[string]string{ + "fmt": "fmt", + "math": "math", + "proto": "proto", + } +} + +// WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos +// and FileDescriptorProtos into file-referenced objects within the Generator. +// It also creates the list of files to generate and so should be called before GenerateAllFiles. +func (g *Generator) WrapTypes() { + g.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile)) + g.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles)) + genFileNames := make(map[string]bool) + for _, n := range g.Request.FileToGenerate { + genFileNames[n] = true + } + for _, f := range g.Request.ProtoFile { + fd := &FileDescriptor{ + FileDescriptorProto: f, + exported: make(map[Object][]symbol), + proto3: fileIsProto3(f), + } + // The import path may be set in a number of ways. + if substitution, ok := g.ImportMap[f.GetName()]; ok { + // Command-line: M=foo.proto=quux/bar. + // + // Explicit mapping of source file to import path. + fd.importPath = GoImportPath(substitution) + } else if genFileNames[f.GetName()] && g.PackageImportPath != "" { + // Command-line: import_path=quux/bar. + // + // The import_path flag sets the import path for every file that + // we generate code for. + fd.importPath = GoImportPath(g.PackageImportPath) + } else if p, _, _ := fd.goPackageOption(); p != "" { + // Source file: option go_package = "quux/bar"; + // + // The go_package option sets the import path. Most users should use this. + fd.importPath = p + } else { + // Source filename. + // + // Last resort when nothing else is available. + fd.importPath = GoImportPath(path.Dir(f.GetName())) + } + // We must wrap the descriptors before we wrap the enums + fd.desc = wrapDescriptors(fd) + g.buildNestedDescriptors(fd.desc) + fd.enum = wrapEnumDescriptors(fd, fd.desc) + g.buildNestedEnums(fd.desc, fd.enum) + fd.ext = wrapExtensions(fd) + extractComments(fd) + g.allFiles = append(g.allFiles, fd) + g.allFilesByName[f.GetName()] = fd + } + for _, fd := range g.allFiles { + fd.imp = wrapImported(fd, g) + } + + g.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate)) + for _, fileName := range g.Request.FileToGenerate { + fd := g.allFilesByName[fileName] + if fd == nil { + g.Fail("could not find file named", fileName) + } + g.genFiles = append(g.genFiles, fd) + } +} + +// Scan the descriptors in this file. For each one, build the slice of nested descriptors +func (g *Generator) buildNestedDescriptors(descs []*Descriptor) { + for _, desc := range descs { + if len(desc.NestedType) != 0 { + for _, nest := range descs { + if nest.parent == desc { + desc.nested = append(desc.nested, nest) + } + } + if len(desc.nested) != len(desc.NestedType) { + g.Fail("internal error: nesting failure for", desc.GetName()) + } + } + } +} + +func (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescriptor) { + for _, desc := range descs { + if len(desc.EnumType) != 0 { + for _, enum := range enums { + if enum.parent == desc { + desc.enums = append(desc.enums, enum) + } + } + if len(desc.enums) != len(desc.EnumType) { + g.Fail("internal error: enum nesting failure for", desc.GetName()) + } + } + } +} + +// Construct the Descriptor +func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *Descriptor { + d := &Descriptor{ + common: common{file}, + DescriptorProto: desc, + parent: parent, + index: index, + } + if parent == nil { + d.path = fmt.Sprintf("%d,%d", messagePath, index) + } else { + d.path = fmt.Sprintf("%s,%d,%d", parent.path, messageMessagePath, index) + } + + // The only way to distinguish a group from a message is whether + // the containing message has a TYPE_GROUP field that matches. + if parent != nil { + parts := d.TypeName() + if file.Package != nil { + parts = append([]string{*file.Package}, parts...) + } + exp := "." + strings.Join(parts, ".") + for _, field := range parent.Field { + if field.GetType() == descriptor.FieldDescriptorProto_TYPE_GROUP && field.GetTypeName() == exp { + d.group = true + break + } + } + } + + for _, field := range desc.Extension { + d.ext = append(d.ext, &ExtensionDescriptor{common{file}, field, d}) + } + + return d +} + +// Return a slice of all the Descriptors defined within this file +func wrapDescriptors(file *FileDescriptor) []*Descriptor { + sl := make([]*Descriptor, 0, len(file.MessageType)+10) + for i, desc := range file.MessageType { + sl = wrapThisDescriptor(sl, desc, nil, file, i) + } + return sl +} + +// Wrap this Descriptor, recursively +func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) []*Descriptor { + sl = append(sl, newDescriptor(desc, parent, file, index)) + me := sl[len(sl)-1] + for i, nested := range desc.NestedType { + sl = wrapThisDescriptor(sl, nested, me, file, i) + } + return sl +} + +// Construct the EnumDescriptor +func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *EnumDescriptor { + ed := &EnumDescriptor{ + common: common{file}, + EnumDescriptorProto: desc, + parent: parent, + index: index, + } + if parent == nil { + ed.path = fmt.Sprintf("%d,%d", enumPath, index) + } else { + ed.path = fmt.Sprintf("%s,%d,%d", parent.path, messageEnumPath, index) + } + return ed +} + +// Return a slice of all the EnumDescriptors defined within this file +func wrapEnumDescriptors(file *FileDescriptor, descs []*Descriptor) []*EnumDescriptor { + sl := make([]*EnumDescriptor, 0, len(file.EnumType)+10) + // Top-level enums. + for i, enum := range file.EnumType { + sl = append(sl, newEnumDescriptor(enum, nil, file, i)) + } + // Enums within messages. Enums within embedded messages appear in the outer-most message. + for _, nested := range descs { + for i, enum := range nested.EnumType { + sl = append(sl, newEnumDescriptor(enum, nested, file, i)) + } + } + return sl +} + +// Return a slice of all the top-level ExtensionDescriptors defined within this file. +func wrapExtensions(file *FileDescriptor) []*ExtensionDescriptor { + var sl []*ExtensionDescriptor + for _, field := range file.Extension { + sl = append(sl, &ExtensionDescriptor{common{file}, field, nil}) + } + return sl +} + +// Return a slice of all the types that are publicly imported into this file. +func wrapImported(file *FileDescriptor, g *Generator) (sl []*ImportedDescriptor) { + for _, index := range file.PublicDependency { + df := g.fileByName(file.Dependency[index]) + for _, d := range df.desc { + if d.GetOptions().GetMapEntry() { + continue + } + sl = append(sl, &ImportedDescriptor{common{file}, d}) + } + for _, e := range df.enum { + sl = append(sl, &ImportedDescriptor{common{file}, e}) + } + for _, ext := range df.ext { + sl = append(sl, &ImportedDescriptor{common{file}, ext}) + } + } + return +} + +func extractComments(file *FileDescriptor) { + file.comments = make(map[string]*descriptor.SourceCodeInfo_Location) + for _, loc := range file.GetSourceCodeInfo().GetLocation() { + if loc.LeadingComments == nil { + continue + } + var p []string + for _, n := range loc.Path { + p = append(p, strconv.Itoa(int(n))) + } + file.comments[strings.Join(p, ",")] = loc + } +} + +// BuildTypeNameMap builds the map from fully qualified type names to objects. +// The key names for the map come from the input data, which puts a period at the beginning. +// It should be called after SetPackageNames and before GenerateAllFiles. +func (g *Generator) BuildTypeNameMap() { + g.typeNameToObject = make(map[string]Object) + for _, f := range g.allFiles { + // The names in this loop are defined by the proto world, not us, so the + // package name may be empty. If so, the dotted package name of X will + // be ".X"; otherwise it will be ".pkg.X". + dottedPkg := "." + f.GetPackage() + if dottedPkg != "." { + dottedPkg += "." + } + for _, enum := range f.enum { + name := dottedPkg + dottedSlice(enum.TypeName()) + g.typeNameToObject[name] = enum + } + for _, desc := range f.desc { + name := dottedPkg + dottedSlice(desc.TypeName()) + g.typeNameToObject[name] = desc + } + } +} + +// ObjectNamed, given a fully-qualified input type name as it appears in the input data, +// returns the descriptor for the message or enum with that name. +func (g *Generator) ObjectNamed(typeName string) Object { + o, ok := g.typeNameToObject[typeName] + if !ok { + g.Fail("can't find object with type", typeName) + } + return o +} + +// AnnotatedAtoms is a list of atoms (as consumed by P) that records the file name and proto AST path from which they originated. +type AnnotatedAtoms struct { + source string + path string + atoms []interface{} +} + +// Annotate records the file name and proto AST path of a list of atoms +// so that a later call to P can emit a link from each atom to its origin. +func Annotate(file *FileDescriptor, path string, atoms ...interface{}) *AnnotatedAtoms { + return &AnnotatedAtoms{source: *file.Name, path: path, atoms: atoms} +} + +// printAtom prints the (atomic, non-annotation) argument to the generated output. +func (g *Generator) printAtom(v interface{}) { + switch v := v.(type) { + case string: + g.WriteString(v) + case *string: + g.WriteString(*v) + case bool: + fmt.Fprint(g, v) + case *bool: + fmt.Fprint(g, *v) + case int: + fmt.Fprint(g, v) + case *int32: + fmt.Fprint(g, *v) + case *int64: + fmt.Fprint(g, *v) + case float64: + fmt.Fprint(g, v) + case *float64: + fmt.Fprint(g, *v) + case GoPackageName: + g.WriteString(string(v)) + case GoImportPath: + g.WriteString(strconv.Quote(string(v))) + default: + g.Fail(fmt.Sprintf("unknown type in printer: %T", v)) + } +} + +// P prints the arguments to the generated output. It handles strings and int32s, plus +// handling indirections because they may be *string, etc. Any inputs of type AnnotatedAtoms may emit +// annotations in a .meta file in addition to outputting the atoms themselves (if g.annotateCode +// is true). +func (g *Generator) P(str ...interface{}) { + if !g.writeOutput { + return + } + g.WriteString(g.indent) + for _, v := range str { + switch v := v.(type) { + case *AnnotatedAtoms: + for _, v := range v.atoms { + g.printAtom(v) + } + default: + g.printAtom(v) + } + } + g.WriteByte('\n') +} + +// addInitf stores the given statement to be printed inside the file's init function. +// The statement is given as a format specifier and arguments. +func (g *Generator) addInitf(stmt string, a ...interface{}) { + g.init = append(g.init, fmt.Sprintf(stmt, a...)) +} + +// In Indents the output one tab stop. +func (g *Generator) In() { g.indent += "\t" } + +// Out unindents the output one tab stop. +func (g *Generator) Out() { + if len(g.indent) > 0 { + g.indent = g.indent[1:] + } +} + +// GenerateAllFiles generates the output for all the files we're outputting. +func (g *Generator) GenerateAllFiles() { + // Initialize the plugins + for _, p := range plugins { + p.Init(g) + } + // Generate the output. The generator runs for every file, even the files + // that we don't generate output for, so that we can collate the full list + // of exported symbols to support public imports. + genFileMap := make(map[*FileDescriptor]bool, len(g.genFiles)) + for _, file := range g.genFiles { + genFileMap[file] = true + } + for _, file := range g.allFiles { + g.Reset() + g.writeOutput = genFileMap[file] + g.generate(file) + if !g.writeOutput { + continue + } + fname := file.goFileName(g.pathType) + g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(fname), + Content: proto.String(g.String()), + }) + } +} + +// Run all the plugins associated with the file. +func (g *Generator) runPlugins(file *FileDescriptor) { + for _, p := range plugins { + p.Generate(file) + } +} + +// Fill the response protocol buffer with the generated output for all the files we're +// supposed to generate. +func (g *Generator) generate(file *FileDescriptor) { + g.file = file + g.usedPackages = make(map[GoImportPath]bool) + g.packageNames = make(map[GoImportPath]GoPackageName) + g.usedPackageNames = make(map[GoPackageName]bool) + g.addedImports = make(map[GoImportPath]bool) + for name := range globalPackageNames { + g.usedPackageNames[name] = true + } + + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the proto package it is being compiled against.") + g.P("// A compilation error at this line likely means your copy of the") + g.P("// proto package needs to be updated.") + g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") + g.P() + + for _, td := range g.file.imp { + g.generateImported(td) + } + + g.generateInitFunction() + + // Run the plugins before the imports so we know which imports are necessary. + g.runPlugins(file) + + // Generate header and imports last, though they appear first in the output. + rem := g.Buffer + g.Buffer = new(bytes.Buffer) + g.generateHeader() + g.generateImports() + if !g.writeOutput { + return + } + g.Write(rem.Bytes()) + + // Reformat generated code and patch annotation locations. + fset := token.NewFileSet() + original := g.Bytes() + fileAST, err := parser.ParseFile(fset, "", original, parser.ParseComments) + if err != nil { + // Print out the bad code with line numbers. + // This should never happen in practice, but it can while changing generated code, + // so consider this a debugging aid. + var src bytes.Buffer + s := bufio.NewScanner(bytes.NewReader(original)) + for line := 1; s.Scan(); line++ { + fmt.Fprintf(&src, "%5d\t%s\n", line, s.Bytes()) + } + g.Fail("bad Go source code was generated:", err.Error(), "\n"+src.String()) + } + ast.SortImports(fset, fileAST) + g.Reset() + err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, fileAST) + if err != nil { + g.Fail("generated Go source code could not be reformatted:", err.Error()) + } +} + +// Generate the header, including package definition +func (g *Generator) generateHeader() { + g.P("// Code generated by protoc-gen-micro. DO NOT EDIT.") + if g.file.GetOptions().GetDeprecated() { + g.P("// ", g.file.Name, " is a deprecated file.") + } else { + g.P("// source: ", g.file.Name) + } + g.P() + g.PrintComments(strconv.Itoa(packagePath)) + g.P() + g.P("package ", g.file.packageName) + g.P() +} + +// deprecationComment is the standard comment added to deprecated +// messages, fields, enums, and enum values. +var deprecationComment = "// Deprecated: Do not use." + +// PrintComments prints any comments from the source .proto file. +// The path is a comma-separated list of integers. +// It returns an indication of whether any comments were printed. +// See descriptor.proto for its format. +func (g *Generator) PrintComments(path string) bool { + if !g.writeOutput { + return false + } + if c, ok := g.makeComments(path); ok { + g.P(c) + return true + } + return false +} + +// makeComments generates the comment string for the field, no "\n" at the end +func (g *Generator) makeComments(path string) (string, bool) { + loc, ok := g.file.comments[path] + if !ok { + return "", false + } + w := new(bytes.Buffer) + nl := "" + for _, line := range strings.Split(strings.TrimSuffix(loc.GetLeadingComments(), "\n"), "\n") { + fmt.Fprintf(w, "%s//%s", nl, line) + nl = "\n" + } + return w.String(), true +} + +func (g *Generator) fileByName(filename string) *FileDescriptor { + return g.allFilesByName[filename] +} + +// weak returns whether the ith import of the current file is a weak import. +func (g *Generator) weak(i int32) bool { + for _, j := range g.file.WeakDependency { + if j == i { + return true + } + } + return false +} + +// Generate the imports +func (g *Generator) generateImports() { + imports := make(map[GoImportPath]GoPackageName) + for i, s := range g.file.Dependency { + fd := g.fileByName(s) + importPath := fd.importPath + // Do not import our own package. + if importPath == g.file.importPath { + continue + } + // Do not import weak imports. + if g.weak(int32(i)) { + continue + } + // Do not import a package twice. + if _, ok := imports[importPath]; ok { + continue + } + // We need to import all the dependencies, even if we don't reference them, + // because other code and tools depend on having the full transitive closure + // of protocol buffer types in the binary. + packageName := g.GoPackageName(importPath) + if _, ok := g.usedPackages[importPath]; !ok { + packageName = "_" + } + imports[importPath] = packageName + } + for importPath := range g.addedImports { + imports[importPath] = g.GoPackageName(importPath) + } + // We almost always need a proto import. Rather than computing when we + // do, which is tricky when there's a plugin, just import it and + // reference it later. The same argument applies to the fmt and math packages. + g.P("import (") + g.P(g.Pkg["fmt"] + ` "fmt"`) + g.P(g.Pkg["math"] + ` "math"`) + g.P(g.Pkg["proto"]+" ", GoImportPath(g.ImportPrefix)+"github.com/golang/protobuf/proto") + for importPath, packageName := range imports { + g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) + } + g.P(")") + g.P() + // TODO: may need to worry about uniqueness across plugins + for _, p := range plugins { + p.GenerateImports(g.file, imports) + g.P() + } + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ = ", g.Pkg["proto"], ".Marshal") + g.P("var _ = ", g.Pkg["fmt"], ".Errorf") + g.P("var _ = ", g.Pkg["math"], ".Inf") + g.P() +} + +func (g *Generator) generateImported(id *ImportedDescriptor) { + df := id.o.File() + filename := *df.Name + if df.importPath == g.file.importPath { + // Don't generate type aliases for files in the same Go package as this one. + return + } + if !supportTypeAliases { + g.Fail(fmt.Sprintf("%s: public imports require at least go1.9", filename)) + } + g.usedPackages[df.importPath] = true + + for _, sym := range df.exported[id.o] { + sym.GenerateAlias(g, filename, g.GoPackageName(df.importPath)) + } + + g.P() +} + +// Generate the enum definitions for this EnumDescriptor. +func (g *Generator) generateEnum(enum *EnumDescriptor) { + // The full type name + typeName := enum.TypeName() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + ccPrefix := enum.prefix() + + deprecatedEnum := "" + if enum.GetOptions().GetDeprecated() { + deprecatedEnum = deprecationComment + } + g.PrintComments(enum.path) + g.P("type ", Annotate(enum.file, enum.path, ccTypeName), " int32", deprecatedEnum) + g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()}) + g.P("const (") + for i, e := range enum.Value { + etorPath := fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i) + g.PrintComments(etorPath) + + deprecatedValue := "" + if e.GetOptions().GetDeprecated() { + deprecatedValue = deprecationComment + } + + name := ccPrefix + *e.Name + g.P(Annotate(enum.file, etorPath, name), " ", ccTypeName, " = ", e.Number, " ", deprecatedValue) + g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName}) + } + g.P(")") + g.P() + g.P("var ", ccTypeName, "_name = map[int32]string{") + generated := make(map[int32]bool) // avoid duplicate values + for _, e := range enum.Value { + duplicate := "" + if _, present := generated[*e.Number]; present { + duplicate = "// Duplicate value: " + } + g.P(duplicate, e.Number, ": ", strconv.Quote(*e.Name), ",") + generated[*e.Number] = true + } + g.P("}") + g.P() + g.P("var ", ccTypeName, "_value = map[string]int32{") + for _, e := range enum.Value { + g.P(strconv.Quote(*e.Name), ": ", e.Number, ",") + } + g.P("}") + g.P() + + if !enum.proto3() { + g.P("func (x ", ccTypeName, ") Enum() *", ccTypeName, " {") + g.P("p := new(", ccTypeName, ")") + g.P("*p = x") + g.P("return p") + g.P("}") + g.P() + } + + g.P("func (x ", ccTypeName, ") String() string {") + g.P("return ", g.Pkg["proto"], ".EnumName(", ccTypeName, "_name, int32(x))") + g.P("}") + g.P() + + if !enum.proto3() { + g.P("func (x *", ccTypeName, ") UnmarshalJSON(data []byte) error {") + g.P("value, err := ", g.Pkg["proto"], ".UnmarshalJSONEnum(", ccTypeName, `_value, data, "`, ccTypeName, `")`) + g.P("if err != nil {") + g.P("return err") + g.P("}") + g.P("*x = ", ccTypeName, "(value)") + g.P("return nil") + g.P("}") + g.P() + } + + var indexes []string + for m := enum.parent; m != nil; m = m.parent { + // XXX: skip groups? + indexes = append([]string{strconv.Itoa(m.index)}, indexes...) + } + indexes = append(indexes, strconv.Itoa(enum.index)) + g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) {") + g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}") + g.P("}") + g.P() + if enum.file.GetPackage() == "google.protobuf" && enum.GetName() == "NullValue" { + g.P("func (", ccTypeName, `) XXX_WellKnownType() string { return "`, enum.GetName(), `" }`) + g.P() + } + + g.generateEnumRegistration(enum) +} + +// The tag is a string like "varint,2,opt,name=fieldname,def=7" that +// identifies details of the field for the protocol buffer marshaling and unmarshaling +// code. The fields are: +// wire encoding +// protocol tag number +// opt,req,rep for optional, required, or repeated +// packed whether the encoding is "packed" (optional; repeated primitives only) +// name= the original declared name +// enum= the name of the enum type if it is an enum-typed field. +// proto3 if this field is in a proto3 message +// def= string representation of the default value, if any. +// The default value must be in a representation that can be used at run-time +// to generate the default value. Thus bools become 0 and 1, for instance. +func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string { + optrepreq := "" + switch { + case isOptional(field): + optrepreq = "opt" + case isRequired(field): + optrepreq = "req" + case isRepeated(field): + optrepreq = "rep" + } + var defaultValue string + if dv := field.DefaultValue; dv != nil { // set means an explicit default + defaultValue = *dv + // Some types need tweaking. + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BOOL: + if defaultValue == "true" { + defaultValue = "1" + } else { + defaultValue = "0" + } + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_BYTES: + // Nothing to do. Quoting is done for the whole tag. + case descriptor.FieldDescriptorProto_TYPE_ENUM: + // For enums we need to provide the integer constant. + obj := g.ObjectNamed(field.GetTypeName()) + if id, ok := obj.(*ImportedDescriptor); ok { + // It is an enum that was publicly imported. + // We need the underlying type. + obj = id.o + } + enum, ok := obj.(*EnumDescriptor) + if !ok { + log.Printf("obj is a %T", obj) + if id, ok := obj.(*ImportedDescriptor); ok { + log.Printf("id.o is a %T", id.o) + } + g.Fail("unknown enum type", CamelCaseSlice(obj.TypeName())) + } + defaultValue = enum.integerValueAsString(defaultValue) + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + if def := defaultValue; def != "inf" && def != "-inf" && def != "nan" { + if f, err := strconv.ParseFloat(defaultValue, 32); err == nil { + defaultValue = fmt.Sprint(float32(f)) + } + } + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if def := defaultValue; def != "inf" && def != "-inf" && def != "nan" { + if f, err := strconv.ParseFloat(defaultValue, 64); err == nil { + defaultValue = fmt.Sprint(f) + } + } + } + defaultValue = ",def=" + defaultValue + } + enum := "" + if *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM { + // We avoid using obj.GoPackageName(), because we want to use the + // original (proto-world) package name. + obj := g.ObjectNamed(field.GetTypeName()) + if id, ok := obj.(*ImportedDescriptor); ok { + obj = id.o + } + enum = ",enum=" + if pkg := obj.File().GetPackage(); pkg != "" { + enum += pkg + "." + } + enum += CamelCaseSlice(obj.TypeName()) + } + packed := "" + if (field.Options != nil && field.Options.GetPacked()) || + // Per https://developers.google.com/protocol-buffers/docs/proto3#simple: + // "In proto3, repeated fields of scalar numeric types use packed encoding by default." + (message.proto3() && (field.Options == nil || field.Options.Packed == nil) && + isRepeated(field) && isScalar(field)) { + packed = ",packed" + } + fieldName := field.GetName() + name := fieldName + if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { + // We must use the type name for groups instead of + // the field name to preserve capitalization. + // type_name in FieldDescriptorProto is fully-qualified, + // but we only want the local part. + name = *field.TypeName + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[i+1:] + } + } + if json := field.GetJsonName(); field.Extendee == nil && json != "" && json != name { + // TODO: escaping might be needed, in which case + // perhaps this should be in its own "json" tag. + name += ",json=" + json + } + name = ",name=" + name + if message.proto3() { + name += ",proto3" + } + oneof := "" + if field.OneofIndex != nil { + oneof = ",oneof" + } + return strconv.Quote(fmt.Sprintf("%s,%d,%s%s%s%s%s%s", + wiretype, + field.GetNumber(), + optrepreq, + packed, + name, + enum, + oneof, + defaultValue)) +} + +func needsStar(typ descriptor.FieldDescriptorProto_Type) bool { + switch typ { + case descriptor.FieldDescriptorProto_TYPE_GROUP: + return false + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + return false + case descriptor.FieldDescriptorProto_TYPE_BYTES: + return false + } + return true +} + +// TypeName is the printed name appropriate for an item. If the object is in the current file, +// TypeName drops the package name and underscores the rest. +// Otherwise the object is from another package; and the result is the underscored +// package name followed by the item name. +// The result always has an initial capital. +func (g *Generator) TypeName(obj Object) string { + return g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName()) +} + +// GoType returns a string representing the type name, and the wire type +func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) { + // TODO: Options. + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + typ, wire = "float64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + typ, wire = "float32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_INT64: + typ, wire = "int64", "varint" + case descriptor.FieldDescriptorProto_TYPE_UINT64: + typ, wire = "uint64", "varint" + case descriptor.FieldDescriptorProto_TYPE_INT32: + typ, wire = "int32", "varint" + case descriptor.FieldDescriptorProto_TYPE_UINT32: + typ, wire = "uint32", "varint" + case descriptor.FieldDescriptorProto_TYPE_FIXED64: + typ, wire = "uint64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_FIXED32: + typ, wire = "uint32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + typ, wire = "bool", "varint" + case descriptor.FieldDescriptorProto_TYPE_STRING: + typ, wire = "string", "bytes" + case descriptor.FieldDescriptorProto_TYPE_GROUP: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = "*"+g.TypeName(desc), "group" + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = "*"+g.TypeName(desc), "bytes" + case descriptor.FieldDescriptorProto_TYPE_BYTES: + typ, wire = "[]byte", "bytes" + case descriptor.FieldDescriptorProto_TYPE_ENUM: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = g.TypeName(desc), "varint" + case descriptor.FieldDescriptorProto_TYPE_SFIXED32: + typ, wire = "int32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_SFIXED64: + typ, wire = "int64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_SINT32: + typ, wire = "int32", "zigzag32" + case descriptor.FieldDescriptorProto_TYPE_SINT64: + typ, wire = "int64", "zigzag64" + default: + g.Fail("unknown type for", field.GetName()) + } + if isRepeated(field) { + typ = "[]" + typ + } else if message != nil && message.proto3() { + return + } else if field.OneofIndex != nil && message != nil { + return + } else if needsStar(*field.Type) { + typ = "*" + typ + } + return +} + +func (g *Generator) RecordTypeUse(t string) { + if _, ok := g.typeNameToObject[t]; !ok { + return + } + importPath := g.ObjectNamed(t).GoImportPath() + if importPath == g.outputImportPath { + // Don't record use of objects in our package. + return + } + g.AddImport(importPath) + g.usedPackages[importPath] = true +} + +// Method names that may be generated. Fields with these names get an +// underscore appended. Any change to this set is a potential incompatible +// API change because it changes generated field names. +var methodNames = [...]string{ + "Reset", + "String", + "ProtoMessage", + "Marshal", + "Unmarshal", + "ExtensionRangeArray", + "ExtensionMap", + "Descriptor", +} + +// Names of messages in the `google.protobuf` package for which +// we will generate XXX_WellKnownType methods. +var wellKnownTypes = map[string]bool{ + "Any": true, + "Duration": true, + "Empty": true, + "Struct": true, + "Timestamp": true, + + "Value": true, + "ListValue": true, + "DoubleValue": true, + "FloatValue": true, + "Int64Value": true, + "UInt64Value": true, + "Int32Value": true, + "UInt32Value": true, + "BoolValue": true, + "StringValue": true, + "BytesValue": true, +} + +// getterDefault finds the default value for the field to return from a getter, +// regardless of if it's a built in default or explicit from the source. Returns e.g. "nil", `""`, "Default_MessageType_FieldName" +func (g *Generator) getterDefault(field *descriptor.FieldDescriptorProto, goMessageType string) string { + if isRepeated(field) { + return "nil" + } + if def := field.GetDefaultValue(); def != "" { + defaultConstant := g.defaultConstantName(goMessageType, field.GetName()) + if *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES { + return defaultConstant + } + return "append([]byte(nil), " + defaultConstant + "...)" + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BOOL: + return "false" + case descriptor.FieldDescriptorProto_TYPE_STRING: + return `""` + case descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_BYTES: + return "nil" + case descriptor.FieldDescriptorProto_TYPE_ENUM: + obj := g.ObjectNamed(field.GetTypeName()) + var enum *EnumDescriptor + if id, ok := obj.(*ImportedDescriptor); ok { + // The enum type has been publicly imported. + enum, _ = id.o.(*EnumDescriptor) + } else { + enum, _ = obj.(*EnumDescriptor) + } + if enum == nil { + log.Printf("don't know how to generate getter for %s", field.GetName()) + return "nil" + } + if len(enum.Value) == 0 { + return "0 // empty enum" + } + first := enum.Value[0].GetName() + return g.DefaultPackageName(obj) + enum.prefix() + first + default: + return "0" + } +} + +// defaultConstantName builds the name of the default constant from the message +// type name and the untouched field name, e.g. "Default_MessageType_FieldName" +func (g *Generator) defaultConstantName(goMessageType, protoFieldName string) string { + return "Default_" + goMessageType + "_" + CamelCase(protoFieldName) +} + +// The different types of fields in a message and how to actually print them +// Most of the logic for generateMessage is in the methods of these types. +// +// Note that the content of the field is irrelevant, a simpleField can contain +// anything from a scalar to a group (which is just a message). +// +// Extension fields (and message sets) are however handled separately. +// +// simpleField - a field that is neiter weak nor oneof, possibly repeated +// oneofField - field containing list of subfields: +// - oneofSubField - a field within the oneof + +// msgCtx contains the context for the generator functions. +type msgCtx struct { + goName string // Go struct name of the message, e.g. MessageName + message *Descriptor // The descriptor for the message +} + +// fieldCommon contains data common to all types of fields. +type fieldCommon struct { + goName string // Go name of field, e.g. "FieldName" or "Descriptor_" + protoName string // Name of field in proto language, e.g. "field_name" or "descriptor" + getterName string // Name of the getter, e.g. "GetFieldName" or "GetDescriptor_" + goType string // The Go type as a string, e.g. "*int32" or "*OtherMessage" + tags string // The tag string/annotation for the type, e.g. `protobuf:"varint,8,opt,name=region_id,json=regionId"` + fullPath string // The full path of the field as used by Annotate etc, e.g. "4,0,2,0" +} + +// getProtoName gets the proto name of a field, e.g. "field_name" or "descriptor". +func (f *fieldCommon) getProtoName() string { + return f.protoName +} + +// getGoType returns the go type of the field as a string, e.g. "*int32". +func (f *fieldCommon) getGoType() string { + return f.goType +} + +// simpleField is not weak, not a oneof, not an extension. Can be required, optional or repeated. +type simpleField struct { + fieldCommon + protoTypeName string // Proto type name, empty if primitive, e.g. ".google.protobuf.Duration" + protoType descriptor.FieldDescriptorProto_Type // Actual type enum value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64 + deprecated string // Deprecation comment, if any, e.g. "// Deprecated: Do not use." + getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName" + protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5" + comment string // The full comment for the field, e.g. "// Useful information" +} + +// decl prints the declaration of the field in the struct (if any). +func (f *simpleField) decl(g *Generator, mc *msgCtx) { + g.P(f.comment, Annotate(mc.message.file, f.fullPath, f.goName), "\t", f.goType, "\t`", f.tags, "`", f.deprecated) +} + +// getter prints the getter for the field. +func (f *simpleField) getter(g *Generator, mc *msgCtx) { + star := "" + tname := f.goType + if needsStar(f.protoType) && tname[0] == '*' { + tname = tname[1:] + star = "*" + } + if f.deprecated != "" { + g.P(f.deprecated) + } + g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, f.fullPath, f.getterName), "() "+tname+" {") + if f.getterDef == "nil" { // Simpler getter + g.P("if m != nil {") + g.P("return m." + f.goName) + g.P("}") + g.P("return nil") + g.P("}") + g.P() + return + } + if mc.message.proto3() { + g.P("if m != nil {") + } else { + g.P("if m != nil && m." + f.goName + " != nil {") + } + g.P("return " + star + "m." + f.goName) + g.P("}") + g.P("return ", f.getterDef) + g.P("}") + g.P() +} + +// setter prints the setter method of the field. +func (f *simpleField) setter(g *Generator, mc *msgCtx) { + // No setter for regular fields yet +} + +// getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5". +func (f *simpleField) getProtoDef() string { + return f.protoDef +} + +// getProtoTypeName returns the protobuf type name for the field as returned by field.GetTypeName(), e.g. ".google.protobuf.Duration". +func (f *simpleField) getProtoTypeName() string { + return f.protoTypeName +} + +// getProtoType returns the *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64. +func (f *simpleField) getProtoType() descriptor.FieldDescriptorProto_Type { + return f.protoType +} + +// oneofSubFields are kept slize held by each oneofField. They do not appear in the top level slize of fields for the message. +type oneofSubField struct { + fieldCommon + protoTypeName string // Proto type name, empty if primitive, e.g. ".google.protobuf.Duration" + protoType descriptor.FieldDescriptorProto_Type // Actual type enum value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64 + oneofTypeName string // Type name of the enclosing struct, e.g. "MessageName_FieldName" + fieldNumber int // Actual field number, as defined in proto, e.g. 12 + getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName" + protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5" + deprecated string // Deprecation comment, if any. +} + +// typedNil prints a nil casted to the pointer to this field. +// - for XXX_OneofWrappers +func (f *oneofSubField) typedNil(g *Generator) { + g.P("(*", f.oneofTypeName, ")(nil),") +} + +// getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5". +func (f *oneofSubField) getProtoDef() string { + return f.protoDef +} + +// getProtoTypeName returns the protobuf type name for the field as returned by field.GetTypeName(), e.g. ".google.protobuf.Duration". +func (f *oneofSubField) getProtoTypeName() string { + return f.protoTypeName +} + +// getProtoType returns the *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64. +func (f *oneofSubField) getProtoType() descriptor.FieldDescriptorProto_Type { + return f.protoType +} + +// oneofField represents the oneof on top level. +// The alternative fields within the oneof are represented by oneofSubField. +type oneofField struct { + fieldCommon + subFields []*oneofSubField // All the possible oneof fields + comment string // The full comment for the field, e.g. "// Types that are valid to be assigned to MyOneof:\n\\" +} + +// decl prints the declaration of the field in the struct (if any). +func (f *oneofField) decl(g *Generator, mc *msgCtx) { + comment := f.comment + for _, sf := range f.subFields { + comment += "//\t*" + sf.oneofTypeName + "\n" + } + g.P(comment, Annotate(mc.message.file, f.fullPath, f.goName), " ", f.goType, " `", f.tags, "`") +} + +// getter for a oneof field will print additional discriminators and interfaces for the oneof, +// also it prints all the getters for the sub fields. +func (f *oneofField) getter(g *Generator, mc *msgCtx) { + // The discriminator type + g.P("type ", f.goType, " interface {") + g.P(f.goType, "()") + g.P("}") + g.P() + // The subField types, fulfilling the discriminator type contract + for _, sf := range f.subFields { + g.P("type ", Annotate(mc.message.file, sf.fullPath, sf.oneofTypeName), " struct {") + g.P(Annotate(mc.message.file, sf.fullPath, sf.goName), " ", sf.goType, " `", sf.tags, "`") + g.P("}") + g.P() + } + for _, sf := range f.subFields { + g.P("func (*", sf.oneofTypeName, ") ", f.goType, "() {}") + g.P() + } + // Getter for the oneof field + g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, f.fullPath, f.getterName), "() ", f.goType, " {") + g.P("if m != nil { return m.", f.goName, " }") + g.P("return nil") + g.P("}") + g.P() + // Getters for each oneof + for _, sf := range f.subFields { + if sf.deprecated != "" { + g.P(sf.deprecated) + } + g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, sf.fullPath, sf.getterName), "() "+sf.goType+" {") + g.P("if x, ok := m.", f.getterName, "().(*", sf.oneofTypeName, "); ok {") + g.P("return x.", sf.goName) + g.P("}") + g.P("return ", sf.getterDef) + g.P("}") + g.P() + } +} + +// setter prints the setter method of the field. +func (f *oneofField) setter(g *Generator, mc *msgCtx) { + // No setters for oneof yet +} + +// topLevelField interface implemented by all types of fields on the top level (not oneofSubField). +type topLevelField interface { + decl(g *Generator, mc *msgCtx) // print declaration within the struct + getter(g *Generator, mc *msgCtx) // print getter + setter(g *Generator, mc *msgCtx) // print setter if applicable +} + +// defField interface implemented by all types of fields that can have defaults (not oneofField, but instead oneofSubField). +type defField interface { + getProtoDef() string // default value explicitly stated in the proto file, e.g "yoshi" or "5" + getProtoName() string // proto name of a field, e.g. "field_name" or "descriptor" + getGoType() string // go type of the field as a string, e.g. "*int32" + getProtoTypeName() string // protobuf type name for the field, e.g. ".google.protobuf.Duration" + getProtoType() descriptor.FieldDescriptorProto_Type // *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64 +} + +// generateDefaultConstants adds constants for default values if needed, which is only if the default value is. +// explicit in the proto. +func (g *Generator) generateDefaultConstants(mc *msgCtx, topLevelFields []topLevelField) { + // Collect fields that can have defaults + dFields := []defField{} + for _, pf := range topLevelFields { + if f, ok := pf.(*oneofField); ok { + for _, osf := range f.subFields { + dFields = append(dFields, osf) + } + continue + } + dFields = append(dFields, pf.(defField)) + } + for _, df := range dFields { + def := df.getProtoDef() + if def == "" { + continue + } + fieldname := g.defaultConstantName(mc.goName, df.getProtoName()) + typename := df.getGoType() + if typename[0] == '*' { + typename = typename[1:] + } + kind := "const " + switch { + case typename == "bool": + case typename == "string": + def = strconv.Quote(def) + case typename == "[]byte": + def = "[]byte(" + strconv.Quote(unescape(def)) + ")" + kind = "var " + case def == "inf", def == "-inf", def == "nan": + // These names are known to, and defined by, the protocol language. + switch def { + case "inf": + def = "math.Inf(1)" + case "-inf": + def = "math.Inf(-1)" + case "nan": + def = "math.NaN()" + } + if df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT { + def = "float32(" + def + ")" + } + kind = "var " + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT: + if f, err := strconv.ParseFloat(def, 32); err == nil { + def = fmt.Sprint(float32(f)) + } + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if f, err := strconv.ParseFloat(def, 64); err == nil { + def = fmt.Sprint(f) + } + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_ENUM: + // Must be an enum. Need to construct the prefixed name. + obj := g.ObjectNamed(df.getProtoTypeName()) + var enum *EnumDescriptor + if id, ok := obj.(*ImportedDescriptor); ok { + // The enum type has been publicly imported. + enum, _ = id.o.(*EnumDescriptor) + } else { + enum, _ = obj.(*EnumDescriptor) + } + if enum == nil { + log.Printf("don't know how to generate constant for %s", fieldname) + continue + } + def = g.DefaultPackageName(obj) + enum.prefix() + def + } + g.P(kind, fieldname, " ", typename, " = ", def) + g.file.addExport(mc.message, constOrVarSymbol{fieldname, kind, ""}) + } + g.P() +} + +// generateInternalStructFields just adds the XXX_ fields to the message struct. +func (g *Generator) generateInternalStructFields(mc *msgCtx, topLevelFields []topLevelField) { + g.P("XXX_NoUnkeyedLiteral\tstruct{} `json:\"-\"`") // prevent unkeyed struct literals + if len(mc.message.ExtensionRange) > 0 { + messageset := "" + if opts := mc.message.Options; opts != nil && opts.GetMessageSetWireFormat() { + messageset = "protobuf_messageset:\"1\" " + } + g.P(g.Pkg["proto"], ".XXX_InternalExtensions `", messageset, "json:\"-\"`") + } + g.P("XXX_unrecognized\t[]byte `json:\"-\"`") + g.P("XXX_sizecache\tint32 `json:\"-\"`") + +} + +// generateOneofFuncs adds all the utility functions for oneof, including marshalling, unmarshalling and sizer. +func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelField) { + ofields := []*oneofField{} + for _, f := range topLevelFields { + if o, ok := f.(*oneofField); ok { + ofields = append(ofields, o) + } + } + if len(ofields) == 0 { + return + } + + // OneofFuncs + g.P("// XXX_OneofWrappers is for the internal use of the proto package.") + g.P("func (*", mc.goName, ") XXX_OneofWrappers() []interface{} {") + g.P("return []interface{}{") + for _, of := range ofields { + for _, sf := range of.subFields { + sf.typedNil(g) + } + } + g.P("}") + g.P("}") + g.P() +} + +// generateMessageStruct adds the actual struct with it's members (but not methods) to the output. +func (g *Generator) generateMessageStruct(mc *msgCtx, topLevelFields []topLevelField) { + comments := g.PrintComments(mc.message.path) + + // Guarantee deprecation comments appear after user-provided comments. + if mc.message.GetOptions().GetDeprecated() { + if comments { + // Convention: Separate deprecation comments from original + // comments with an empty line. + g.P("//") + } + g.P(deprecationComment) + } + + g.P("type ", Annotate(mc.message.file, mc.message.path, mc.goName), " struct {") + for _, pf := range topLevelFields { + pf.decl(g, mc) + } + g.generateInternalStructFields(mc, topLevelFields) + g.P("}") +} + +// generateGetters adds getters for all fields, including oneofs and weak fields when applicable. +func (g *Generator) generateGetters(mc *msgCtx, topLevelFields []topLevelField) { + for _, pf := range topLevelFields { + pf.getter(g, mc) + } +} + +// generateSetters add setters for all fields, including oneofs and weak fields when applicable. +func (g *Generator) generateSetters(mc *msgCtx, topLevelFields []topLevelField) { + for _, pf := range topLevelFields { + pf.setter(g, mc) + } +} + +// generateCommonMethods adds methods to the message that are not on a per field basis. +func (g *Generator) generateCommonMethods(mc *msgCtx) { + // Reset, String and ProtoMessage methods. + g.P("func (m *", mc.goName, ") Reset() { *m = ", mc.goName, "{} }") + g.P("func (m *", mc.goName, ") String() string { return ", g.Pkg["proto"], ".CompactTextString(m) }") + g.P("func (*", mc.goName, ") ProtoMessage() {}") + var indexes []string + for m := mc.message; m != nil; m = m.parent { + indexes = append([]string{strconv.Itoa(m.index)}, indexes...) + } + g.P("func (*", mc.goName, ") Descriptor() ([]byte, []int) {") + g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}") + g.P("}") + g.P() + // TODO: Revisit the decision to use a XXX_WellKnownType method + // if we change proto.MessageName to work with multiple equivalents. + if mc.message.file.GetPackage() == "google.protobuf" && wellKnownTypes[mc.message.GetName()] { + g.P("func (*", mc.goName, `) XXX_WellKnownType() string { return "`, mc.message.GetName(), `" }`) + g.P() + } + + // Extension support methods + if len(mc.message.ExtensionRange) > 0 { + g.P() + g.P("var extRange_", mc.goName, " = []", g.Pkg["proto"], ".ExtensionRange{") + for _, r := range mc.message.ExtensionRange { + end := fmt.Sprint(*r.End - 1) // make range inclusive on both ends + g.P("{Start: ", r.Start, ", End: ", end, "},") + } + g.P("}") + g.P("func (*", mc.goName, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange {") + g.P("return extRange_", mc.goName) + g.P("}") + g.P() + } + + // TODO: It does not scale to keep adding another method for every + // operation on protos that we want to switch over to using the + // table-driven approach. Instead, we should only add a single method + // that allows getting access to the *InternalMessageInfo struct and then + // calling Unmarshal, Marshal, Merge, Size, and Discard directly on that. + + // Wrapper for table-driven marshaling and unmarshaling. + g.P("func (m *", mc.goName, ") XXX_Unmarshal(b []byte) error {") + g.P("return xxx_messageInfo_", mc.goName, ".Unmarshal(m, b)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {") + g.P("return xxx_messageInfo_", mc.goName, ".Marshal(b, m, deterministic)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_Merge(src ", g.Pkg["proto"], ".Message) {") + g.P("xxx_messageInfo_", mc.goName, ".Merge(m, src)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_Size() int {") // avoid name clash with "Size" field in some message + g.P("return xxx_messageInfo_", mc.goName, ".Size(m)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_DiscardUnknown() {") + g.P("xxx_messageInfo_", mc.goName, ".DiscardUnknown(m)") + g.P("}") + + g.P("var xxx_messageInfo_", mc.goName, " ", g.Pkg["proto"], ".InternalMessageInfo") + g.P() +} + +// Generate the type, methods and default constant definitions for this Descriptor. +func (g *Generator) generateMessage(message *Descriptor) { + topLevelFields := []topLevelField{} + oFields := make(map[int32]*oneofField) + // The full type name + typeName := message.TypeName() + // The full type name, CamelCased. + goTypeName := CamelCaseSlice(typeName) + + usedNames := make(map[string]bool) + for _, n := range methodNames { + usedNames[n] = true + } + + // allocNames finds a conflict-free variation of the given strings, + // consistently mutating their suffixes. + // It returns the same number of strings. + allocNames := func(ns ...string) []string { + Loop: + for { + for _, n := range ns { + if usedNames[n] { + for i := range ns { + ns[i] += "_" + } + continue Loop + } + } + for _, n := range ns { + usedNames[n] = true + } + return ns + } + } + + mapFieldTypes := make(map[*descriptor.FieldDescriptorProto]string) // keep track of the map fields to be added later + + // Build a structure more suitable for generating the text in one pass + for i, field := range message.Field { + // Allocate the getter and the field at the same time so name + // collisions create field/method consistent names. + // TODO: This allocation occurs based on the order of the fields + // in the proto file, meaning that a change in the field + // ordering can change generated Method/Field names. + base := CamelCase(*field.Name) + ns := allocNames(base, "Get"+base) + fieldName, fieldGetterName := ns[0], ns[1] + typename, wiretype := g.GoType(message, field) + jsonName := *field.Name + tag := fmt.Sprintf("protobuf:%s json:%q", g.goTag(message, field, wiretype), jsonName+",omitempty") + + oneof := field.OneofIndex != nil + if oneof && oFields[*field.OneofIndex] == nil { + odp := message.OneofDecl[int(*field.OneofIndex)] + base := CamelCase(odp.GetName()) + fname := allocNames(base)[0] + + // This is the first field of a oneof we haven't seen before. + // Generate the union field. + oneofFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex) + c, ok := g.makeComments(oneofFullPath) + if ok { + c += "\n//\n" + } + c += "// Types that are valid to be assigned to " + fname + ":\n" + // Generate the rest of this comment later, + // when we've computed any disambiguation. + + dname := "is" + goTypeName + "_" + fname + tag := `protobuf_oneof:"` + odp.GetName() + `"` + of := oneofField{ + fieldCommon: fieldCommon{ + goName: fname, + getterName: "Get" + fname, + goType: dname, + tags: tag, + protoName: odp.GetName(), + fullPath: oneofFullPath, + }, + comment: c, + } + topLevelFields = append(topLevelFields, &of) + oFields[*field.OneofIndex] = &of + } + + if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE { + desc := g.ObjectNamed(field.GetTypeName()) + if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() { + // Figure out the Go types and tags for the key and value types. + keyField, valField := d.Field[0], d.Field[1] + keyType, keyWire := g.GoType(d, keyField) + valType, valWire := g.GoType(d, valField) + keyTag, valTag := g.goTag(d, keyField, keyWire), g.goTag(d, valField, valWire) + + // We don't use stars, except for message-typed values. + // Message and enum types are the only two possibly foreign types used in maps, + // so record their use. They are not permitted as map keys. + keyType = strings.TrimPrefix(keyType, "*") + switch *valField.Type { + case descriptor.FieldDescriptorProto_TYPE_ENUM: + valType = strings.TrimPrefix(valType, "*") + g.RecordTypeUse(valField.GetTypeName()) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + g.RecordTypeUse(valField.GetTypeName()) + default: + valType = strings.TrimPrefix(valType, "*") + } + + typename = fmt.Sprintf("map[%s]%s", keyType, valType) + mapFieldTypes[field] = typename // record for the getter generation + + tag += fmt.Sprintf(" protobuf_key:%s protobuf_val:%s", keyTag, valTag) + } + } + + fieldDeprecated := "" + if field.GetOptions().GetDeprecated() { + fieldDeprecated = deprecationComment + } + + dvalue := g.getterDefault(field, goTypeName) + if oneof { + tname := goTypeName + "_" + fieldName + // It is possible for this to collide with a message or enum + // nested in this message. Check for collisions. + for { + ok := true + for _, desc := range message.nested { + if CamelCaseSlice(desc.TypeName()) == tname { + ok = false + break + } + } + for _, enum := range message.enums { + if CamelCaseSlice(enum.TypeName()) == tname { + ok = false + break + } + } + if !ok { + tname += "_" + continue + } + break + } + + oneofField := oFields[*field.OneofIndex] + tag := "protobuf:" + g.goTag(message, field, wiretype) + sf := oneofSubField{ + fieldCommon: fieldCommon{ + goName: fieldName, + getterName: fieldGetterName, + goType: typename, + tags: tag, + protoName: field.GetName(), + fullPath: fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i), + }, + protoTypeName: field.GetTypeName(), + fieldNumber: int(*field.Number), + protoType: *field.Type, + getterDef: dvalue, + protoDef: field.GetDefaultValue(), + oneofTypeName: tname, + deprecated: fieldDeprecated, + } + oneofField.subFields = append(oneofField.subFields, &sf) + g.RecordTypeUse(field.GetTypeName()) + continue + } + + fieldFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i) + c, ok := g.makeComments(fieldFullPath) + if ok { + c += "\n" + } + rf := simpleField{ + fieldCommon: fieldCommon{ + goName: fieldName, + getterName: fieldGetterName, + goType: typename, + tags: tag, + protoName: field.GetName(), + fullPath: fieldFullPath, + }, + protoTypeName: field.GetTypeName(), + protoType: *field.Type, + deprecated: fieldDeprecated, + getterDef: dvalue, + protoDef: field.GetDefaultValue(), + comment: c, + } + var pf topLevelField = &rf + + topLevelFields = append(topLevelFields, pf) + g.RecordTypeUse(field.GetTypeName()) + } + + mc := &msgCtx{ + goName: goTypeName, + message: message, + } + + g.generateMessageStruct(mc, topLevelFields) + g.P() + g.generateCommonMethods(mc) + g.P() + g.generateDefaultConstants(mc, topLevelFields) + g.P() + g.generateGetters(mc, topLevelFields) + g.P() + g.generateSetters(mc, topLevelFields) + g.P() + g.generateOneofFuncs(mc, topLevelFields) + g.P() + + var oneofTypes []string + for _, f := range topLevelFields { + if of, ok := f.(*oneofField); ok { + for _, osf := range of.subFields { + oneofTypes = append(oneofTypes, osf.oneofTypeName) + } + } + } + + opts := message.Options + ms := &messageSymbol{ + sym: goTypeName, + hasExtensions: len(message.ExtensionRange) > 0, + isMessageSet: opts != nil && opts.GetMessageSetWireFormat(), + oneofTypes: oneofTypes, + } + g.file.addExport(message, ms) + + for _, ext := range message.ext { + g.generateExtension(ext) + } + + fullName := strings.Join(message.TypeName(), ".") + if g.file.Package != nil { + fullName = *g.file.Package + "." + fullName + } + + g.addInitf("%s.RegisterType((*%s)(nil), %q)", g.Pkg["proto"], goTypeName, fullName) + // Register types for native map types. + for _, k := range mapFieldKeys(mapFieldTypes) { + fullName := strings.TrimPrefix(*k.TypeName, ".") + g.addInitf("%s.RegisterMapType((%s)(nil), %q)", g.Pkg["proto"], mapFieldTypes[k], fullName) + } + +} + +type byTypeName []*descriptor.FieldDescriptorProto + +func (a byTypeName) Len() int { return len(a) } +func (a byTypeName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTypeName) Less(i, j int) bool { return *a[i].TypeName < *a[j].TypeName } + +// mapFieldKeys returns the keys of m in a consistent order. +func mapFieldKeys(m map[*descriptor.FieldDescriptorProto]string) []*descriptor.FieldDescriptorProto { + keys := make([]*descriptor.FieldDescriptorProto, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Sort(byTypeName(keys)) + return keys +} + +var escapeChars = [256]byte{ + 'a': '\a', 'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t', 'v': '\v', '\\': '\\', '"': '"', '\'': '\'', '?': '?', +} + +// unescape reverses the "C" escaping that protoc does for default values of bytes fields. +// It is best effort in that it effectively ignores malformed input. Seemingly invalid escape +// sequences are conveyed, unmodified, into the decoded result. +func unescape(s string) string { + // NB: Sadly, we can't use strconv.Unquote because protoc will escape both + // single and double quotes, but strconv.Unquote only allows one or the + // other (based on actual surrounding quotes of its input argument). + + var out []byte + for len(s) > 0 { + // regular character, or too short to be valid escape + if s[0] != '\\' || len(s) < 2 { + out = append(out, s[0]) + s = s[1:] + } else if c := escapeChars[s[1]]; c != 0 { + // escape sequence + out = append(out, c) + s = s[2:] + } else if s[1] == 'x' || s[1] == 'X' { + // hex escape, e.g. "\x80 + if len(s) < 4 { + // too short to be valid + out = append(out, s[:2]...) + s = s[2:] + continue + } + v, err := strconv.ParseUint(s[2:4], 16, 8) + if err != nil { + out = append(out, s[:4]...) + } else { + out = append(out, byte(v)) + } + s = s[4:] + } else if '0' <= s[1] && s[1] <= '7' { + // octal escape, can vary from 1 to 3 octal digits; e.g., "\0" "\40" or "\164" + // so consume up to 2 more bytes or up to end-of-string + n := len(s[1:]) - len(strings.TrimLeft(s[1:], "01234567")) + if n > 3 { + n = 3 + } + v, err := strconv.ParseUint(s[1:1+n], 8, 8) + if err != nil { + out = append(out, s[:1+n]...) + } else { + out = append(out, byte(v)) + } + s = s[1+n:] + } else { + // bad escape, just propagate the slash as-is + out = append(out, s[0]) + s = s[1:] + } + } + + return string(out) +} + +func (g *Generator) generateExtension(ext *ExtensionDescriptor) { + ccTypeName := ext.DescName() + + extObj := g.ObjectNamed(*ext.Extendee) + var extDesc *Descriptor + if id, ok := extObj.(*ImportedDescriptor); ok { + // This is extending a publicly imported message. + // We need the underlying type for goTag. + extDesc = id.o.(*Descriptor) + } else { + extDesc = extObj.(*Descriptor) + } + extendedType := "*" + g.TypeName(extObj) // always use the original + field := ext.FieldDescriptorProto + fieldType, wireType := g.GoType(ext.parent, field) + tag := g.goTag(extDesc, field, wireType) + g.RecordTypeUse(*ext.Extendee) + if n := ext.FieldDescriptorProto.TypeName; n != nil { + // foreign extension type + g.RecordTypeUse(*n) + } + + typeName := ext.TypeName() + + // Special case for proto2 message sets: If this extension is extending + // proto2.bridge.MessageSet, and its final name component is "message_set_extension", + // then drop that last component. + // + // TODO: This should be implemented in the text formatter rather than the generator. + // In addition, the situation for when to apply this special case is implemented + // differently in other languages: + // https://github.com/google/protobuf/blob/aff10976/src/google/protobuf/text_format.cc#L1560 + if extDesc.GetOptions().GetMessageSetWireFormat() && typeName[len(typeName)-1] == "message_set_extension" { + typeName = typeName[:len(typeName)-1] + } + + // For text formatting, the package must be exactly what the .proto file declares, + // ignoring overrides such as the go_package option, and with no dot/underscore mapping. + extName := strings.Join(typeName, ".") + if g.file.Package != nil { + extName = *g.file.Package + "." + extName + } + + g.P("var ", ccTypeName, " = &", g.Pkg["proto"], ".ExtensionDesc{") + g.P("ExtendedType: (", extendedType, ")(nil),") + g.P("ExtensionType: (", fieldType, ")(nil),") + g.P("Field: ", field.Number, ",") + g.P(`Name: "`, extName, `",`) + g.P("Tag: ", tag, ",") + g.P(`Filename: "`, g.file.GetName(), `",`) + + g.P("}") + g.P() + + g.addInitf("%s.RegisterExtension(%s)", g.Pkg["proto"], ext.DescName()) + + g.file.addExport(ext, constOrVarSymbol{ccTypeName, "var", ""}) +} + +func (g *Generator) generateInitFunction() { + if len(g.init) == 0 { + return + } + g.P("func init() {") + for _, l := range g.init { + g.P(l) + } + g.P("}") + g.init = nil +} + +func (g *Generator) generateFileDescriptor(file *FileDescriptor) { + // Make a copy and trim source_code_info data. + // TODO: Trim this more when we know exactly what we need. + pb := proto.Clone(file.FileDescriptorProto).(*descriptor.FileDescriptorProto) + pb.SourceCodeInfo = nil + + b, err := proto.Marshal(pb) + if err != nil { + g.Fail(err.Error()) + } + + var buf bytes.Buffer + w, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression) + w.Write(b) + w.Close() + b = buf.Bytes() + + v := file.VarName() + g.P() + g.P("func init() { ", g.Pkg["proto"], ".RegisterFile(", strconv.Quote(*file.Name), ", ", v, ") }") + g.P("var ", v, " = []byte{") + g.P("// ", len(b), " bytes of a gzipped FileDescriptorProto") + for len(b) > 0 { + n := 16 + if n > len(b) { + n = len(b) + } + + s := "" + for _, c := range b[:n] { + s += fmt.Sprintf("0x%02x,", c) + } + g.P(s) + + b = b[n:] + } + g.P("}") +} + +func (g *Generator) generateEnumRegistration(enum *EnumDescriptor) { + // // We always print the full (proto-world) package name here. + pkg := enum.File().GetPackage() + if pkg != "" { + pkg += "." + } + // The full type name + typeName := enum.TypeName() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + g.addInitf("%s.RegisterEnum(%q, %[3]s_name, %[3]s_value)", g.Pkg["proto"], pkg+ccTypeName, ccTypeName) +} + +// And now lots of helper functions. + +// Is c an ASCII lower-case letter? +func isASCIILower(c byte) bool { + return 'a' <= c && c <= 'z' +} + +// Is c an ASCII digit? +func isASCIIDigit(c byte) bool { + return '0' <= c && c <= '9' +} + +// CamelCase returns the CamelCased name. +// If there is an interior underscore followed by a lower case letter, +// drop the underscore and convert the letter to upper case. +// There is a remote possibility of this rewrite causing a name collision, +// but it's so remote we're prepared to pretend it's nonexistent - since the +// C++ generator lowercases names, it's extremely unlikely to have two fields +// with different capitalizations. +// In short, _my_field_name_2 becomes XMyFieldName_2. +func CamelCase(s string) string { + if s == "" { + return "" + } + t := make([]byte, 0, 32) + i := 0 + if s[0] == '_' { + // Need a capital letter; drop the '_'. + t = append(t, 'X') + i++ + } + // Invariant: if the next letter is lower case, it must be converted + // to upper case. + // That is, we process a word at a time, where words are marked by _ or + // upper case letter. Digits are treated as words. + for ; i < len(s); i++ { + c := s[i] + if c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) { + continue // Skip the underscore in s. + } + if isASCIIDigit(c) { + t = append(t, c) + continue + } + // Assume we have a letter now - if not, it's a bogus identifier. + // The next word is a sequence of characters that must start upper case. + if isASCIILower(c) { + c ^= ' ' // Make it a capital letter. + } + t = append(t, c) // Guaranteed not lower case. + // Accept lower case sequence that follows. + for i+1 < len(s) && isASCIILower(s[i+1]) { + i++ + t = append(t, s[i]) + } + } + return string(t) +} + +// CamelCaseSlice is like CamelCase, but the argument is a slice of strings to +// be joined with "_". +func CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, "_")) } + +// dottedSlice turns a sliced name into a dotted name. +func dottedSlice(elem []string) string { return strings.Join(elem, ".") } + +// Is this field optional? +func isOptional(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_OPTIONAL +} + +// Is this field required? +func isRequired(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED +} + +// Is this field repeated? +func isRepeated(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED +} + +// Is this field a scalar numeric type? +func isScalar(field *descriptor.FieldDescriptorProto) bool { + if field.Type == nil { + return false + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_BOOL, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_SFIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED64, + descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + return true + default: + return false + } +} + +// badToUnderscore is the mapping function used to generate Go names from package names, +// which can be dotted in the input .proto file. It replaces non-identifier characters such as +// dot or dash with underscore. +func badToUnderscore(r rune) rune { + if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { + return r + } + return '_' +} + +// baseName returns the last path element of the name, with the last dotted suffix removed. +func baseName(name string) string { + // First, find the last element + if i := strings.LastIndex(name, "/"); i >= 0 { + name = name[i+1:] + } + // Now drop the suffix + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[0:i] + } + return name +} + +// The SourceCodeInfo message describes the location of elements of a parsed +// .proto file by way of a "path", which is a sequence of integers that +// describe the route from a FileDescriptorProto to the relevant submessage. +// The path alternates between a field number of a repeated field, and an index +// into that repeated field. The constants below define the field numbers that +// are used. +// +// See descriptor.proto for more information about this. +const ( + // tag numbers in FileDescriptorProto + packagePath = 2 // package + messagePath = 4 // message_type + enumPath = 5 // enum_type + // tag numbers in DescriptorProto + messageFieldPath = 2 // field + messageMessagePath = 3 // nested_type + messageEnumPath = 4 // enum_type + messageOneofPath = 8 // oneof_decl + // tag numbers in EnumDescriptorProto + enumValuePath = 2 // value +) + +var supportTypeAliases bool + +func init() { + for _, tag := range build.Default.ReleaseTags { + if tag == "go1.9" { + supportTypeAliases = true + return + } + } +} diff --git a/cmd/protoc-gen-micro/generator/name_test.go b/cmd/protoc-gen-micro/generator/name_test.go new file mode 100644 index 00000000..e4a119d6 --- /dev/null +++ b/cmd/protoc-gen-micro/generator/name_test.go @@ -0,0 +1,135 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2013 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package generator + +import ( + "testing" + + "github.com/golang/protobuf/protoc-gen-go/descriptor" +) + +func TestCamelCase(t *testing.T) { + tests := []struct { + in, want string + }{ + {"one", "One"}, + {"one_two", "OneTwo"}, + {"_my_field_name_2", "XMyFieldName_2"}, + {"Something_Capped", "Something_Capped"}, + {"my_Name", "My_Name"}, + {"OneTwo", "OneTwo"}, + {"_", "X"}, + {"_a_", "XA_"}, + } + for _, tc := range tests { + if got := CamelCase(tc.in); got != tc.want { + t.Errorf("CamelCase(%q) = %q, want %q", tc.in, got, tc.want) + } + } +} + +func TestGoPackageOption(t *testing.T) { + tests := []struct { + in string + impPath GoImportPath + pkg GoPackageName + ok bool + }{ + {"", "", "", false}, + {"foo", "", "foo", true}, + {"github.com/golang/bar", "github.com/golang/bar", "bar", true}, + {"github.com/golang/bar;baz", "github.com/golang/bar", "baz", true}, + {"github.com/golang/string", "github.com/golang/string", "string", true}, + } + for _, tc := range tests { + d := &FileDescriptor{ + FileDescriptorProto: &descriptor.FileDescriptorProto{ + Options: &descriptor.FileOptions{ + GoPackage: &tc.in, + }, + }, + } + impPath, pkg, ok := d.goPackageOption() + if impPath != tc.impPath || pkg != tc.pkg || ok != tc.ok { + t.Errorf("go_package = %q => (%q, %q, %t), want (%q, %q, %t)", tc.in, + impPath, pkg, ok, tc.impPath, tc.pkg, tc.ok) + } + } +} + +func TestPackageNames(t *testing.T) { + g := New() + g.packageNames = make(map[GoImportPath]GoPackageName) + g.usedPackageNames = make(map[GoPackageName]bool) + for _, test := range []struct { + importPath GoImportPath + want GoPackageName + }{ + {"github.com/golang/foo", "foo"}, + {"github.com/golang/second/package/named/foo", "foo1"}, + {"github.com/golang/third/package/named/foo", "foo2"}, + {"github.com/golang/conflicts/with/predeclared/ident/string", "string1"}, + } { + if got := g.GoPackageName(test.importPath); got != test.want { + t.Errorf("GoPackageName(%v) = %v, want %v", test.importPath, got, test.want) + } + } +} + +func TestUnescape(t *testing.T) { + tests := []struct { + in string + out string + }{ + // successful cases, including all kinds of escapes + {"", ""}, + {"foo bar baz frob nitz", "foo bar baz frob nitz"}, + {`\000\001\002\003\004\005\006\007`, string([]byte{0, 1, 2, 3, 4, 5, 6, 7})}, + {`\a\b\f\n\r\t\v\\\?\'\"`, string([]byte{'\a', '\b', '\f', '\n', '\r', '\t', '\v', '\\', '?', '\'', '"'})}, + {`\x10\x20\x30\x40\x50\x60\x70\x80`, string([]byte{16, 32, 48, 64, 80, 96, 112, 128})}, + // variable length octal escapes + {`\0\018\222\377\3\04\005\6\07`, string([]byte{0, 1, '8', 0222, 255, 3, 4, 5, 6, 7})}, + // malformed escape sequences left as is + {"foo \\g bar", "foo \\g bar"}, + {"foo \\xg0 bar", "foo \\xg0 bar"}, + {"\\", "\\"}, + {"\\x", "\\x"}, + {"\\xf", "\\xf"}, + {"\\777", "\\777"}, // overflows byte + } + for _, tc := range tests { + s := unescape(tc.in) + if s != tc.out { + t.Errorf("doUnescape(%q) = %q; should have been %q", tc.in, s, tc.out) + } + } +} diff --git a/cmd/protoc-gen-micro/main.go b/cmd/protoc-gen-micro/main.go new file mode 100644 index 00000000..7f2b507f --- /dev/null +++ b/cmd/protoc-gen-micro/main.go @@ -0,0 +1,99 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// protoc-gen-micro is a plugin for the Google protocol buffer compiler to generate +// Go code. Run it by building this program and putting it in your path with +// the name +// protoc-gen-micro +// That word 'micro' at the end becomes part of the option string set for the +// protocol compiler, so once the protocol compiler (protoc) is installed +// you can run +// protoc --micro_out=output_directory --go_out=output_directory input_directory/file.proto +// to generate go-micro code for the protocol defined by file.proto. +// With that input, the output will be written to +// output_directory/file.micro.go +// +// The generated code is documented in the package comment for +// the library. +// +// See the README and documentation for protocol buffers to learn more: +// https://developers.google.com/protocol-buffers/ +package main + +import ( + "io/ioutil" + "os" + + "github.com/golang/protobuf/proto" + "github.com/unistack-org/micro/v3/cmd/protoc-gen-micro/generator" + _ "github.com/unistack-org/micro/v3/cmd/protoc-gen-micro/plugin/micro" +) + +func main() { + // Begin by allocating a generator. The request and response structures are stored there + // so we can do error handling easily - the response structure contains the field to + // report failure. + g := generator.New() + + data, err := ioutil.ReadAll(os.Stdin) + if err != nil { + g.Error(err, "reading input") + } + + if err := proto.Unmarshal(data, g.Request); err != nil { + g.Error(err, "parsing input proto") + } + + if len(g.Request.FileToGenerate) == 0 { + g.Fail("no files to generate") + } + + g.CommandLineParameters(g.Request.GetParameter()) + + // Create a wrapped version of the Descriptors and EnumDescriptors that + // point to the file that defines them. + g.WrapTypes() + + g.SetPackageNames() + g.BuildTypeNameMap() + + g.GenerateAllFiles() + + // Send back the results. + data, err = proto.Marshal(g.Response) + if err != nil { + g.Error(err, "failed to marshal output proto") + } + _, err = os.Stdout.Write(data) + if err != nil { + g.Error(err, "failed to write output proto") + } +} diff --git a/cmd/protoc-gen-micro/plugin/micro/micro.go b/cmd/protoc-gen-micro/plugin/micro/micro.go new file mode 100644 index 00000000..b8952b4f --- /dev/null +++ b/cmd/protoc-gen-micro/plugin/micro/micro.go @@ -0,0 +1,553 @@ +package micro + +import ( + "fmt" + "path" + "strconv" + "strings" + + "github.com/golang/protobuf/proto" + pb "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/unistack-org/micro/v3/cmd/protoc-gen-micro/generator" + options "google.golang.org/genproto/googleapis/api/annotations" +) + +// Paths for packages used by code generated in this file, +// relative to the import_prefix of the generator.Generator. +const ( + apiPkgPath = "github.com/unistack-org/micro/v3/api" + contextPkgPath = "context" + clientPkgPath = "github.com/unistack-org/micro/v3/client" + serverPkgPath = "github.com/unistack-org/micro/v3/server" +) + +func init() { + generator.RegisterPlugin(new(micro)) +} + +// micro is an implementation of the Go protocol buffer compiler's +// plugin architecture. It generates bindings for go-micro support. +type micro struct { + gen *generator.Generator +} + +// Name returns the name of this plugin, "micro". +func (g *micro) Name() string { + return "micro" +} + +// The names for packages imported in the generated code. +// They may vary from the final path component of the import path +// if the name is used by other packages. +var ( + apiPkg string + contextPkg string + clientPkg string + serverPkg string + pkgImports map[generator.GoPackageName]bool +) + +// Init initializes the plugin. +func (g *micro) Init(gen *generator.Generator) { + g.gen = gen + apiPkg = generator.RegisterUniquePackageName("api", nil) + contextPkg = generator.RegisterUniquePackageName("context", nil) + clientPkg = generator.RegisterUniquePackageName("client", nil) + serverPkg = generator.RegisterUniquePackageName("server", nil) +} + +// Given a type name defined in a .proto, return its object. +// Also record that we're using it, to guarantee the associated import. +func (g *micro) objectNamed(name string) generator.Object { + g.gen.RecordTypeUse(name) + return g.gen.ObjectNamed(name) +} + +// Given a type name defined in a .proto, return its name as we will print it. +func (g *micro) typeName(str string) string { + return g.gen.TypeName(g.objectNamed(str)) +} + +// P forwards to g.gen.P. +func (g *micro) P(args ...interface{}) { g.gen.P(args...) } + +// Generate generates code for the services in the given file. +func (g *micro) Generate(file *generator.FileDescriptor) { + if len(file.FileDescriptorProto.Service) == 0 { + return + } + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ ", apiPkg, ".Endpoint") + g.P("var _ ", contextPkg, ".Context") + g.P("var _ ", clientPkg, ".Option") + g.P("var _ ", serverPkg, ".Option") + g.P() + + for i, service := range file.FileDescriptorProto.Service { + g.generateService(file, service, i) + } +} + +// GenerateImports generates the import declaration for this file. +func (g *micro) GenerateImports(file *generator.FileDescriptor, imports map[generator.GoImportPath]generator.GoPackageName) { + if len(file.FileDescriptorProto.Service) == 0 { + return + } + g.P("import (") + g.P(apiPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, apiPkgPath))) + g.P(contextPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, contextPkgPath))) + g.P(clientPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, clientPkgPath))) + g.P(serverPkg, " ", strconv.Quote(path.Join(g.gen.ImportPrefix, serverPkgPath))) + g.P(")") + g.P() + + // We need to keep track of imported packages to make sure we don't produce + // a name collision when generating types. + pkgImports = make(map[generator.GoPackageName]bool) + for _, name := range imports { + pkgImports[name] = true + } +} + +// reservedClientName records whether a client name is reserved on the client side. +var reservedClientName = map[string]bool{ + // TODO: do we need any in go-micro? +} + +func unexport(s string) string { + if len(s) == 0 { + return "" + } + name := strings.ToLower(s[:1]) + s[1:] + if pkgImports[generator.GoPackageName(name)] { + return name + "_" + } + return name +} + +// generateService generates all the code for the named service. +func (g *micro) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) { + path := fmt.Sprintf("6,%d", index) // 6 means service. + + origServName := service.GetName() + serviceName := strings.ToLower(service.GetName()) + if pkg := file.GetPackage(); pkg != "" { + serviceName = pkg + } + servName := generator.CamelCase(origServName) + servAlias := servName + "Service" + + // strip suffix + if strings.HasSuffix(servAlias, "ServiceService") { + servAlias = strings.TrimSuffix(servAlias, "Service") + } + + g.P() + g.P("// Api Endpoints for ", servName, " service") + g.P() + + g.P("func New", servName, "Endpoints () []*", apiPkg, ".Endpoint {") + g.P("return []*", apiPkg, ".Endpoint{") + for _, method := range service.Method { + if method.Options != nil && proto.HasExtension(method.Options, options.E_Http) { + g.P("&", apiPkg, ".Endpoint{") + g.generateEndpoint(servName, method) + g.P("},") + } + } + g.P("}") + g.P("}") + g.P() + + g.P() + g.P("// Client API for ", servName, " service") + g.P() + + // Client interface. + g.P("type ", servAlias, " interface {") + for i, method := range service.Method { + g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + g.P(g.generateClientSignature(servName, method)) + } + g.P("}") + g.P() + + // Client structure. + g.P("type ", unexport(servAlias), " struct {") + g.P("c ", clientPkg, ".Client") + g.P("name string") + g.P("}") + g.P() + + // NewClient factory. + g.P("func New", servAlias, " (name string, c ", clientPkg, ".Client) ", servAlias, " {") + /* + g.P("if c == nil {") + g.P("c = ", clientPkg, ".NewClient()") + g.P("}") + g.P("if len(name) == 0 {") + g.P(`name = "`, serviceName, `"`) + g.P("}") + */ + g.P("return &", unexport(servAlias), "{") + g.P("c: c,") + g.P("name: name,") + g.P("}") + g.P("}") + g.P() + var methodIndex, streamIndex int + serviceDescVar := "_" + servName + "_serviceDesc" + // Client method implementations. + for _, method := range service.Method { + var descExpr string + if !method.GetServerStreaming() { + // Unary RPC method + descExpr = fmt.Sprintf("&%s.Methods[%d]", serviceDescVar, methodIndex) + methodIndex++ + } else { + // Streaming RPC method + descExpr = fmt.Sprintf("&%s.Streams[%d]", serviceDescVar, streamIndex) + streamIndex++ + } + g.generateClientMethod(serviceName, servName, serviceDescVar, method, descExpr) + } + + g.P("// Server API for ", servName, " service") + g.P() + + // Server interface. + serverType := servName + "Handler" + g.P("type ", serverType, " interface {") + for i, method := range service.Method { + g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + g.P(g.generateServerSignature(servName, method)) + } + g.P("}") + g.P() + + // Server registration. + g.P("func Register", servName, "Handler(s ", serverPkg, ".Server, hdlr ", serverType, ", opts ...", serverPkg, ".HandlerOption) error {") + g.P("type ", unexport(servName), " interface {") + + // generate interface methods + for _, method := range service.Method { + methName := generator.CamelCase(method.GetName()) + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P(methName, "(ctx ", contextPkg, ".Context, in *", inType, ", out *", outType, ") error") + continue + } + g.P(methName, "(ctx ", contextPkg, ".Context, stream server.Stream) error") + } + g.P("}") + g.P("type ", servName, " struct {") + g.P(unexport(servName)) + g.P("}") + g.P("h := &", unexport(servName), "Handler{hdlr}") + for _, method := range service.Method { + if method.Options != nil && proto.HasExtension(method.Options, options.E_Http) { + g.P("opts = append(opts, ", apiPkg, ".WithEndpoint(&", apiPkg, ".Endpoint{") + g.generateEndpoint(servName, method) + g.P("}))") + } + } + g.P("return s.Handle(s.NewHandler(&", servName, "{h}, opts...))") + g.P("}") + g.P() + + g.P("type ", unexport(servName), "Handler struct {") + g.P(serverType) + g.P("}") + + // Server handler implementations. + var handlerNames []string + for _, method := range service.Method { + hname := g.generateServerMethod(servName, method) + handlerNames = append(handlerNames, hname) + } +} + +// generateEndpoint creates the api endpoint +func (g *micro) generateEndpoint(servName string, method *pb.MethodDescriptorProto) { + if method.Options == nil || !proto.HasExtension(method.Options, options.E_Http) { + return + } + // http rules + r, err := proto.GetExtension(method.Options, options.E_Http) + if err != nil { + return + } + rule := r.(*options.HttpRule) + var meth string + var path string + switch { + case len(rule.GetDelete()) > 0: + meth = "DELETE" + path = rule.GetDelete() + case len(rule.GetGet()) > 0: + meth = "GET" + path = rule.GetGet() + case len(rule.GetPatch()) > 0: + meth = "PATCH" + path = rule.GetPatch() + case len(rule.GetPost()) > 0: + meth = "POST" + path = rule.GetPost() + case len(rule.GetPut()) > 0: + meth = "PUT" + path = rule.GetPut() + } + if len(meth) == 0 || len(path) == 0 { + return + } + // TODO: process additional bindings + g.P("Name:", fmt.Sprintf(`"%s.%s",`, servName, method.GetName())) + g.P("Path:", fmt.Sprintf(`[]string{"%s"},`, path)) + g.P("Method:", fmt.Sprintf(`[]string{"%s"},`, meth)) + if len(rule.GetGet()) == 0 { + g.P("Body:", fmt.Sprintf(`"%s",`, rule.GetBody())) + } + if method.GetServerStreaming() || method.GetClientStreaming() { + g.P("Stream: true,") + } + g.P(`Handler: "rpc",`) +} + +// generateClientSignature returns the client-side signature for a method. +func (g *micro) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + reqArg := ", in *" + g.typeName(method.GetInputType()) + if method.GetClientStreaming() { + reqArg = "" + } + respName := "*" + g.typeName(method.GetOutputType()) + if method.GetServerStreaming() || method.GetClientStreaming() { + respName = servName + "_" + generator.CamelCase(origMethName) + "Service" + } + + return fmt.Sprintf("%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)", methName, contextPkg, reqArg, clientPkg, respName) +} + +func (g *micro) generateClientMethod(reqServ, servName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) { + reqMethod := fmt.Sprintf("%s.%s", servName, method.GetName()) + methName := generator.CamelCase(method.GetName()) + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + servAlias := servName + "Service" + + // strip suffix + if strings.HasSuffix(servAlias, "ServiceService") { + servAlias = strings.TrimSuffix(servAlias, "Service") + } + + g.P("func (c *", unexport(servAlias), ") ", g.generateClientSignature(servName, method), "{") + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P(`req := c.c.NewRequest(c.name, "`, reqMethod, `", in)`) + g.P("out := new(", outType, ")") + // TODO: Pass descExpr to Invoke. + g.P("err := ", `c.c.Call(ctx, req, out, opts...)`) + g.P("if err != nil { return nil, err }") + g.P("return out, nil") + g.P("}") + g.P() + return + } + streamType := unexport(servAlias) + methName + g.P(`req := c.c.NewRequest(c.name, "`, reqMethod, `", &`, inType, `{})`) + g.P("stream, err := c.c.Stream(ctx, req, opts...)") + g.P("if err != nil { return nil, err }") + + if !method.GetClientStreaming() { + g.P("if err := stream.Send(in); err != nil { return nil, err }") + } + + g.P("return &", streamType, "{stream}, nil") + g.P("}") + g.P() + + genSend := method.GetClientStreaming() + genRecv := method.GetServerStreaming() + + // Stream auxiliary types and methods. + g.P("type ", servName, "_", methName, "Service interface {") + g.P("Context() context.Context") + g.P("SendMsg(interface{}) error") + g.P("RecvMsg(interface{}) error") + g.P("Close() error") + + if genSend { + g.P("Send(*", inType, ") error") + } + if genRecv { + g.P("Recv() (*", outType, ", error)") + } + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P("stream ", clientPkg, ".Stream") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") Close() error {") + g.P("return x.stream.Close()") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") Context() context.Context {") + g.P("return x.stream.Context()") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") SendMsg(m interface{}) error {") + g.P("return x.stream.Send(m)") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") RecvMsg(m interface{}) error {") + g.P("return x.stream.Recv(m)") + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", inType, ") error {") + g.P("return x.stream.Send(m)") + g.P("}") + g.P() + + } + + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", outType, ", error) {") + g.P("m := new(", outType, ")") + g.P("err := x.stream.Recv(m)") + g.P("if err != nil {") + g.P("return nil, err") + g.P("}") + g.P("return m, nil") + g.P("}") + g.P() + } +} + +// generateServerSignature returns the server-side signature for a method. +func (g *micro) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + + var reqArgs []string + ret := "error" + reqArgs = append(reqArgs, contextPkg+".Context") + + if !method.GetClientStreaming() { + reqArgs = append(reqArgs, "*"+g.typeName(method.GetInputType())) + } + if method.GetServerStreaming() || method.GetClientStreaming() { + reqArgs = append(reqArgs, servName+"_"+generator.CamelCase(origMethName)+"Stream") + } + if !method.GetClientStreaming() && !method.GetServerStreaming() { + reqArgs = append(reqArgs, "*"+g.typeName(method.GetOutputType())) + } + return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret +} + +func (g *micro) generateServerMethod(servName string, method *pb.MethodDescriptorProto) string { + methName := generator.CamelCase(method.GetName()) + hname := fmt.Sprintf("_%s_%s_Handler", servName, methName) + serveType := servName + "Handler" + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P("func (h *", unexport(servName), "Handler) ", methName, "(ctx ", contextPkg, ".Context, in *", inType, ", out *", outType, ") error {") + g.P("return h.", serveType, ".", methName, "(ctx, in, out)") + g.P("}") + g.P() + return hname + } + streamType := unexport(servName) + methName + "Stream" + g.P("func (h *", unexport(servName), "Handler) ", methName, "(ctx ", contextPkg, ".Context, stream server.Stream) error {") + if !method.GetClientStreaming() { + g.P("m := new(", inType, ")") + g.P("if err := stream.Recv(m); err != nil { return err }") + g.P("return h.", serveType, ".", methName, "(ctx, m, &", streamType, "{stream})") + } else { + g.P("return h.", serveType, ".", methName, "(ctx, &", streamType, "{stream})") + } + g.P("}") + g.P() + + genSend := method.GetServerStreaming() + genRecv := method.GetClientStreaming() + + // Stream auxiliary types and methods. + g.P("type ", servName, "_", methName, "Stream interface {") + g.P("Context() context.Context") + g.P("SendMsg(interface{}) error") + g.P("RecvMsg(interface{}) error") + g.P("Close() error") + + if genSend { + g.P("Send(*", outType, ") error") + } + + if genRecv { + g.P("Recv() (*", inType, ", error)") + } + + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P("stream ", serverPkg, ".Stream") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") Close() error {") + g.P("return x.stream.Close()") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") Context() context.Context {") + g.P("return x.stream.Context()") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") SendMsg(m interface{}) error {") + g.P("return x.stream.Send(m)") + g.P("}") + g.P() + + g.P("func (x *", streamType, ") RecvMsg(m interface{}) error {") + g.P("return x.stream.Recv(m)") + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", outType, ") error {") + g.P("return x.stream.Send(m)") + g.P("}") + g.P() + } + + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", inType, ", error) {") + g.P("m := new(", inType, ")") + g.P("if err := x.stream.Recv(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + + return hname +} diff --git a/codec/bytes/bytes.go b/codec/bytes/bytes.go index f186d4ae..1d5b1d8f 100644 --- a/codec/bytes/bytes.go +++ b/codec/bytes/bytes.go @@ -6,7 +6,7 @@ import ( "io" "io/ioutil" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Codec struct { diff --git a/codec/bytes/marshaler.go b/codec/bytes/marshaler.go index 76cdd954..3ec9add1 100644 --- a/codec/bytes/marshaler.go +++ b/codec/bytes/marshaler.go @@ -1,7 +1,7 @@ package bytes import ( - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Marshaler struct{} diff --git a/codec/codec_test.go b/codec/codec_test.go index 564e5a12..a3c2546a 100644 --- a/codec/codec_test.go +++ b/codec/codec_test.go @@ -4,14 +4,14 @@ import ( "io" "testing" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/codec/grpc" - "github.com/micro/go-micro/v3/codec/json" - "github.com/micro/go-micro/v3/codec/jsonrpc" - "github.com/micro/go-micro/v3/codec/proto" - "github.com/micro/go-micro/v3/codec/protorpc" - "github.com/micro/go-micro/v3/codec/text" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec/grpc" + "github.com/unistack-org/micro/v3/codec/json" + "github.com/unistack-org/micro/v3/codec/jsonrpc" + "github.com/unistack-org/micro/v3/codec/proto" + "github.com/unistack-org/micro/v3/codec/protorpc" + "github.com/unistack-org/micro/v3/codec/text" ) type testRWC struct{} diff --git a/codec/grpc/grpc.go b/codec/grpc/grpc.go index 6f8db3a0..61233343 100644 --- a/codec/grpc/grpc.go +++ b/codec/grpc/grpc.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Codec struct { diff --git a/codec/json/json.go b/codec/json/json.go index 49103e1c..fffdc6ab 100644 --- a/codec/json/json.go +++ b/codec/json/json.go @@ -7,7 +7,7 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Codec struct { diff --git a/codec/jsonrpc/client.go b/codec/jsonrpc/client.go index 6e43cde5..4bf56ff0 100644 --- a/codec/jsonrpc/client.go +++ b/codec/jsonrpc/client.go @@ -6,7 +6,7 @@ import ( "io" "sync" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type clientCodec struct { diff --git a/codec/jsonrpc/jsonrpc.go b/codec/jsonrpc/jsonrpc.go index 7c378daf..1311da25 100644 --- a/codec/jsonrpc/jsonrpc.go +++ b/codec/jsonrpc/jsonrpc.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type jsonCodec struct { diff --git a/codec/jsonrpc/server.go b/codec/jsonrpc/server.go index cdbd3fa1..ceda9bc2 100644 --- a/codec/jsonrpc/server.go +++ b/codec/jsonrpc/server.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type serverCodec struct { diff --git a/codec/proto/marshaler.go b/codec/proto/marshaler.go index 23184fdb..00a5b1f9 100644 --- a/codec/proto/marshaler.go +++ b/codec/proto/marshaler.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" "github.com/oxtoacart/bpool" ) diff --git a/codec/proto/proto.go b/codec/proto/proto.go index 8d79af5c..86ec0615 100644 --- a/codec/proto/proto.go +++ b/codec/proto/proto.go @@ -6,7 +6,7 @@ import ( "io/ioutil" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Codec struct { diff --git a/codec/protorpc/envelope.pb.go b/codec/protorpc/envelope.pb.go index b0e88066..81953524 100644 --- a/codec/protorpc/envelope.pb.go +++ b/codec/protorpc/envelope.pb.go @@ -1,144 +1,238 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: codec/protorpc/envelope.proto package protorpc 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 { - ServiceMethod string `protobuf:"bytes,1,opt,name=service_method,json=serviceMethod,proto3" json:"service_method,omitempty"` - Seq uint64 `protobuf:"fixed64,2,opt,name=seq,proto3" json:"seq,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceMethod string `protobuf:"bytes,1,opt,name=service_method,json=serviceMethod,proto3" json:"service_method,omitempty"` + Seq uint64 `protobuf:"fixed64,2,opt,name=seq,proto3" json:"seq,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_codec_protorpc_envelope_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_codec_protorpc_envelope_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_12fd17ed7ee86a33, []int{0} + return file_codec_protorpc_envelope_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) GetServiceMethod() string { - if m != nil { - return m.ServiceMethod +func (x *Request) GetServiceMethod() string { + if x != nil { + return x.ServiceMethod } return "" } -func (m *Request) GetSeq() uint64 { - if m != nil { - return m.Seq +func (x *Request) GetSeq() uint64 { + if x != nil { + return x.Seq } return 0 } type Response struct { - ServiceMethod string `protobuf:"bytes,1,opt,name=service_method,json=serviceMethod,proto3" json:"service_method,omitempty"` - Seq uint64 `protobuf:"fixed64,2,opt,name=seq,proto3" json:"seq,omitempty"` - Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceMethod string `protobuf:"bytes,1,opt,name=service_method,json=serviceMethod,proto3" json:"service_method,omitempty"` + Seq uint64 `protobuf:"fixed64,2,opt,name=seq,proto3" json:"seq,omitempty"` + Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,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_codec_protorpc_envelope_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_codec_protorpc_envelope_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_12fd17ed7ee86a33, []int{1} + return file_codec_protorpc_envelope_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) GetServiceMethod() string { - if m != nil { - return m.ServiceMethod +func (x *Response) GetServiceMethod() string { + if x != nil { + return x.ServiceMethod } return "" } -func (m *Response) GetSeq() uint64 { - if m != nil { - return m.Seq +func (x *Response) GetSeq() uint64 { + if x != nil { + return x.Seq } return 0 } -func (m *Response) GetError() string { - if m != nil { - return m.Error +func (x *Response) GetError() string { + if x != nil { + return x.Error } return "" } -func init() { - proto.RegisterType((*Request)(nil), "protorpc.Request") - proto.RegisterType((*Response)(nil), "protorpc.Response") +var File_codec_protorpc_envelope_proto protoreflect.FileDescriptor + +var file_codec_protorpc_envelope_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x72, 0x70, 0x63, + 0x2f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x72, 0x70, 0x63, 0x22, 0x42, 0x0a, 0x07, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, + 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x73, + 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x03, 0x73, 0x65, 0x71, 0x22, 0x59, 0x0a, + 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, + 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x03, 0x73, + 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("codec/protorpc/envelope.proto", fileDescriptor_12fd17ed7ee86a33) } +var ( + file_codec_protorpc_envelope_proto_rawDescOnce sync.Once + file_codec_protorpc_envelope_proto_rawDescData = file_codec_protorpc_envelope_proto_rawDesc +) -var fileDescriptor_12fd17ed7ee86a33 = []byte{ - // 148 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0xce, 0x4f, 0x49, - 0x4d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x2f, 0x2a, 0x48, 0xd6, 0x4f, 0xcd, 0x2b, 0x4b, 0xcd, - 0xc9, 0x2f, 0x48, 0xd5, 0x03, 0x8b, 0x08, 0x71, 0xc0, 0x24, 0x94, 0x9c, 0xb8, 0xd8, 0x83, 0x52, - 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x84, 0x54, 0xb9, 0xf8, 0x8a, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, - 0xe3, 0x73, 0x53, 0x4b, 0x32, 0xf2, 0x53, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x78, 0xa1, - 0xa2, 0xbe, 0x60, 0x41, 0x21, 0x01, 0x2e, 0xe6, 0xe2, 0xd4, 0x42, 0x09, 0x26, 0x05, 0x46, 0x0d, - 0xb6, 0x20, 0x10, 0x53, 0x29, 0x92, 0x8b, 0x23, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x95, - 0x6c, 0x43, 0x84, 0x44, 0xb8, 0x58, 0x53, 0x8b, 0x8a, 0xf2, 0x8b, 0x24, 0x98, 0xc1, 0xea, 0x21, - 0x9c, 0x24, 0x36, 0xb0, 0x43, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x73, 0x3a, 0x4b, - 0xd0, 0x00, 0x00, 0x00, +func file_codec_protorpc_envelope_proto_rawDescGZIP() []byte { + file_codec_protorpc_envelope_proto_rawDescOnce.Do(func() { + file_codec_protorpc_envelope_proto_rawDescData = protoimpl.X.CompressGZIP(file_codec_protorpc_envelope_proto_rawDescData) + }) + return file_codec_protorpc_envelope_proto_rawDescData +} + +var file_codec_protorpc_envelope_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_codec_protorpc_envelope_proto_goTypes = []interface{}{ + (*Request)(nil), // 0: protorpc.Request + (*Response)(nil), // 1: protorpc.Response +} +var file_codec_protorpc_envelope_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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_codec_protorpc_envelope_proto_init() } +func file_codec_protorpc_envelope_proto_init() { + if File_codec_protorpc_envelope_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_codec_protorpc_envelope_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_codec_protorpc_envelope_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_codec_protorpc_envelope_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_codec_protorpc_envelope_proto_goTypes, + DependencyIndexes: file_codec_protorpc_envelope_proto_depIdxs, + MessageInfos: file_codec_protorpc_envelope_proto_msgTypes, + }.Build() + File_codec_protorpc_envelope_proto = out.File + file_codec_protorpc_envelope_proto_rawDesc = nil + file_codec_protorpc_envelope_proto_goTypes = nil + file_codec_protorpc_envelope_proto_depIdxs = nil } diff --git a/codec/protorpc/protorpc.go b/codec/protorpc/protorpc.go index 3460a835..92a93e80 100644 --- a/codec/protorpc/protorpc.go +++ b/codec/protorpc/protorpc.go @@ -9,7 +9,7 @@ import ( "sync" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type flusher interface { diff --git a/codec/text/text.go b/codec/text/text.go index a3aaa1ba..6b83146c 100644 --- a/codec/text/text.go +++ b/codec/text/text.go @@ -6,7 +6,7 @@ import ( "io" "io/ioutil" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Codec struct { diff --git a/config/config.go b/config/config.go index a41a7881..5489e48a 100644 --- a/config/config.go +++ b/config/config.go @@ -4,9 +4,9 @@ package config import ( "context" - "github.com/micro/go-micro/v3/config/loader" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/loader" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) // Config is an interface abstraction for dynamic configuration diff --git a/config/default.go b/config/default.go index 41d357d3..c4ccb878 100644 --- a/config/default.go +++ b/config/default.go @@ -5,11 +5,11 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/config/loader" - "github.com/micro/go-micro/v3/config/loader/memory" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/reader/json" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/loader" + "github.com/unistack-org/micro/v3/config/loader/memory" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/reader/json" + "github.com/unistack-org/micro/v3/config/source" ) type config struct { diff --git a/config/default_test.go b/config/default_test.go index 46350963..303628a3 100644 --- a/config/default_test.go +++ b/config/default_test.go @@ -9,10 +9,10 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/config/source" - "github.com/micro/go-micro/v3/config/source/env" - "github.com/micro/go-micro/v3/config/source/file" - "github.com/micro/go-micro/v3/config/source/memory" + "github.com/unistack-org/micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source/env" + "github.com/unistack-org/micro/v3/config/source/file" + "github.com/unistack-org/micro/v3/config/source/memory" ) func createFileForIssue18(t *testing.T, content string) *os.File { diff --git a/config/encoder/hcl/hcl.go b/config/encoder/hcl/hcl.go index 72fad9df..0e1801f4 100644 --- a/config/encoder/hcl/hcl.go +++ b/config/encoder/hcl/hcl.go @@ -4,7 +4,7 @@ import ( "encoding/json" "github.com/hashicorp/hcl" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) type hclEncoder struct{} diff --git a/config/encoder/json/json.go b/config/encoder/json/json.go index 13f179f9..a63e3af9 100644 --- a/config/encoder/json/json.go +++ b/config/encoder/json/json.go @@ -3,7 +3,7 @@ package json import ( "encoding/json" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) type jsonEncoder struct{} diff --git a/config/encoder/toml/toml.go b/config/encoder/toml/toml.go index 91109073..c4b3c620 100644 --- a/config/encoder/toml/toml.go +++ b/config/encoder/toml/toml.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/BurntSushi/toml" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) type tomlEncoder struct{} diff --git a/config/encoder/xml/xml.go b/config/encoder/xml/xml.go index 8e32a14e..d8329944 100644 --- a/config/encoder/xml/xml.go +++ b/config/encoder/xml/xml.go @@ -3,7 +3,7 @@ package xml import ( "encoding/xml" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) type xmlEncoder struct{} diff --git a/config/encoder/yaml/yaml.go b/config/encoder/yaml/yaml.go index b3da7ba5..9374b8a5 100644 --- a/config/encoder/yaml/yaml.go +++ b/config/encoder/yaml/yaml.go @@ -2,7 +2,7 @@ package yaml import ( "github.com/ghodss/yaml" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) type yamlEncoder struct{} diff --git a/config/loader/loader.go b/config/loader/loader.go index 1e2dc13a..7221f77c 100644 --- a/config/loader/loader.go +++ b/config/loader/loader.go @@ -4,8 +4,8 @@ package loader import ( "context" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) // Loader manages loading sources diff --git a/config/loader/memory/memory.go b/config/loader/memory/memory.go index c8746266..6ecf3946 100644 --- a/config/loader/memory/memory.go +++ b/config/loader/memory/memory.go @@ -9,10 +9,10 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/config/loader" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/reader/json" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/loader" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/reader/json" + "github.com/unistack-org/micro/v3/config/source" ) type memory struct { diff --git a/config/loader/memory/options.go b/config/loader/memory/options.go index 34a8441c..44182f15 100644 --- a/config/loader/memory/options.go +++ b/config/loader/memory/options.go @@ -1,9 +1,9 @@ package memory import ( - "github.com/micro/go-micro/v3/config/loader" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/loader" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) // WithSource appends a source to list of sources diff --git a/config/options.go b/config/options.go index d29f8f86..20fcb9de 100644 --- a/config/options.go +++ b/config/options.go @@ -1,9 +1,9 @@ package config import ( - "github.com/micro/go-micro/v3/config/loader" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/loader" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) // WithLoader sets the loader for manager config diff --git a/config/reader/json/json.go b/config/reader/json/json.go index f356fe94..297c4dc6 100644 --- a/config/reader/json/json.go +++ b/config/reader/json/json.go @@ -5,10 +5,10 @@ import ( "time" "github.com/imdario/mergo" - "github.com/micro/go-micro/v3/config/encoder" - "github.com/micro/go-micro/v3/config/encoder/json" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder/json" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) type jsonReader struct { diff --git a/config/reader/json/json_test.go b/config/reader/json/json_test.go index 6c0818ba..48e0f8d7 100644 --- a/config/reader/json/json_test.go +++ b/config/reader/json/json_test.go @@ -3,8 +3,8 @@ package json import ( "testing" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) func TestReader(t *testing.T) { diff --git a/config/reader/json/values.go b/config/reader/json/values.go index 7f0fe13c..9132702d 100644 --- a/config/reader/json/values.go +++ b/config/reader/json/values.go @@ -8,8 +8,8 @@ import ( "time" simple "github.com/bitly/go-simplejson" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) type jsonValues struct { diff --git a/config/reader/json/values_test.go b/config/reader/json/values_test.go index 2f86b003..15748a48 100644 --- a/config/reader/json/values_test.go +++ b/config/reader/json/values_test.go @@ -4,8 +4,8 @@ import ( "reflect" "testing" - "github.com/micro/go-micro/v3/config/reader" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/source" ) func TestValues(t *testing.T) { diff --git a/config/reader/options.go b/config/reader/options.go index 51fecd05..d96938ce 100644 --- a/config/reader/options.go +++ b/config/reader/options.go @@ -1,12 +1,12 @@ package reader import ( - "github.com/micro/go-micro/v3/config/encoder" - "github.com/micro/go-micro/v3/config/encoder/hcl" - "github.com/micro/go-micro/v3/config/encoder/json" - "github.com/micro/go-micro/v3/config/encoder/toml" - "github.com/micro/go-micro/v3/config/encoder/xml" - "github.com/micro/go-micro/v3/config/encoder/yaml" + "github.com/unistack-org/micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder/hcl" + "github.com/unistack-org/micro/v3/config/encoder/json" + "github.com/unistack-org/micro/v3/config/encoder/toml" + "github.com/unistack-org/micro/v3/config/encoder/xml" + "github.com/unistack-org/micro/v3/config/encoder/yaml" ) type Options struct { diff --git a/config/reader/reader.go b/config/reader/reader.go index abc3ad94..c2f25213 100644 --- a/config/reader/reader.go +++ b/config/reader/reader.go @@ -4,7 +4,7 @@ package reader import ( "time" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) // Reader is an interface for merging changesets diff --git a/config/source/env/env.go b/config/source/env/env.go index 1d0ed295..9bd839f8 100644 --- a/config/source/env/env.go +++ b/config/source/env/env.go @@ -7,7 +7,7 @@ import ( "time" "github.com/imdario/mergo" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) var ( diff --git a/config/source/env/env_test.go b/config/source/env/env_test.go index 50b1bce7..eb5777a1 100644 --- a/config/source/env/env_test.go +++ b/config/source/env/env_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) func TestEnv_Read(t *testing.T) { diff --git a/config/source/env/options.go b/config/source/env/options.go index dd362610..ae8f9aed 100644 --- a/config/source/env/options.go +++ b/config/source/env/options.go @@ -5,7 +5,7 @@ import ( "strings" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type strippedPrefixKey struct{} diff --git a/config/source/env/watcher.go b/config/source/env/watcher.go index f698bb8f..cb2c1d14 100644 --- a/config/source/env/watcher.go +++ b/config/source/env/watcher.go @@ -1,7 +1,7 @@ package env import ( - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type watcher struct { diff --git a/config/source/etcd/etcd.go b/config/source/etcd/etcd.go index 08ae4e0c..cbb6ff30 100644 --- a/config/source/etcd/etcd.go +++ b/config/source/etcd/etcd.go @@ -8,7 +8,7 @@ import ( cetcd "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/mvcc/mvccpb" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) // Currently a single etcd reader diff --git a/config/source/etcd/options.go b/config/source/etcd/options.go index 3d2c1e69..395ec109 100644 --- a/config/source/etcd/options.go +++ b/config/source/etcd/options.go @@ -4,7 +4,7 @@ import ( "context" "time" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type addressKey struct{} diff --git a/config/source/etcd/util.go b/config/source/etcd/util.go index e495b64c..5784af7b 100644 --- a/config/source/etcd/util.go +++ b/config/source/etcd/util.go @@ -5,7 +5,7 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/mvcc/mvccpb" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) func makeEvMap(e encoder.Encoder, data map[string]interface{}, kv []*clientv3.Event, stripPrefix string) map[string]interface{} { diff --git a/config/source/etcd/watcher.go b/config/source/etcd/watcher.go index 0d4fbf8b..8162c3fb 100644 --- a/config/source/etcd/watcher.go +++ b/config/source/etcd/watcher.go @@ -7,7 +7,7 @@ import ( "time" cetcd "github.com/coreos/etcd/clientv3" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type watcher struct { diff --git a/config/source/file/file.go b/config/source/file/file.go index 6b42fd19..aba532b4 100644 --- a/config/source/file/file.go +++ b/config/source/file/file.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "os" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type file struct { diff --git a/config/source/file/file_test.go b/config/source/file/file_test.go index fb725496..afc0c546 100644 --- a/config/source/file/file_test.go +++ b/config/source/file/file_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/config" - "github.com/micro/go-micro/v3/config/source/file" + "github.com/unistack-org/micro/v3/config" + "github.com/unistack-org/micro/v3/config/source/file" ) func TestConfig(t *testing.T) { diff --git a/config/source/file/format.go b/config/source/file/format.go index 4bd9dd22..f6a68605 100644 --- a/config/source/file/format.go +++ b/config/source/file/format.go @@ -3,7 +3,7 @@ package file import ( "strings" - "github.com/micro/go-micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder" ) func format(p string, e encoder.Encoder) string { diff --git a/config/source/file/format_test.go b/config/source/file/format_test.go index dca78cee..ed53f287 100644 --- a/config/source/file/format_test.go +++ b/config/source/file/format_test.go @@ -3,7 +3,7 @@ package file import ( "testing" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) func TestFormat(t *testing.T) { diff --git a/config/source/file/options.go b/config/source/file/options.go index f9721cb4..78664387 100644 --- a/config/source/file/options.go +++ b/config/source/file/options.go @@ -3,7 +3,7 @@ package file import ( "context" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type filePathKey struct{} diff --git a/config/source/file/watcher.go b/config/source/file/watcher.go index 953050b5..9ac152ce 100644 --- a/config/source/file/watcher.go +++ b/config/source/file/watcher.go @@ -6,7 +6,7 @@ import ( "os" "github.com/fsnotify/fsnotify" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type watcher struct { diff --git a/config/source/file/watcher_linux.go b/config/source/file/watcher_linux.go index 4f8be6da..f4835c5b 100644 --- a/config/source/file/watcher_linux.go +++ b/config/source/file/watcher_linux.go @@ -7,7 +7,7 @@ import ( "reflect" "github.com/fsnotify/fsnotify" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type watcher struct { diff --git a/config/source/flag/flag.go b/config/source/flag/flag.go index 1eef5fc7..3a1ed557 100644 --- a/config/source/flag/flag.go +++ b/config/source/flag/flag.go @@ -4,7 +4,7 @@ import ( "errors" "flag" "github.com/imdario/mergo" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" "strings" "time" ) diff --git a/config/source/flag/options.go b/config/source/flag/options.go index b770d2dd..ee10b322 100644 --- a/config/source/flag/options.go +++ b/config/source/flag/options.go @@ -3,7 +3,7 @@ package flag import ( "context" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type includeUnsetKey struct{} diff --git a/config/source/memory/memory.go b/config/source/memory/memory.go index a48d0e29..0e040938 100644 --- a/config/source/memory/memory.go +++ b/config/source/memory/memory.go @@ -6,7 +6,7 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type memory struct { diff --git a/config/source/memory/options.go b/config/source/memory/options.go index 46f98e05..96c5becd 100644 --- a/config/source/memory/options.go +++ b/config/source/memory/options.go @@ -3,7 +3,7 @@ package memory import ( "context" - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type changeSetKey struct{} diff --git a/config/source/memory/watcher.go b/config/source/memory/watcher.go index c44ff110..725dc049 100644 --- a/config/source/memory/watcher.go +++ b/config/source/memory/watcher.go @@ -1,7 +1,7 @@ package memory import ( - "github.com/micro/go-micro/v3/config/source" + "github.com/unistack-org/micro/v3/config/source" ) type watcher struct { diff --git a/config/source/options.go b/config/source/options.go index 34090b03..bf4b352b 100644 --- a/config/source/options.go +++ b/config/source/options.go @@ -3,9 +3,9 @@ package source import ( "context" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/config/encoder" - "github.com/micro/go-micro/v3/config/encoder/json" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/config/encoder" + "github.com/unistack-org/micro/v3/config/encoder/json" ) type Options struct { diff --git a/config/value.go b/config/value.go index 3cf1a2e4..d74d5753 100644 --- a/config/value.go +++ b/config/value.go @@ -3,7 +3,7 @@ package config import ( "time" - "github.com/micro/go-micro/v3/config/reader" + "github.com/unistack-org/micro/v3/config/reader" ) type value struct{} diff --git a/debug/log/kubernetes/kubernetes.go b/debug/log/kubernetes/kubernetes.go index 5731a2bf..84760edc 100644 --- a/debug/log/kubernetes/kubernetes.go +++ b/debug/log/kubernetes/kubernetes.go @@ -1,4 +1,4 @@ -// Package kubernetes is a logger implementing (github.com/micro/go-micro/v3/debug/log).Log +// Package kubernetes is a logger implementing (github.com/unistack-org/micro/v3/debug/log).Log package kubernetes import ( @@ -10,8 +10,8 @@ import ( "strconv" "time" - "github.com/micro/go-micro/v3/debug/log" - "github.com/micro/go-micro/v3/util/kubernetes/client" + "github.com/unistack-org/micro/v3/debug/log" + "github.com/unistack-org/micro/v3/util/kubernetes/client" ) type klog struct { diff --git a/debug/log/kubernetes/kubernetes_test.go b/debug/log/kubernetes/kubernetes_test.go index 0036a0e9..834283f6 100644 --- a/debug/log/kubernetes/kubernetes_test.go +++ b/debug/log/kubernetes/kubernetes_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/debug/log" + "github.com/unistack-org/micro/v3/debug/log" "github.com/stretchr/testify/assert" ) diff --git a/debug/log/kubernetes/stream.go b/debug/log/kubernetes/stream.go index e82ed6bb..957964ca 100644 --- a/debug/log/kubernetes/stream.go +++ b/debug/log/kubernetes/stream.go @@ -6,7 +6,7 @@ import ( "os" "sync" - "github.com/micro/go-micro/v3/debug/log" + "github.com/unistack-org/micro/v3/debug/log" ) func write(l log.Record) error { diff --git a/debug/log/memory/memory.go b/debug/log/memory/memory.go index 5fba4282..d17e0da9 100644 --- a/debug/log/memory/memory.go +++ b/debug/log/memory/memory.go @@ -4,8 +4,8 @@ package memory import ( "fmt" - "github.com/micro/go-micro/v3/debug/log" - "github.com/micro/go-micro/v3/util/ring" + "github.com/unistack-org/micro/v3/debug/log" + "github.com/unistack-org/micro/v3/util/ring" ) // memoryLog is default micro log diff --git a/debug/log/memory/memory_test.go b/debug/log/memory/memory_test.go index 304c296f..59b010cc 100644 --- a/debug/log/memory/memory_test.go +++ b/debug/log/memory/memory_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/micro/go-micro/v3/debug/log" + "github.com/unistack-org/micro/v3/debug/log" ) func TestLogger(t *testing.T) { diff --git a/debug/log/memory/stream.go b/debug/log/memory/stream.go index cd1d8568..867c8a73 100644 --- a/debug/log/memory/stream.go +++ b/debug/log/memory/stream.go @@ -1,7 +1,7 @@ package memory import ( - "github.com/micro/go-micro/v3/debug/log" + "github.com/unistack-org/micro/v3/debug/log" ) type logStream struct { diff --git a/debug/log/noop/noop.go b/debug/log/noop/noop.go index 1e0d23c4..22801a87 100644 --- a/debug/log/noop/noop.go +++ b/debug/log/noop/noop.go @@ -1,7 +1,7 @@ package noop import ( - "github.com/micro/go-micro/v3/debug/log" + "github.com/unistack-org/micro/v3/debug/log" ) type noop struct{} diff --git a/debug/profile/http/http.go b/debug/profile/http/http.go index 609b045e..3fc98352 100644 --- a/debug/profile/http/http.go +++ b/debug/profile/http/http.go @@ -7,7 +7,7 @@ import ( "net/http/pprof" "sync" - "github.com/micro/go-micro/v3/debug/profile" + "github.com/unistack-org/micro/v3/debug/profile" ) type httpProfile struct { diff --git a/debug/profile/pprof/pprof.go b/debug/profile/pprof/pprof.go index 0bc754cc..5fec1a2b 100644 --- a/debug/profile/pprof/pprof.go +++ b/debug/profile/pprof/pprof.go @@ -9,7 +9,7 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/debug/profile" + "github.com/unistack-org/micro/v3/debug/profile" ) type profiler struct { diff --git a/debug/stats/memory/memory.go b/debug/stats/memory/memory.go index c539ccd0..7c63c7ca 100644 --- a/debug/stats/memory/memory.go +++ b/debug/stats/memory/memory.go @@ -5,8 +5,8 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/debug/stats" - "github.com/micro/go-micro/v3/util/ring" + "github.com/unistack-org/micro/v3/debug/stats" + "github.com/unistack-org/micro/v3/util/ring" ) type memoryStats struct { diff --git a/debug/trace/memory/memory.go b/debug/trace/memory/memory.go index c62d7cf4..0a8524c0 100644 --- a/debug/trace/memory/memory.go +++ b/debug/trace/memory/memory.go @@ -5,8 +5,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/debug/trace" - "github.com/micro/go-micro/v3/util/ring" + "github.com/unistack-org/micro/v3/debug/trace" + "github.com/unistack-org/micro/v3/util/ring" ) type Tracer struct { diff --git a/debug/trace/trace.go b/debug/trace/trace.go index 343701f6..5049bd62 100644 --- a/debug/trace/trace.go +++ b/debug/trace/trace.go @@ -5,7 +5,7 @@ import ( "context" "time" - "github.com/micro/go-micro/v3/metadata" + "github.com/unistack-org/micro/v3/metadata" ) // Tracer is an interface for distributed tracing diff --git a/errors/proto/errors.pb.go b/errors/proto/errors.pb.go index f9f8fc37..f27c061c 100644 --- a/errors/proto/errors.pb.go +++ b/errors/proto/errors.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.11.4 -// source: github.com/micro/go-micro/errors/proto/errors.proto +// protoc-gen-go v1.25.0 +// protoc v3.6.1 +// source: errors/proto/errors.proto package errors @@ -39,7 +39,7 @@ type Error struct { func (x *Error) Reset() { *x = Error{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_errors_proto_errors_proto_msgTypes[0] + mi := &file_errors_proto_errors_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -52,7 +52,7 @@ func (x *Error) String() string { func (*Error) ProtoMessage() {} func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_errors_proto_errors_proto_msgTypes[0] + mi := &file_errors_proto_errors_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -65,7 +65,7 @@ func (x *Error) ProtoReflect() protoreflect.Message { // Deprecated: Use Error.ProtoReflect.Descriptor instead. func (*Error) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescGZIP(), []int{0} + return file_errors_proto_errors_proto_rawDescGZIP(), []int{0} } func (x *Error) GetId() string { @@ -96,39 +96,37 @@ func (x *Error) GetStatus() string { return "" } -var File_github_com_micro_go_micro_errors_proto_errors_proto protoreflect.FileDescriptor +var File_errors_proto_errors_proto protoreflect.FileDescriptor -var file_github_com_micro_go_micro_errors_proto_errors_proto_rawDesc = []byte{ - 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x63, - 0x72, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2f, 0x65, 0x72, 0x72, 0x6f, - 0x72, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x5b, 0x0a, - 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, +var file_errors_proto_errors_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x73, 0x22, 0x5b, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescOnce sync.Once - file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescData = file_github_com_micro_go_micro_errors_proto_errors_proto_rawDesc + file_errors_proto_errors_proto_rawDescOnce sync.Once + file_errors_proto_errors_proto_rawDescData = file_errors_proto_errors_proto_rawDesc ) -func file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescGZIP() []byte { - file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescOnce.Do(func() { - file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescData) +func file_errors_proto_errors_proto_rawDescGZIP() []byte { + file_errors_proto_errors_proto_rawDescOnce.Do(func() { + file_errors_proto_errors_proto_rawDescData = protoimpl.X.CompressGZIP(file_errors_proto_errors_proto_rawDescData) }) - return file_github_com_micro_go_micro_errors_proto_errors_proto_rawDescData + return file_errors_proto_errors_proto_rawDescData } -var file_github_com_micro_go_micro_errors_proto_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_micro_go_micro_errors_proto_errors_proto_goTypes = []interface{}{ +var file_errors_proto_errors_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_errors_proto_errors_proto_goTypes = []interface{}{ (*Error)(nil), // 0: errors.Error } -var file_github_com_micro_go_micro_errors_proto_errors_proto_depIdxs = []int32{ +var file_errors_proto_errors_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -136,13 +134,13 @@ var file_github_com_micro_go_micro_errors_proto_errors_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_github_com_micro_go_micro_errors_proto_errors_proto_init() } -func file_github_com_micro_go_micro_errors_proto_errors_proto_init() { - if File_github_com_micro_go_micro_errors_proto_errors_proto != nil { +func init() { file_errors_proto_errors_proto_init() } +func file_errors_proto_errors_proto_init() { + if File_errors_proto_errors_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_github_com_micro_go_micro_errors_proto_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_errors_proto_errors_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Error); i { case 0: return &v.state @@ -159,18 +157,18 @@ func file_github_com_micro_go_micro_errors_proto_errors_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_micro_go_micro_errors_proto_errors_proto_rawDesc, + RawDescriptor: file_errors_proto_errors_proto_rawDesc, NumEnums: 0, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_github_com_micro_go_micro_errors_proto_errors_proto_goTypes, - DependencyIndexes: file_github_com_micro_go_micro_errors_proto_errors_proto_depIdxs, - MessageInfos: file_github_com_micro_go_micro_errors_proto_errors_proto_msgTypes, + GoTypes: file_errors_proto_errors_proto_goTypes, + DependencyIndexes: file_errors_proto_errors_proto_depIdxs, + MessageInfos: file_errors_proto_errors_proto_msgTypes, }.Build() - File_github_com_micro_go_micro_errors_proto_errors_proto = out.File - file_github_com_micro_go_micro_errors_proto_errors_proto_rawDesc = nil - file_github_com_micro_go_micro_errors_proto_errors_proto_goTypes = nil - file_github_com_micro_go_micro_errors_proto_errors_proto_depIdxs = nil + File_errors_proto_errors_proto = out.File + file_errors_proto_errors_proto_rawDesc = nil + file_errors_proto_errors_proto_goTypes = nil + file_errors_proto_errors_proto_depIdxs = nil } diff --git a/errors/proto/errors.pb.micro.go b/errors/proto/errors.pb.micro.go index 8878a03e..94f2f985 100644 --- a/errors/proto/errors.pb.micro.go +++ b/errors/proto/errors.pb.micro.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-micro. DO NOT EDIT. -// source: github.com/micro/go-micro/errors/proto/errors.proto +// source: errors/proto/errors.proto package errors diff --git a/events/memory/memory.go b/events/memory/memory.go index a67aaa4d..c5c9691a 100644 --- a/events/memory/memory.go +++ b/events/memory/memory.go @@ -7,10 +7,10 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/events" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/store/memory" + "github.com/unistack-org/micro/v3/events" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/store/memory" "github.com/pkg/errors" ) diff --git a/events/memory/memory_test.go b/events/memory/memory_test.go index af6a7da3..69e7605a 100644 --- a/events/memory/memory_test.go +++ b/events/memory/memory_test.go @@ -6,7 +6,7 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/events" + "github.com/unistack-org/micro/v3/events" "github.com/stretchr/testify/assert" ) diff --git a/events/memory/options.go b/events/memory/options.go index 8f9f1cad..1078e00d 100644 --- a/events/memory/options.go +++ b/events/memory/options.go @@ -1,6 +1,6 @@ package memory -import "github.com/micro/go-micro/v3/store" +import "github.com/unistack-org/micro/v3/store" // Options which are used to configure the in-memory stream type Options struct { diff --git a/events/nats/nats.go b/events/nats/nats.go index 5eebbbd8..aca0b538 100644 --- a/events/nats/nats.go +++ b/events/nats/nats.go @@ -10,8 +10,8 @@ import ( stan "github.com/nats-io/stan.go" "github.com/pkg/errors" - "github.com/micro/go-micro/v3/events" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/events" + "github.com/unistack-org/micro/v3/logger" ) const ( diff --git a/events/nats/nats_test.go b/events/nats/nats_test.go index daddd7fc..2122a1b2 100644 --- a/events/nats/nats_test.go +++ b/events/nats/nats_test.go @@ -8,7 +8,7 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/events" + "github.com/unistack-org/micro/v3/events" "github.com/stretchr/testify/assert" ) diff --git a/go.mod b/go.mod index 6e327083..48f91d9c 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,7 @@ -module github.com/micro/go-micro/v3 +module github.com/unistack-org/micro/v3 go 1.13 -replace github.com/imdario/mergo => github.com/imdario/mergo v0.3.8 - require ( github.com/BurntSushi/toml v0.3.1 github.com/bitly/go-simplejson v0.5.0 @@ -55,4 +53,8 @@ require ( gopkg.in/yaml.v2 v2.2.8 // indirect ) -replace google.golang.org/grpc => google.golang.org/grpc v1.26.0 +replace ( + github.com/coreos/etcd => github.com/ozonru/etcd v3.3.20-grpc1.27-origmodule+incompatible + github.com/imdario/mergo => github.com/imdario/mergo v0.3.8 + google.golang.org/grpc => google.golang.org/grpc v1.27.0 +) diff --git a/go.sum b/go.sum index b90c844f..bfecd23b 100644 --- a/go.sum +++ b/go.sum @@ -93,8 +93,6 @@ github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDG github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY= github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.18+incompatible h1:Zz1aXgDrFFi1nadh58tA9ktt06cmPTwNNP3dXwIq1lE= -github.com/coreos/etcd v3.3.18+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= @@ -397,6 +395,8 @@ github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukw github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= +github.com/ozonru/etcd v3.3.20-grpc1.27-origmodule+incompatible h1:CAG0PUvo1fen+ZEfxKJjFIc8GuuN5RuaBuCAuaP2Hno= +github.com/ozonru/etcd v3.3.20-grpc1.27-origmodule+incompatible/go.mod h1:iIubILNIN6Jq9h8uiSLrN9L1tuj3iSSFwz3R61skm/A= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= @@ -681,8 +681,8 @@ google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1 h1:aQktFqmDE2yjveX google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/logger/default.go b/logger/default.go index 6c96b5db..f51140ce 100644 --- a/logger/default.go +++ b/logger/default.go @@ -10,7 +10,7 @@ import ( "sync" "time" - dlog "github.com/micro/go-micro/v3/debug/log" + dlog "github.com/unistack-org/micro/v3/debug/log" ) func init() { diff --git a/metrics/noop/reporter.go b/metrics/noop/reporter.go index 4cf36884..9c5b4b97 100644 --- a/metrics/noop/reporter.go +++ b/metrics/noop/reporter.go @@ -3,8 +3,8 @@ package noop import ( "time" - log "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metrics" + log "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metrics" ) // Reporter is an implementation of metrics.Reporter: diff --git a/metrics/noop/reporter_test.go b/metrics/noop/reporter_test.go index f4c34ba0..08b92d6e 100644 --- a/metrics/noop/reporter_test.go +++ b/metrics/noop/reporter_test.go @@ -3,7 +3,7 @@ package noop import ( "testing" - "github.com/micro/go-micro/v3/metrics" + "github.com/unistack-org/micro/v3/metrics" "github.com/stretchr/testify/assert" ) diff --git a/metrics/prometheus/metrics.go b/metrics/prometheus/metrics.go index 32af323b..5954924e 100644 --- a/metrics/prometheus/metrics.go +++ b/metrics/prometheus/metrics.go @@ -4,7 +4,7 @@ import ( "errors" "time" - "github.com/micro/go-micro/v3/metrics" + "github.com/unistack-org/micro/v3/metrics" ) // ErrPrometheusPanic is a catch-all for the panics which can be thrown by the Prometheus client: diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go index 79614ab7..dc0f5470 100644 --- a/metrics/prometheus/reporter.go +++ b/metrics/prometheus/reporter.go @@ -4,8 +4,8 @@ import ( "net/http" "strings" - log "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metrics" + log "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metrics" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) diff --git a/metrics/prometheus/reporter_test.go b/metrics/prometheus/reporter_test.go index 4b7f87a9..e65177c5 100644 --- a/metrics/prometheus/reporter_test.go +++ b/metrics/prometheus/reporter_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/metrics" + "github.com/unistack-org/micro/v3/metrics" "github.com/stretchr/testify/assert" ) diff --git a/metrics/wrapper/metrics_wrapper.go b/metrics/wrapper/metrics_wrapper.go index 570775db..2d10fad2 100644 --- a/metrics/wrapper/metrics_wrapper.go +++ b/metrics/wrapper/metrics_wrapper.go @@ -5,8 +5,8 @@ import ( "context" - "github.com/micro/go-micro/v3/metrics" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/metrics" + "github.com/unistack-org/micro/v3/server" ) // Wrapper provides a HandlerFunc for metrics.Reporter implementations: diff --git a/model/model.go b/model/model.go index 57b17b1e..a6edbe9e 100644 --- a/model/model.go +++ b/model/model.go @@ -2,9 +2,9 @@ package model import ( - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/sync" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/sync" ) // Model provides an interface for data modelling diff --git a/model/mud/entity.go b/model/mud/entity.go index 8b286ecd..111fd7ca 100644 --- a/model/mud/entity.go +++ b/model/mud/entity.go @@ -2,8 +2,8 @@ package mud import ( "github.com/google/uuid" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/model" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/model" ) type mudEntity struct { diff --git a/model/mud/mud.go b/model/mud/mud.go index 46060df6..efb064a1 100644 --- a/model/mud/mud.go +++ b/model/mud/mud.go @@ -2,11 +2,11 @@ package mud import ( - "github.com/micro/go-micro/v3/codec/json" - "github.com/micro/go-micro/v3/model" - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/store/memory" - memsync "github.com/micro/go-micro/v3/sync/memory" + "github.com/unistack-org/micro/v3/codec/json" + "github.com/unistack-org/micro/v3/model" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/store/memory" + memsync "github.com/unistack-org/micro/v3/sync/memory" ) type mudModel struct { diff --git a/network/mucp/mucp.go b/network/mucp/mucp.go index 50723ea4..11782203 100644 --- a/network/mucp/mucp.go +++ b/network/mucp/mucp.go @@ -11,22 +11,22 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/client" - cmucp "github.com/micro/go-micro/v3/client/mucp" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/network" - pb "github.com/micro/go-micro/v3/network/mucp/proto" - "github.com/micro/go-micro/v3/proxy" - "github.com/micro/go-micro/v3/registry/noop" - "github.com/micro/go-micro/v3/resolver/dns" - "github.com/micro/go-micro/v3/router" - "github.com/micro/go-micro/v3/server" - smucp "github.com/micro/go-micro/v3/server/mucp" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" - bun "github.com/micro/go-micro/v3/tunnel/broker" - tun "github.com/micro/go-micro/v3/tunnel/transport" - "github.com/micro/go-micro/v3/util/backoff" + "github.com/unistack-org/micro/v3/client" + cmucp "github.com/unistack-org/micro/v3/client/mucp" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/network" + pb "github.com/unistack-org/micro/v3/network/mucp/proto" + "github.com/unistack-org/micro/v3/proxy" + "github.com/unistack-org/micro/v3/registry/noop" + "github.com/unistack-org/micro/v3/resolver/dns" + "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/server" + smucp "github.com/unistack-org/micro/v3/server/mucp" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" + bun "github.com/unistack-org/micro/v3/tunnel/broker" + tun "github.com/unistack-org/micro/v3/tunnel/transport" + "github.com/unistack-org/micro/v3/util/backoff" ) var ( diff --git a/network/mucp/node.go b/network/mucp/node.go index 0231dfc7..19a22179 100644 --- a/network/mucp/node.go +++ b/network/mucp/node.go @@ -6,8 +6,8 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/network" - pb "github.com/micro/go-micro/v3/network/mucp/proto" + "github.com/unistack-org/micro/v3/network" + pb "github.com/unistack-org/micro/v3/network/mucp/proto" ) // nodeError tracks node errors diff --git a/network/mucp/node_test.go b/network/mucp/node_test.go index 3b805e34..21c1a5a3 100644 --- a/network/mucp/node_test.go +++ b/network/mucp/node_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/network" - pb "github.com/micro/go-micro/v3/network/mucp/proto" + "github.com/unistack-org/micro/v3/network" + pb "github.com/unistack-org/micro/v3/network/mucp/proto" ) var ( diff --git a/network/mucp/proto/network.pb.go b/network/mucp/proto/network.pb.go index 2d3cba5c..de78d9d6 100644 --- a/network/mucp/proto/network.pb.go +++ b/network/mucp/proto/network.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.11.4 -// source: github.com/micro/go-micro/network/mucp/proto/network.proto +// protoc-gen-go v1.25.0 +// protoc v3.6.1 +// source: network/mucp/proto/network.proto package go_micro_network_mucp @@ -56,11 +56,11 @@ func (x AdvertType) String() string { } func (AdvertType) Descriptor() protoreflect.EnumDescriptor { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_enumTypes[0].Descriptor() + return file_network_mucp_proto_network_proto_enumTypes[0].Descriptor() } func (AdvertType) Type() protoreflect.EnumType { - return &file_github_com_micro_go_micro_network_mucp_proto_network_proto_enumTypes[0] + return &file_network_mucp_proto_network_proto_enumTypes[0] } func (x AdvertType) Number() protoreflect.EnumNumber { @@ -69,7 +69,7 @@ func (x AdvertType) Number() protoreflect.EnumNumber { // Deprecated: Use AdvertType.Descriptor instead. func (AdvertType) EnumDescriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{0} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{0} } // EventType defines the type of event @@ -106,11 +106,11 @@ func (x EventType) String() string { } func (EventType) Descriptor() protoreflect.EnumDescriptor { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_enumTypes[1].Descriptor() + return file_network_mucp_proto_network_proto_enumTypes[1].Descriptor() } func (EventType) Type() protoreflect.EnumType { - return &file_github_com_micro_go_micro_network_mucp_proto_network_proto_enumTypes[1] + return &file_network_mucp_proto_network_proto_enumTypes[1] } func (x EventType) Number() protoreflect.EnumNumber { @@ -119,7 +119,7 @@ func (x EventType) Number() protoreflect.EnumNumber { // Deprecated: Use EventType.Descriptor instead. func (EventType) EnumDescriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{1} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{1} } // Advert is router advertsement streamed by Watch @@ -143,7 +143,7 @@ type Advert struct { func (x *Advert) Reset() { *x = Advert{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[0] + mi := &file_network_mucp_proto_network_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -156,7 +156,7 @@ func (x *Advert) String() string { func (*Advert) ProtoMessage() {} func (x *Advert) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[0] + mi := &file_network_mucp_proto_network_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -169,7 +169,7 @@ func (x *Advert) ProtoReflect() protoreflect.Message { // Deprecated: Use Advert.ProtoReflect.Descriptor instead. func (*Advert) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{0} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{0} } func (x *Advert) GetId() string { @@ -226,7 +226,7 @@ type Event struct { func (x *Event) Reset() { *x = Event{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[1] + mi := &file_network_mucp_proto_network_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -239,7 +239,7 @@ func (x *Event) String() string { func (*Event) ProtoMessage() {} func (x *Event) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[1] + mi := &file_network_mucp_proto_network_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -252,7 +252,7 @@ func (x *Event) ProtoReflect() protoreflect.Message { // Deprecated: Use Event.ProtoReflect.Descriptor instead. func (*Event) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{1} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{1} } func (x *Event) GetId() string { @@ -310,7 +310,7 @@ type Route struct { func (x *Route) Reset() { *x = Route{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[2] + mi := &file_network_mucp_proto_network_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -323,7 +323,7 @@ func (x *Route) String() string { func (*Route) ProtoMessage() {} func (x *Route) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[2] + mi := &file_network_mucp_proto_network_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -336,7 +336,7 @@ func (x *Route) ProtoReflect() protoreflect.Message { // Deprecated: Use Route.ProtoReflect.Descriptor instead. func (*Route) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{2} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{2} } func (x *Route) GetService() string { @@ -408,7 +408,7 @@ type Error struct { func (x *Error) Reset() { *x = Error{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[3] + mi := &file_network_mucp_proto_network_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -421,7 +421,7 @@ func (x *Error) String() string { func (*Error) ProtoMessage() {} func (x *Error) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[3] + mi := &file_network_mucp_proto_network_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -434,7 +434,7 @@ func (x *Error) ProtoReflect() protoreflect.Message { // Deprecated: Use Error.ProtoReflect.Descriptor instead. func (*Error) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{3} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{3} } func (x *Error) GetCount() uint32 { @@ -463,7 +463,7 @@ type Status struct { func (x *Status) Reset() { *x = Status{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[4] + mi := &file_network_mucp_proto_network_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -476,7 +476,7 @@ func (x *Status) String() string { func (*Status) ProtoMessage() {} func (x *Status) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[4] + mi := &file_network_mucp_proto_network_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -489,7 +489,7 @@ func (x *Status) ProtoReflect() protoreflect.Message { // Deprecated: Use Status.ProtoReflect.Descriptor instead. func (*Status) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{4} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{4} } func (x *Status) GetError() *Error { @@ -520,7 +520,7 @@ type Node struct { func (x *Node) Reset() { *x = Node{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[5] + mi := &file_network_mucp_proto_network_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -533,7 +533,7 @@ func (x *Node) String() string { func (*Node) ProtoMessage() {} func (x *Node) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[5] + mi := &file_network_mucp_proto_network_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -546,7 +546,7 @@ func (x *Node) ProtoReflect() protoreflect.Message { // Deprecated: Use Node.ProtoReflect.Descriptor instead. func (*Node) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{5} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{5} } func (x *Node) GetId() string { @@ -597,7 +597,7 @@ type Connect struct { func (x *Connect) Reset() { *x = Connect{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[6] + mi := &file_network_mucp_proto_network_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -610,7 +610,7 @@ func (x *Connect) String() string { func (*Connect) ProtoMessage() {} func (x *Connect) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[6] + mi := &file_network_mucp_proto_network_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -623,7 +623,7 @@ func (x *Connect) ProtoReflect() protoreflect.Message { // Deprecated: Use Connect.ProtoReflect.Descriptor instead. func (*Connect) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{6} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{6} } func (x *Connect) GetNode() *Node { @@ -646,7 +646,7 @@ type Close struct { func (x *Close) Reset() { *x = Close{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[7] + mi := &file_network_mucp_proto_network_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -659,7 +659,7 @@ func (x *Close) String() string { func (*Close) ProtoMessage() {} func (x *Close) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[7] + mi := &file_network_mucp_proto_network_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -672,7 +672,7 @@ func (x *Close) ProtoReflect() protoreflect.Message { // Deprecated: Use Close.ProtoReflect.Descriptor instead. func (*Close) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{7} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{7} } func (x *Close) GetNode() *Node { @@ -697,7 +697,7 @@ type Peer struct { func (x *Peer) Reset() { *x = Peer{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[8] + mi := &file_network_mucp_proto_network_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -710,7 +710,7 @@ func (x *Peer) String() string { func (*Peer) ProtoMessage() {} func (x *Peer) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[8] + mi := &file_network_mucp_proto_network_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -723,7 +723,7 @@ func (x *Peer) ProtoReflect() protoreflect.Message { // Deprecated: Use Peer.ProtoReflect.Descriptor instead. func (*Peer) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{8} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{8} } func (x *Peer) GetNode() *Node { @@ -755,7 +755,7 @@ type Sync struct { func (x *Sync) Reset() { *x = Sync{} if protoimpl.UnsafeEnabled { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[9] + mi := &file_network_mucp_proto_network_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -768,7 +768,7 @@ func (x *Sync) String() string { func (*Sync) ProtoMessage() {} func (x *Sync) ProtoReflect() protoreflect.Message { - mi := &file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[9] + mi := &file_network_mucp_proto_network_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -781,7 +781,7 @@ func (x *Sync) ProtoReflect() protoreflect.Message { // Deprecated: Use Sync.ProtoReflect.Descriptor instead. func (*Sync) Descriptor() ([]byte, []int) { - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP(), []int{9} + return file_network_mucp_proto_network_proto_rawDescGZIP(), []int{9} } func (x *Sync) GetPeer() *Peer { @@ -798,124 +798,123 @@ func (x *Sync) GetRoutes() []*Route { return nil } -var File_github_com_micro_go_micro_network_mucp_proto_network_proto protoreflect.FileDescriptor +var File_network_mucp_proto_network_proto protoreflect.FileDescriptor -var file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDesc = []byte{ - 0x0a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69, 0x63, - 0x72, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2f, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x2f, 0x6d, 0x75, 0x63, 0x70, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x15, 0x67, 0x6f, - 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, - 0x75, 0x63, 0x70, 0x22, 0xb5, 0x01, 0x0a, 0x06, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, - 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, - 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x34, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, - 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x05, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x34, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x45, 0x76, 0x65, 0x6e, +var file_network_mucp_proto_network_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x6d, 0x75, 0x63, 0x70, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x15, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x22, 0xb5, 0x01, 0x0a, 0x06, 0x41, 0x64, + 0x76, 0x65, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x32, 0x0a, 0x05, 0x72, 0x6f, 0x75, - 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, - 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, - 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x22, 0xb8, 0x02, - 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, - 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x12, 0x46, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, - 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2f, 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x85, 0x02, 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, - 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x4e, - 0x6f, 0x64, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x35, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x74, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x74, 0x74, 0x6c, 0x12, 0x34, 0x0a, 0x06, 0x65, + 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, - 0x75, 0x63, 0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0x3a, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x6e, 0x6f, + 0x75, 0x63, 0x70, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x22, 0x9f, 0x01, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x34, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, + 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, + 0x70, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x32, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x05, 0x72, 0x6f, + 0x75, 0x74, 0x65, 0x22, 0xb8, 0x02, 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, + 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, + 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x46, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x67, 0x6f, + 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, + 0x75, 0x63, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2f, + 0x0a, 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, + 0x3c, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x05, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, + 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x85, 0x02, + 0x0a, 0x04, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x45, 0x0a, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x67, + 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, + 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3a, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 0x12, 0x2f, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, + 0x65, 0x22, 0x38, 0x0a, 0x05, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x38, 0x0a, 0x05, 0x43, - 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, - 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x6a, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x2f, 0x0a, - 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, - 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, - 0x75, 0x63, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x31, - 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x6a, 0x0a, 0x04, 0x50, + 0x65, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, + 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x50, 0x65, 0x65, 0x72, + 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x6d, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, + 0x2f, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x22, 0x6d, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x2f, 0x0a, 0x04, 0x70, 0x65, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, - 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x06, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, - 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, - 0x63, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, - 0x2a, 0x32, 0x0a, 0x0a, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, - 0x0a, 0x0e, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x41, 0x6e, 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, - 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x10, 0x01, 0x2a, 0x2f, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, - 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, + 0x12, 0x34, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2e, 0x6d, 0x75, 0x63, 0x70, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x06, + 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x2a, 0x32, 0x0a, 0x0a, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x41, 0x64, 0x76, 0x65, 0x72, 0x74, 0x41, 0x6e, + 0x6e, 0x6f, 0x75, 0x6e, 0x63, 0x65, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x64, 0x76, 0x65, + 0x72, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x01, 0x2a, 0x2f, 0x0a, 0x09, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescOnce sync.Once - file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescData = file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDesc + file_network_mucp_proto_network_proto_rawDescOnce sync.Once + file_network_mucp_proto_network_proto_rawDescData = file_network_mucp_proto_network_proto_rawDesc ) -func file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescGZIP() []byte { - file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescOnce.Do(func() { - file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescData) +func file_network_mucp_proto_network_proto_rawDescGZIP() []byte { + file_network_mucp_proto_network_proto_rawDescOnce.Do(func() { + file_network_mucp_proto_network_proto_rawDescData = protoimpl.X.CompressGZIP(file_network_mucp_proto_network_proto_rawDescData) }) - return file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDescData + return file_network_mucp_proto_network_proto_rawDescData } -var file_github_com_micro_go_micro_network_mucp_proto_network_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_github_com_micro_go_micro_network_mucp_proto_network_proto_goTypes = []interface{}{ +var file_network_mucp_proto_network_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_network_mucp_proto_network_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_network_mucp_proto_network_proto_goTypes = []interface{}{ (AdvertType)(0), // 0: go.micro.network.mucp.AdvertType (EventType)(0), // 1: go.micro.network.mucp.EventType (*Advert)(nil), // 2: go.micro.network.mucp.Advert @@ -931,7 +930,7 @@ var file_github_com_micro_go_micro_network_mucp_proto_network_proto_goTypes = [] nil, // 12: go.micro.network.mucp.Route.MetadataEntry nil, // 13: go.micro.network.mucp.Node.MetadataEntry } -var file_github_com_micro_go_micro_network_mucp_proto_network_proto_depIdxs = []int32{ +var file_network_mucp_proto_network_proto_depIdxs = []int32{ 0, // 0: go.micro.network.mucp.Advert.type:type_name -> go.micro.network.mucp.AdvertType 3, // 1: go.micro.network.mucp.Advert.events:type_name -> go.micro.network.mucp.Event 1, // 2: go.micro.network.mucp.Event.type:type_name -> go.micro.network.mucp.EventType @@ -953,13 +952,13 @@ var file_github_com_micro_go_micro_network_mucp_proto_network_proto_depIdxs = [] 0, // [0:14] is the sub-list for field type_name } -func init() { file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() } -func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { - if File_github_com_micro_go_micro_network_mucp_proto_network_proto != nil { +func init() { file_network_mucp_proto_network_proto_init() } +func file_network_mucp_proto_network_proto_init() { + if File_network_mucp_proto_network_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Advert); i { case 0: return &v.state @@ -971,7 +970,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Event); i { case 0: return &v.state @@ -983,7 +982,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Route); i { case 0: return &v.state @@ -995,7 +994,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Error); i { case 0: return &v.state @@ -1007,7 +1006,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Status); i { case 0: return &v.state @@ -1019,7 +1018,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Node); i { case 0: return &v.state @@ -1031,7 +1030,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Connect); i { case 0: return &v.state @@ -1043,7 +1042,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Close); i { case 0: return &v.state @@ -1055,7 +1054,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Peer); i { case 0: return &v.state @@ -1067,7 +1066,7 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { return nil } } - file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + file_network_mucp_proto_network_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Sync); i { case 0: return &v.state @@ -1084,19 +1083,19 @@ func file_github_com_micro_go_micro_network_mucp_proto_network_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDesc, + RawDescriptor: file_network_mucp_proto_network_proto_rawDesc, NumEnums: 2, NumMessages: 12, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_github_com_micro_go_micro_network_mucp_proto_network_proto_goTypes, - DependencyIndexes: file_github_com_micro_go_micro_network_mucp_proto_network_proto_depIdxs, - EnumInfos: file_github_com_micro_go_micro_network_mucp_proto_network_proto_enumTypes, - MessageInfos: file_github_com_micro_go_micro_network_mucp_proto_network_proto_msgTypes, + GoTypes: file_network_mucp_proto_network_proto_goTypes, + DependencyIndexes: file_network_mucp_proto_network_proto_depIdxs, + EnumInfos: file_network_mucp_proto_network_proto_enumTypes, + MessageInfos: file_network_mucp_proto_network_proto_msgTypes, }.Build() - File_github_com_micro_go_micro_network_mucp_proto_network_proto = out.File - file_github_com_micro_go_micro_network_mucp_proto_network_proto_rawDesc = nil - file_github_com_micro_go_micro_network_mucp_proto_network_proto_goTypes = nil - file_github_com_micro_go_micro_network_mucp_proto_network_proto_depIdxs = nil + File_network_mucp_proto_network_proto = out.File + file_network_mucp_proto_network_proto_rawDesc = nil + file_network_mucp_proto_network_proto_goTypes = nil + file_network_mucp_proto_network_proto_depIdxs = nil } diff --git a/network/mucp/proto/network.pb.micro.go b/network/mucp/proto/network.pb.micro.go index efe35670..e435bd8e 100644 --- a/network/mucp/proto/network.pb.micro.go +++ b/network/mucp/proto/network.pb.micro.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-micro. DO NOT EDIT. -// source: github.com/micro/go-micro/network/mucp/proto/network.proto +// source: network/mucp/proto/network.proto package go_micro_network_mucp diff --git a/network/network.go b/network/network.go index 054d3745..0da07169 100644 --- a/network/network.go +++ b/network/network.go @@ -2,8 +2,8 @@ package network import ( - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/server" ) // Error is network node errors diff --git a/network/options.go b/network/options.go index 75d49589..aad1d2f1 100644 --- a/network/options.go +++ b/network/options.go @@ -2,12 +2,12 @@ package network import ( "github.com/google/uuid" - "github.com/micro/go-micro/v3/proxy" - "github.com/micro/go-micro/v3/proxy/mucp" - "github.com/micro/go-micro/v3/router" - regRouter "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/tunnel" - tmucp "github.com/micro/go-micro/v3/tunnel/mucp" + "github.com/unistack-org/micro/v3/proxy" + "github.com/unistack-org/micro/v3/proxy/mucp" + "github.com/unistack-org/micro/v3/router" + regRouter "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/tunnel" + tmucp "github.com/unistack-org/micro/v3/tunnel/mucp" ) type Option func(*Options) diff --git a/plugin/default.go b/plugin/default.go deleted file mode 100644 index 181dace2..00000000 --- a/plugin/default.go +++ /dev/null @@ -1,72 +0,0 @@ -// Package plugin provides the ability to load plugins -package plugin - -import ( - "errors" - "fmt" - "os" - "os/exec" - "path/filepath" - pg "plugin" - "strings" - "text/template" -) - -type plugin struct{} - -// Load loads a plugin created with `go build -buildmode=plugin` -func (p *plugin) Load(path string) (*Config, error) { - plugin, err := pg.Open(path) - if err != nil { - return nil, err - } - s, err := plugin.Lookup("Plugin") - if err != nil { - return nil, err - } - pl, ok := s.(*Config) - if !ok { - return nil, errors.New("could not cast Plugin object") - } - return pl, nil -} - -// Generate creates a go file at the specified path. -// You must use `go build -buildmode=plugin`to build it. -func (p *plugin) Generate(path string, c *Config) error { - f, err := os.Create(path) - if err != nil { - return err - } - defer f.Close() - t, err := template.New(c.Name).Parse(tmpl) - if err != nil { - return err - } - return t.Execute(f, c) -} - -// Build generates a dso plugin using the go command `go build -buildmode=plugin` -func (p *plugin) Build(path string, c *Config) error { - path = strings.TrimSuffix(path, ".so") - - // create go file in tmp path - temp := os.TempDir() - base := filepath.Base(path) - goFile := filepath.Join(temp, base+".go") - - // generate .go file - if err := p.Generate(goFile, c); err != nil { - return err - } - // remove .go file - defer os.Remove(goFile) - - if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil && !os.IsExist(err) { - return fmt.Errorf("Failed to create dir %s: %v", filepath.Dir(path), err) - } - cmd := exec.Command("go", "build", "-buildmode=plugin", "-o", path+".so", goFile) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - return cmd.Run() -} diff --git a/plugin/plugin.go b/plugin/plugin.go deleted file mode 100644 index b982085a..00000000 --- a/plugin/plugin.go +++ /dev/null @@ -1,40 +0,0 @@ -// Package plugin provides the ability to load plugins -package plugin - -// Plugin is a plugin loaded from a file -type Plugin interface { - // Load loads a .so plugin at the given path - Load(path string) (*Config, error) - // Build a .so plugin with config at the path specified - Build(path string, c *Config) error -} - -// Config is the plugin config -type Config struct { - // Name of the plugin e.g rabbitmq - Name string - // Type of the plugin e.g broker - Type string - // Path specifies the import path - Path string - // NewFunc creates an instance of the plugin - NewFunc interface{} -} - -var ( - // Default plugin loader - DefaultPlugin = NewPlugin() -) - -// NewPlugin creates a new plugin interface -func NewPlugin() Plugin { - return &plugin{} -} - -func Build(path string, c *Config) error { - return DefaultPlugin.Build(path, c) -} - -func Load(path string) (*Config, error) { - return DefaultPlugin.Load(path) -} diff --git a/plugin/template.go b/plugin/template.go deleted file mode 100644 index 5f8035e2..00000000 --- a/plugin/template.go +++ /dev/null @@ -1,20 +0,0 @@ -package plugin - -var ( - tmpl = ` -package main - -import ( - "github.com/micro/go-micro/v3/plugin" - - "{{.Path}}" -) - -var Plugin = plugin.Config{ - Name: "{{.Name}}", - Type: "{{.Type}}", - Path: "{{.Path}}", - NewFunc: {{.Name}}.{{.NewFunc}}, -} -` -) diff --git a/proxy/grpc/grpc.go b/proxy/grpc/grpc.go index 511b0a92..ea278cd2 100644 --- a/proxy/grpc/grpc.go +++ b/proxy/grpc/grpc.go @@ -6,14 +6,14 @@ import ( "io" "strings" - "github.com/micro/go-micro/v3/client" - grpcc "github.com/micro/go-micro/v3/client/grpc" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/proxy" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/client" + grpcc "github.com/unistack-org/micro/v3/client/grpc" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/proxy" + "github.com/unistack-org/micro/v3/server" "google.golang.org/grpc" ) diff --git a/proxy/http/http.go b/proxy/http/http.go index 122134fd..78fdb2b6 100644 --- a/proxy/http/http.go +++ b/proxy/http/http.go @@ -10,9 +10,9 @@ import ( "net/url" "path" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/proxy" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/proxy" + "github.com/unistack-org/micro/v3/server" ) // Proxy will proxy rpc requests as http POST requests. It is a server.Proxy diff --git a/proxy/http/http_test.go b/proxy/http/http_test.go index 8821856b..fef5da68 100644 --- a/proxy/http/http_test.go +++ b/proxy/http/http_test.go @@ -7,13 +7,13 @@ import ( "net/http" "testing" - "github.com/micro/go-micro/v3/client" - cmucp "github.com/micro/go-micro/v3/client/mucp" - "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" - "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/server" - "github.com/micro/go-micro/v3/server/mucp" + "github.com/unistack-org/micro/v3/client" + cmucp "github.com/unistack-org/micro/v3/client/mucp" + "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/server" + "github.com/unistack-org/micro/v3/server/mucp" ) type testHandler struct{} diff --git a/proxy/mucp/mucp.go b/proxy/mucp/mucp.go index 405c637a..8d4e5197 100644 --- a/proxy/mucp/mucp.go +++ b/proxy/mucp/mucp.go @@ -10,19 +10,19 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/client" - grpcc "github.com/micro/go-micro/v3/client/grpc" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/proxy" - "github.com/micro/go-micro/v3/router" - "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/selector" - "github.com/micro/go-micro/v3/selector/roundrobin" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/client" + grpcc "github.com/unistack-org/micro/v3/client/grpc" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/proxy" + "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/selector" + "github.com/unistack-org/micro/v3/selector/roundrobin" + "github.com/unistack-org/micro/v3/server" "google.golang.org/grpc" ) diff --git a/proxy/options.go b/proxy/options.go index ad1a3ef4..59893902 100644 --- a/proxy/options.go +++ b/proxy/options.go @@ -2,8 +2,8 @@ package proxy import ( - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/router" ) type Options struct { diff --git a/proxy/proxy.go b/proxy/proxy.go index 167b1a81..05204a4f 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -4,7 +4,7 @@ package proxy import ( "context" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/server" ) // Proxy can be used as a proxy server for go-micro services diff --git a/registry/cache/cache.go b/registry/cache/cache.go index 5cc432f6..d88b10dd 100644 --- a/registry/cache/cache.go +++ b/registry/cache/cache.go @@ -7,9 +7,9 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/registry" - util "github.com/micro/go-micro/v3/util/registry" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/registry" + util "github.com/unistack-org/micro/v3/util/registry" ) // Cache is the registry cache interface diff --git a/registry/etcd/etcd.go b/registry/etcd/etcd.go index 207a6a07..4191e0d9 100644 --- a/registry/etcd/etcd.go +++ b/registry/etcd/etcd.go @@ -16,8 +16,8 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes" "github.com/coreos/etcd/mvcc/mvccpb" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/registry" hash "github.com/mitchellh/hashstructure" "go.uber.org/zap" ) diff --git a/registry/etcd/options.go b/registry/etcd/options.go index f444c884..c2833804 100644 --- a/registry/etcd/options.go +++ b/registry/etcd/options.go @@ -3,7 +3,7 @@ package etcd import ( "context" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" "go.uber.org/zap" ) diff --git a/registry/etcd/watcher.go b/registry/etcd/watcher.go index ff1c6065..72c466bb 100644 --- a/registry/etcd/watcher.go +++ b/registry/etcd/watcher.go @@ -7,7 +7,7 @@ import ( "time" "github.com/coreos/etcd/clientv3" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type etcdWatcher struct { diff --git a/registry/mdns/mdns.go b/registry/mdns/mdns.go index cb6f48fd..6d7b42af 100644 --- a/registry/mdns/mdns.go +++ b/registry/mdns/mdns.go @@ -15,9 +15,9 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/util/mdns" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/util/mdns" ) const ( diff --git a/registry/mdns/mdns_test.go b/registry/mdns/mdns_test.go index 7e3d4c1a..ec5a5c33 100644 --- a/registry/mdns/mdns_test.go +++ b/registry/mdns/mdns_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func TestMDNS(t *testing.T) { diff --git a/registry/mdns/options.go b/registry/mdns/options.go index 0de2d3bb..bc8e6f90 100644 --- a/registry/mdns/options.go +++ b/registry/mdns/options.go @@ -4,7 +4,7 @@ package mdns import ( "context" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) // Domain sets the mdnsDomain diff --git a/registry/memory/memory.go b/registry/memory/memory.go index 91e3c7a4..86ecd0a2 100644 --- a/registry/memory/memory.go +++ b/registry/memory/memory.go @@ -7,8 +7,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/registry" ) var ( diff --git a/registry/memory/memory_test.go b/registry/memory/memory_test.go index ee17634f..77f27e47 100644 --- a/registry/memory/memory_test.go +++ b/registry/memory/memory_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) var ( diff --git a/registry/memory/options.go b/registry/memory/options.go index f9027632..defb1e74 100644 --- a/registry/memory/options.go +++ b/registry/memory/options.go @@ -3,7 +3,7 @@ package memory import ( "context" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type servicesKey struct{} diff --git a/registry/memory/util.go b/registry/memory/util.go index 82c02762..0ee33bb0 100644 --- a/registry/memory/util.go +++ b/registry/memory/util.go @@ -3,7 +3,7 @@ package memory import ( "time" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func serviceToRecord(s *registry.Service, ttl time.Duration) *record { diff --git a/registry/memory/watcher.go b/registry/memory/watcher.go index 328a4bed..28202ba2 100644 --- a/registry/memory/watcher.go +++ b/registry/memory/watcher.go @@ -3,7 +3,7 @@ package memory import ( "errors" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type Watcher struct { diff --git a/registry/memory/watcher_test.go b/registry/memory/watcher_test.go index 0180a94c..d5120ebe 100644 --- a/registry/memory/watcher_test.go +++ b/registry/memory/watcher_test.go @@ -3,7 +3,7 @@ package memory import ( "testing" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func TestWatcher(t *testing.T) { diff --git a/registry/noop/noop.go b/registry/noop/noop.go index 0dd9f65e..41279483 100644 --- a/registry/noop/noop.go +++ b/registry/noop/noop.go @@ -4,7 +4,7 @@ package noop import ( "errors" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type noopRegistry struct{} diff --git a/resolver/dns/dns.go b/resolver/dns/dns.go index b85e7ec6..9409263e 100644 --- a/resolver/dns/dns.go +++ b/resolver/dns/dns.go @@ -5,7 +5,7 @@ import ( "context" "net" - "github.com/micro/go-micro/v3/resolver" + "github.com/unistack-org/micro/v3/resolver" "github.com/miekg/dns" ) diff --git a/resolver/dnssrv/dnssrv.go b/resolver/dnssrv/dnssrv.go index 0088b422..28247edb 100644 --- a/resolver/dnssrv/dnssrv.go +++ b/resolver/dnssrv/dnssrv.go @@ -5,7 +5,7 @@ import ( "fmt" "net" - "github.com/micro/go-micro/v3/resolver" + "github.com/unistack-org/micro/v3/resolver" ) // Resolver is a DNS network resolve diff --git a/resolver/http/http.go b/resolver/http/http.go index aff41f09..cf9038c0 100644 --- a/resolver/http/http.go +++ b/resolver/http/http.go @@ -8,7 +8,7 @@ import ( "net/http" "net/url" - "github.com/micro/go-micro/v3/resolver" + "github.com/unistack-org/micro/v3/resolver" ) // Resolver is a HTTP network resolver diff --git a/resolver/noop/noop.go b/resolver/noop/noop.go index 85643bf6..0f4004c4 100644 --- a/resolver/noop/noop.go +++ b/resolver/noop/noop.go @@ -2,7 +2,7 @@ package noop import ( - "github.com/micro/go-micro/v3/resolver" + "github.com/unistack-org/micro/v3/resolver" ) type Resolver struct{} diff --git a/resolver/registry/registry.go b/resolver/registry/registry.go index 4f54b072..ca9dba79 100644 --- a/resolver/registry/registry.go +++ b/resolver/registry/registry.go @@ -2,9 +2,9 @@ package registry import ( - "github.com/micro/go-micro/v3/resolver" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/resolver" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/mdns" ) // Resolver is a registry network resolver diff --git a/resolver/static/static.go b/resolver/static/static.go index 56d737ce..91fc6b0e 100644 --- a/resolver/static/static.go +++ b/resolver/static/static.go @@ -2,7 +2,7 @@ package static import ( - "github.com/micro/go-micro/v3/resolver" + "github.com/unistack-org/micro/v3/resolver" ) // Resolver returns a static list of nodes. In the event the node list diff --git a/router/dns/dns.go b/router/dns/dns.go index dfbd7b40..21a8ecac 100644 --- a/router/dns/dns.go +++ b/router/dns/dns.go @@ -5,7 +5,7 @@ import ( "net" "strconv" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/router" ) // NewRouter returns an initialized dns router diff --git a/router/mdns/mdns.go b/router/mdns/mdns.go index c5812a20..19335e5b 100644 --- a/router/mdns/mdns.go +++ b/router/mdns/mdns.go @@ -7,8 +7,8 @@ import ( "strconv" "time" - "github.com/micro/go-micro/v3/router" - "github.com/micro/go-micro/v3/util/mdns" + "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/util/mdns" ) // NewRouter returns an initialized dns router diff --git a/router/options.go b/router/options.go index 8ea2f1a6..15377c42 100644 --- a/router/options.go +++ b/router/options.go @@ -4,8 +4,8 @@ import ( "context" "github.com/google/uuid" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/mdns" ) // Options are router options diff --git a/router/registry/registry.go b/router/registry/registry.go index e02bc418..3d615726 100644 --- a/router/registry/registry.go +++ b/router/registry/registry.go @@ -6,9 +6,9 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/router" ) var ( diff --git a/router/registry/registry_test.go b/router/registry/registry_test.go index b8886dfb..b74c83a6 100644 --- a/router/registry/registry_test.go +++ b/router/registry/registry_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" ) func routerTestSetup() router.Router { diff --git a/router/registry/table.go b/router/registry/table.go index cefd723c..c16d7682 100644 --- a/router/registry/table.go +++ b/router/registry/table.go @@ -5,8 +5,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/router" ) // table is an in-memory routing table diff --git a/router/registry/table_test.go b/router/registry/table_test.go index 1cb5fc5e..2ca3368c 100644 --- a/router/registry/table_test.go +++ b/router/registry/table_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/router" ) func testSetup() (*table, router.Route) { diff --git a/router/registry/watcher.go b/router/registry/watcher.go index edc94ea1..63e0f43c 100644 --- a/router/registry/watcher.go +++ b/router/registry/watcher.go @@ -3,7 +3,7 @@ package registry import ( "sync" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/router" ) // tableWatcher implements routing table Watcher diff --git a/router/static/static.go b/router/static/static.go index f7822b19..077eab3e 100644 --- a/router/static/static.go +++ b/router/static/static.go @@ -1,7 +1,7 @@ package static import ( - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/router" ) // NewRouter returns an initialized static router diff --git a/runtime/kubernetes/kubernetes.go b/runtime/kubernetes/kubernetes.go index fcb16ca8..1948b2bd 100644 --- a/runtime/kubernetes/kubernetes.go +++ b/runtime/kubernetes/kubernetes.go @@ -8,10 +8,10 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/logger" - log "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/runtime" - "github.com/micro/go-micro/v3/util/kubernetes/client" + "github.com/unistack-org/micro/v3/logger" + log "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/runtime" + "github.com/unistack-org/micro/v3/util/kubernetes/client" ) // action to take on runtime service diff --git a/runtime/kubernetes/logs.go b/runtime/kubernetes/logs.go index b67632a6..5fb6032d 100644 --- a/runtime/kubernetes/logs.go +++ b/runtime/kubernetes/logs.go @@ -9,10 +9,10 @@ import ( "strconv" "time" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/runtime" - "github.com/micro/go-micro/v3/util/kubernetes/client" - "github.com/micro/go-micro/v3/util/log" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/runtime" + "github.com/unistack-org/micro/v3/util/kubernetes/client" + "github.com/unistack-org/micro/v3/util/log" ) type klog struct { diff --git a/runtime/kubernetes/service.go b/runtime/kubernetes/service.go index 508d55f9..d7c1c50e 100644 --- a/runtime/kubernetes/service.go +++ b/runtime/kubernetes/service.go @@ -6,10 +6,10 @@ import ( "strings" "time" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/runtime" - "github.com/micro/go-micro/v3/util/kubernetes/api" - "github.com/micro/go-micro/v3/util/kubernetes/client" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/runtime" + "github.com/unistack-org/micro/v3/util/kubernetes/api" + "github.com/unistack-org/micro/v3/util/kubernetes/client" ) type service struct { diff --git a/runtime/local/local.go b/runtime/local/local.go index 8ed52210..f8611679 100644 --- a/runtime/local/local.go +++ b/runtime/local/local.go @@ -12,9 +12,9 @@ import ( "time" "github.com/hpcloud/tail" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/runtime" - "github.com/micro/go-micro/v3/runtime/local/git" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/runtime" + "github.com/unistack-org/micro/v3/runtime/local/git" ) // defaultNamespace to use if not provided as an option diff --git a/runtime/local/process/os/os.go b/runtime/local/process/os/os.go index 92d823c4..68c6f6f9 100644 --- a/runtime/local/process/os/os.go +++ b/runtime/local/process/os/os.go @@ -10,7 +10,7 @@ import ( "strconv" "syscall" - "github.com/micro/go-micro/v3/runtime/local/process" + "github.com/unistack-org/micro/v3/runtime/local/process" ) func (p *Process) Exec(exe *process.Binary) error { diff --git a/runtime/local/process/os/os_windows.go b/runtime/local/process/os/os_windows.go index 9925d6b5..fb6f2132 100644 --- a/runtime/local/process/os/os_windows.go +++ b/runtime/local/process/os/os_windows.go @@ -7,7 +7,7 @@ import ( "os/exec" "strconv" - "github.com/micro/go-micro/v3/runtime/local/process" + "github.com/unistack-org/micro/v3/runtime/local/process" ) func (p *Process) Exec(exe *process.Binary) error { diff --git a/runtime/local/process/os/process.go b/runtime/local/process/os/process.go index 0d6b10be..84f9ffb2 100644 --- a/runtime/local/process/os/process.go +++ b/runtime/local/process/os/process.go @@ -2,7 +2,7 @@ package os import ( - "github.com/micro/go-micro/v3/runtime/local/process" + "github.com/unistack-org/micro/v3/runtime/local/process" ) type Process struct{} diff --git a/runtime/local/process/process.go b/runtime/local/process/process.go index 4b9b0dde..08d2385b 100644 --- a/runtime/local/process/process.go +++ b/runtime/local/process/process.go @@ -4,7 +4,7 @@ package process import ( "io" - "github.com/micro/go-micro/v3/build" + "github.com/unistack-org/micro/v3/build" ) // Process manages a running process diff --git a/runtime/local/service.go b/runtime/local/service.go index 08819eff..d23d80fb 100644 --- a/runtime/local/service.go +++ b/runtime/local/service.go @@ -9,11 +9,11 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/build" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/runtime" - "github.com/micro/go-micro/v3/runtime/local/process" - proc "github.com/micro/go-micro/v3/runtime/local/process/os" + "github.com/unistack-org/micro/v3/build" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/runtime" + "github.com/unistack-org/micro/v3/runtime/local/process" + proc "github.com/unistack-org/micro/v3/runtime/local/process/os" ) type service struct { diff --git a/runtime/local/source/go/golang.go b/runtime/local/source/go/golang.go index 0cb0dc5f..1687b541 100644 --- a/runtime/local/source/go/golang.go +++ b/runtime/local/source/go/golang.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - "github.com/micro/go-micro/v3/runtime/local/source" + "github.com/unistack-org/micro/v3/runtime/local/source" ) type Source struct { diff --git a/runtime/options.go b/runtime/options.go index e3097acb..0f628b6a 100644 --- a/runtime/options.go +++ b/runtime/options.go @@ -4,7 +4,7 @@ import ( "context" "io" - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" ) type Option func(o *Options) diff --git a/selector/random/random.go b/selector/random/random.go index a8ab7461..c048e2be 100644 --- a/selector/random/random.go +++ b/selector/random/random.go @@ -3,7 +3,7 @@ package random import ( "math/rand" - "github.com/micro/go-micro/v3/selector" + "github.com/unistack-org/micro/v3/selector" ) type random struct{} diff --git a/selector/random/random_test.go b/selector/random/random_test.go index 66da138c..6d5edb1d 100644 --- a/selector/random/random_test.go +++ b/selector/random/random_test.go @@ -3,7 +3,7 @@ package random import ( "testing" - "github.com/micro/go-micro/v3/selector" + "github.com/unistack-org/micro/v3/selector" ) func TestRandom(t *testing.T) { diff --git a/selector/roundrobin/roundrobin.go b/selector/roundrobin/roundrobin.go index 10d8d873..e64927b3 100644 --- a/selector/roundrobin/roundrobin.go +++ b/selector/roundrobin/roundrobin.go @@ -1,7 +1,7 @@ package roundrobin import ( - "github.com/micro/go-micro/v3/selector" + "github.com/unistack-org/micro/v3/selector" ) // NewSelector returns an initalised round robin selector diff --git a/selector/roundrobin/roundrobin_test.go b/selector/roundrobin/roundrobin_test.go index 48bf8528..4f7c5946 100644 --- a/selector/roundrobin/roundrobin_test.go +++ b/selector/roundrobin/roundrobin_test.go @@ -3,7 +3,7 @@ package roundrobin import ( "testing" - "github.com/micro/go-micro/v3/selector" + "github.com/unistack-org/micro/v3/selector" "github.com/stretchr/testify/assert" ) diff --git a/server/grpc/codec.go b/server/grpc/codec.go index 89597f07..edec7f81 100644 --- a/server/grpc/codec.go +++ b/server/grpc/codec.go @@ -8,8 +8,8 @@ import ( "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" "google.golang.org/grpc" "google.golang.org/grpc/encoding" "google.golang.org/grpc/metadata" diff --git a/server/grpc/context.go b/server/grpc/context.go index fe8ac3d7..6113d6d7 100644 --- a/server/grpc/context.go +++ b/server/grpc/context.go @@ -3,7 +3,7 @@ package grpc import ( "context" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/server" ) func setServerOption(k, v interface{}) server.Option { diff --git a/server/grpc/error.go b/server/grpc/error.go index 22a42b8b..375f3fd9 100644 --- a/server/grpc/error.go +++ b/server/grpc/error.go @@ -3,7 +3,7 @@ package grpc import ( "net/http" - "github.com/micro/go-micro/v3/errors" + "github.com/unistack-org/micro/v3/errors" "google.golang.org/grpc/codes" ) diff --git a/server/grpc/extractor.go b/server/grpc/extractor.go index d1d9d0ff..6f1f8883 100644 --- a/server/grpc/extractor.go +++ b/server/grpc/extractor.go @@ -5,7 +5,7 @@ import ( "reflect" "strings" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func extractValue(v reflect.Type, d int) *registry.Value { diff --git a/server/grpc/extractor_test.go b/server/grpc/extractor_test.go index 9eac7606..a41aeea8 100644 --- a/server/grpc/extractor_test.go +++ b/server/grpc/extractor_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type testHandler struct{} diff --git a/server/grpc/grpc.go b/server/grpc/grpc.go index 1de8a83e..3dd26411 100644 --- a/server/grpc/grpc.go +++ b/server/grpc/grpc.go @@ -15,17 +15,17 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/errors" - pberr "github.com/micro/go-micro/v3/errors/proto" - "github.com/micro/go-micro/v3/logger" - meta "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" - "github.com/micro/go-micro/v3/util/addr" - "github.com/micro/go-micro/v3/util/backoff" - mgrpc "github.com/micro/go-micro/v3/util/grpc" - mnet "github.com/micro/go-micro/v3/util/net" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/errors" + pberr "github.com/unistack-org/micro/v3/errors/proto" + "github.com/unistack-org/micro/v3/logger" + meta "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" + "github.com/unistack-org/micro/v3/util/addr" + "github.com/unistack-org/micro/v3/util/backoff" + mgrpc "github.com/unistack-org/micro/v3/util/grpc" + mnet "github.com/unistack-org/micro/v3/util/net" "golang.org/x/net/netutil" "google.golang.org/grpc" diff --git a/server/grpc/grpc_test.go b/server/grpc/grpc_test.go index e53240b5..c4738073 100644 --- a/server/grpc/grpc_test.go +++ b/server/grpc/grpc_test.go @@ -5,18 +5,18 @@ import ( "fmt" "testing" - bmemory "github.com/micro/go-micro/v3/broker/memory" - "github.com/micro/go-micro/v3/client" - gcli "github.com/micro/go-micro/v3/client/grpc" - "github.com/micro/go-micro/v3/errors" - pberr "github.com/micro/go-micro/v3/errors/proto" - rmemory "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" - rtreg "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/server" - gsrv "github.com/micro/go-micro/v3/server/grpc" - pb "github.com/micro/go-micro/v3/server/grpc/proto" - tgrpc "github.com/micro/go-micro/v3/transport/grpc" + bmemory "github.com/unistack-org/micro/v3/broker/memory" + "github.com/unistack-org/micro/v3/client" + gcli "github.com/unistack-org/micro/v3/client/grpc" + "github.com/unistack-org/micro/v3/errors" + pberr "github.com/unistack-org/micro/v3/errors/proto" + rmemory "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" + rtreg "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/server" + gsrv "github.com/unistack-org/micro/v3/server/grpc" + pb "github.com/unistack-org/micro/v3/server/grpc/proto" + tgrpc "github.com/unistack-org/micro/v3/transport/grpc" "google.golang.org/grpc" "google.golang.org/grpc/status" ) diff --git a/server/grpc/handler.go b/server/grpc/handler.go index 9e701c72..59a5947f 100644 --- a/server/grpc/handler.go +++ b/server/grpc/handler.go @@ -3,8 +3,8 @@ package grpc import ( "reflect" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" ) type rpcHandler struct { diff --git a/server/grpc/options.go b/server/grpc/options.go index d5bd36d5..7381ca59 100644 --- a/server/grpc/options.go +++ b/server/grpc/options.go @@ -5,10 +5,10 @@ import ( "crypto/tls" "net" - "github.com/micro/go-micro/v3/broker/http" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/registry/mdns" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/broker/http" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/server" "google.golang.org/grpc" "google.golang.org/grpc/encoding" ) diff --git a/server/grpc/proto/test.pb.go b/server/grpc/proto/test.pb.go index 125ae691..c031174c 100644 --- a/server/grpc/proto/test.pb.go +++ b/server/grpc/proto/test.pb.go @@ -1,292 +1,240 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: server/grpc/proto/test.proto package test import ( - context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 { - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,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_server_grpc_proto_test_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_server_grpc_proto_test_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_bb9c685b7640cf1e, []int{0} + return file_server_grpc_proto_test_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) GetUuid() string { - if m != nil { - return m.Uuid +func (x *Request) GetUuid() string { + if x != nil { + return x.Uuid } return "" } -func (m *Request) GetName() string { - if m != nil { - return m.Name +func (x *Request) GetName() string { + if x != nil { + return x.Name } return "" } type Response struct { - Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,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_server_grpc_proto_test_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_server_grpc_proto_test_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_bb9c685b7640cf1e, []int{1} + return file_server_grpc_proto_test_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) GetMsg() string { - if m != nil { - return m.Msg +func (x *Response) GetMsg() string { + if x != nil { + return x.Msg } return "" } -func init() { - proto.RegisterType((*Request)(nil), "Request") - proto.RegisterType((*Response)(nil), "Response") +var File_server_grpc_proto_test_proto protoreflect.FileDescriptor + +var file_server_grpc_proto_test_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31, 0x0a, 0x07, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, + 0x1c, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, + 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x32, 0xe6, 0x01, + 0x0a, 0x04, 0x54, 0x65, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x08, + 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, 0x18, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x7b, + 0x75, 0x75, 0x69, 0x64, 0x7d, 0x3a, 0x01, 0x2a, 0x12, 0x46, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, + 0x50, 0x63, 0x72, 0x65, 0x12, 0x08, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, + 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1f, 0x22, 0x1a, 0x5e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x65, 0x73, 0x74, + 0x2f, 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x70, 0x63, 0x72, 0x65, 0x2f, 0x3f, 0x24, 0x3a, 0x01, 0x2a, + 0x12, 0x54, 0x0a, 0x0f, 0x43, 0x61, 0x6c, 0x6c, 0x50, 0x63, 0x72, 0x65, 0x49, 0x6e, 0x76, 0x61, + 0x6c, 0x69, 0x64, 0x12, 0x08, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, + 0x22, 0x21, 0x5e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x30, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x2f, + 0x63, 0x61, 0x6c, 0x6c, 0x2f, 0x70, 0x63, 0x72, 0x65, 0x2f, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x2f, 0x3f, 0x3a, 0x01, 0x2a, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { proto.RegisterFile("server/grpc/proto/test.proto", fileDescriptor_bb9c685b7640cf1e) } +var ( + file_server_grpc_proto_test_proto_rawDescOnce sync.Once + file_server_grpc_proto_test_proto_rawDescData = file_server_grpc_proto_test_proto_rawDesc +) -var fileDescriptor_bb9c685b7640cf1e = []byte{ - // 261 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x4e, 0x2d, 0x2a, - 0x4b, 0x2d, 0xd2, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x49, - 0x2d, 0x2e, 0xd1, 0x03, 0x33, 0xa5, 0x64, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, - 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0x8a, 0x21, 0xb2, 0x4a, - 0x86, 0x5c, 0xec, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x42, 0x42, 0x5c, 0x2c, 0xa5, 0xa5, - 0x99, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x60, 0x36, 0x48, 0x2c, 0x2f, 0x31, 0x37, - 0x55, 0x82, 0x09, 0x22, 0x06, 0x62, 0x2b, 0xc9, 0x70, 0x71, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, - 0x15, 0xa7, 0x0a, 0x09, 0x70, 0x31, 0xe7, 0x16, 0xa7, 0x43, 0xb5, 0x80, 0x98, 0x46, 0xcf, 0x18, - 0xb9, 0x58, 0x42, 0x40, 0xc6, 0x39, 0x70, 0xb1, 0x38, 0x27, 0xe6, 0xe4, 0x08, 0x71, 0xe8, 0x41, - 0x2d, 0x90, 0xe2, 0xd4, 0x83, 0xe9, 0x53, 0x52, 0x6e, 0xba, 0xfc, 0x64, 0x32, 0x93, 0xac, 0x92, - 0x04, 0xd8, 0x59, 0x65, 0x06, 0x60, 0x07, 0xeb, 0x27, 0x27, 0xe6, 0xe4, 0xe8, 0x57, 0x83, 0x2c, - 0xae, 0xb5, 0x62, 0xd4, 0x12, 0x72, 0xe3, 0xe2, 0x00, 0x99, 0x10, 0x90, 0x5c, 0x94, 0x8a, 0xdd, - 0x14, 0x55, 0xb0, 0x29, 0xf2, 0x4a, 0x52, 0x71, 0x98, 0xc6, 0x14, 0x24, 0x17, 0xa5, 0xea, 0xdb, - 0xab, 0x80, 0xcc, 0x09, 0xe1, 0xe2, 0x87, 0x99, 0xe3, 0x99, 0x57, 0x96, 0x98, 0x93, 0x99, 0x82, - 0xdd, 0x38, 0x1d, 0xb0, 0x71, 0x6a, 0x4a, 0x8a, 0xb8, 0x8c, 0xcb, 0x84, 0xe8, 0xd6, 0xb7, 0xb7, - 0x62, 0xd4, 0x4a, 0x62, 0x03, 0x07, 0xa0, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x32, 0x18, - 0x0f, 0x7e, 0x01, 0x00, 0x00, +func file_server_grpc_proto_test_proto_rawDescGZIP() []byte { + file_server_grpc_proto_test_proto_rawDescOnce.Do(func() { + file_server_grpc_proto_test_proto_rawDescData = protoimpl.X.CompressGZIP(file_server_grpc_proto_test_proto_rawDescData) + }) + return file_server_grpc_proto_test_proto_rawDescData } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// TestClient is the client API for Test service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TestClient interface { - Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - CallPcre(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - CallPcreInvalid(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) +var file_server_grpc_proto_test_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_server_grpc_proto_test_proto_goTypes = []interface{}{ + (*Request)(nil), // 0: Request + (*Response)(nil), // 1: Response +} +var file_server_grpc_proto_test_proto_depIdxs = []int32{ + 0, // 0: Test.Call:input_type -> Request + 0, // 1: Test.CallPcre:input_type -> Request + 0, // 2: Test.CallPcreInvalid:input_type -> Request + 1, // 3: Test.Call:output_type -> Response + 1, // 4: Test.CallPcre:output_type -> Response + 1, // 5: Test.CallPcreInvalid:output_type -> Response + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] 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 } -type testClient struct { - cc *grpc.ClientConn -} - -func NewTestClient(cc *grpc.ClientConn) TestClient { - return &testClient{cc} -} - -func (c *testClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - out := new(Response) - err := c.cc.Invoke(ctx, "/Test/Call", in, out, opts...) - if err != nil { - return nil, err +func init() { file_server_grpc_proto_test_proto_init() } +func file_server_grpc_proto_test_proto_init() { + if File_server_grpc_proto_test_proto != nil { + return } - return out, nil -} - -func (c *testClient) CallPcre(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - out := new(Response) - err := c.cc.Invoke(ctx, "/Test/CallPcre", in, out, opts...) - if err != nil { - return nil, err + if !protoimpl.UnsafeEnabled { + file_server_grpc_proto_test_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_server_grpc_proto_test_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 + } + } } - return out, nil -} - -func (c *testClient) CallPcreInvalid(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - out := new(Response) - err := c.cc.Invoke(ctx, "/Test/CallPcreInvalid", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// TestServer is the server API for Test service. -type TestServer interface { - Call(context.Context, *Request) (*Response, error) - CallPcre(context.Context, *Request) (*Response, error) - CallPcreInvalid(context.Context, *Request) (*Response, error) -} - -// UnimplementedTestServer can be embedded to have forward compatible implementations. -type UnimplementedTestServer struct { -} - -func (*UnimplementedTestServer) Call(ctx context.Context, req *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") -} -func (*UnimplementedTestServer) CallPcre(ctx context.Context, req *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CallPcre not implemented") -} -func (*UnimplementedTestServer) CallPcreInvalid(ctx context.Context, req *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CallPcreInvalid not implemented") -} - -func RegisterTestServer(s *grpc.Server, srv TestServer) { - s.RegisterService(&_Test_serviceDesc, srv) -} - -func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServer).Call(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/Test/Call", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServer).Call(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Test_CallPcre_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServer).CallPcre(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/Test/CallPcre", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServer).CallPcre(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Test_CallPcreInvalid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TestServer).CallPcreInvalid(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/Test/CallPcreInvalid", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TestServer).CallPcreInvalid(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Test_serviceDesc = grpc.ServiceDesc{ - ServiceName: "Test", - HandlerType: (*TestServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Call", - Handler: _Test_Call_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_server_grpc_proto_test_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, }, - { - MethodName: "CallPcre", - Handler: _Test_CallPcre_Handler, - }, - { - MethodName: "CallPcreInvalid", - Handler: _Test_CallPcreInvalid_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "server/grpc/proto/test.proto", + GoTypes: file_server_grpc_proto_test_proto_goTypes, + DependencyIndexes: file_server_grpc_proto_test_proto_depIdxs, + MessageInfos: file_server_grpc_proto_test_proto_msgTypes, + }.Build() + File_server_grpc_proto_test_proto = out.File + file_server_grpc_proto_test_proto_rawDesc = nil + file_server_grpc_proto_test_proto_goTypes = nil + file_server_grpc_proto_test_proto_depIdxs = nil } diff --git a/server/grpc/proto/test.pb.micro.go b/server/grpc/proto/test.pb.micro.go index 1f636854..3e209227 100644 --- a/server/grpc/proto/test.pb.micro.go +++ b/server/grpc/proto/test.pb.micro.go @@ -12,9 +12,9 @@ import ( import ( context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/server/grpc/proto/test_grpc.pb.go b/server/grpc/proto/test_grpc.pb.go new file mode 100644 index 00000000..daa1ce7e --- /dev/null +++ b/server/grpc/proto/test_grpc.pb.go @@ -0,0 +1,162 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package test + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// TestClient is the client API for Test service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TestClient interface { + Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + CallPcre(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + CallPcreInvalid(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) +} + +type testClient struct { + cc grpc.ClientConnInterface +} + +func NewTestClient(cc grpc.ClientConnInterface) TestClient { + return &testClient{cc} +} + +func (c *testClient) Call(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/Test/Call", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testClient) CallPcre(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/Test/CallPcre", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *testClient) CallPcreInvalid(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { + out := new(Response) + err := c.cc.Invoke(ctx, "/Test/CallPcreInvalid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TestServer is the server API for Test service. +// All implementations must embed UnimplementedTestServer +// for forward compatibility +type TestServer interface { + Call(context.Context, *Request) (*Response, error) + CallPcre(context.Context, *Request) (*Response, error) + CallPcreInvalid(context.Context, *Request) (*Response, error) + mustEmbedUnimplementedTestServer() +} + +// UnimplementedTestServer must be embedded to have forward compatible implementations. +type UnimplementedTestServer struct { +} + +func (*UnimplementedTestServer) Call(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") +} +func (*UnimplementedTestServer) CallPcre(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallPcre not implemented") +} +func (*UnimplementedTestServer) CallPcreInvalid(context.Context, *Request) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallPcreInvalid not implemented") +} +func (*UnimplementedTestServer) mustEmbedUnimplementedTestServer() {} + +func RegisterTestServer(s *grpc.Server, srv TestServer) { + s.RegisterService(&_Test_serviceDesc, srv) +} + +func _Test_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestServer).Call(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Test/Call", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServer).Call(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Test_CallPcre_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestServer).CallPcre(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Test/CallPcre", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServer).CallPcre(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Test_CallPcreInvalid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TestServer).CallPcreInvalid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/Test/CallPcreInvalid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TestServer).CallPcreInvalid(ctx, req.(*Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Test_serviceDesc = grpc.ServiceDesc{ + ServiceName: "Test", + HandlerType: (*TestServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Call", + Handler: _Test_Call_Handler, + }, + { + MethodName: "CallPcre", + Handler: _Test_CallPcre_Handler, + }, + { + MethodName: "CallPcreInvalid", + Handler: _Test_CallPcreInvalid_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "server/grpc/proto/test.proto", +} diff --git a/server/grpc/request.go b/server/grpc/request.go index 437d0ed6..2e1506ec 100644 --- a/server/grpc/request.go +++ b/server/grpc/request.go @@ -1,8 +1,8 @@ package grpc import ( - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/codec/bytes" ) type rpcRequest struct { diff --git a/server/grpc/response.go b/server/grpc/response.go index d78ec442..fff96a94 100644 --- a/server/grpc/response.go +++ b/server/grpc/response.go @@ -1,7 +1,7 @@ package grpc import ( - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type rpcResponse struct { diff --git a/server/grpc/server.go b/server/grpc/server.go index 5a7d2a0b..ccee0286 100644 --- a/server/grpc/server.go +++ b/server/grpc/server.go @@ -14,8 +14,8 @@ import ( "unicode" "unicode/utf8" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/server" ) var ( diff --git a/server/grpc/stream.go b/server/grpc/stream.go index adb22936..ccebbd0a 100644 --- a/server/grpc/stream.go +++ b/server/grpc/stream.go @@ -3,7 +3,7 @@ package grpc import ( "context" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/server" "google.golang.org/grpc" ) diff --git a/server/grpc/subscriber.go b/server/grpc/subscriber.go index d69379ac..db8b6930 100644 --- a/server/grpc/subscriber.go +++ b/server/grpc/subscriber.go @@ -7,12 +7,12 @@ import ( "runtime/debug" "strings" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" ) const ( diff --git a/server/mock/mock.go b/server/mock/mock.go index dc4bff30..e2305d92 100644 --- a/server/mock/mock.go +++ b/server/mock/mock.go @@ -5,7 +5,7 @@ import ( "sync" "github.com/google/uuid" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/server" ) type MockServer struct { diff --git a/server/mock/mock_handler.go b/server/mock/mock_handler.go index 1b194b64..4f1fda03 100644 --- a/server/mock/mock_handler.go +++ b/server/mock/mock_handler.go @@ -1,8 +1,8 @@ package mock import ( - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" ) type MockHandler struct { diff --git a/server/mock/mock_subscriber.go b/server/mock/mock_subscriber.go index e6f47a22..2db41b5a 100644 --- a/server/mock/mock_subscriber.go +++ b/server/mock/mock_subscriber.go @@ -1,8 +1,8 @@ package mock import ( - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" ) type MockSubscriber struct { diff --git a/server/mock/mock_test.go b/server/mock/mock_test.go index a3d537ca..32d6d54a 100644 --- a/server/mock/mock_test.go +++ b/server/mock/mock_test.go @@ -3,7 +3,7 @@ package mock import ( "testing" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/server" ) func TestMockServer(t *testing.T) { diff --git a/server/mucp/extractor.go b/server/mucp/extractor.go index 338a5a0d..1630397d 100644 --- a/server/mucp/extractor.go +++ b/server/mucp/extractor.go @@ -5,7 +5,7 @@ import ( "reflect" "strings" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func extractValue(v reflect.Type, d int) *registry.Value { diff --git a/server/mucp/extractor_test.go b/server/mucp/extractor_test.go index d8bd914f..478899e2 100644 --- a/server/mucp/extractor_test.go +++ b/server/mucp/extractor_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) type testHandler struct{} diff --git a/server/mucp/mucp.go b/server/mucp/mucp.go index c678cc05..d0dc5512 100644 --- a/server/mucp/mucp.go +++ b/server/mucp/mucp.go @@ -2,7 +2,7 @@ package mucp import ( - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/server" ) var ( diff --git a/server/mucp/options.go b/server/mucp/options.go index 8304c046..63a69778 100644 --- a/server/mucp/options.go +++ b/server/mucp/options.go @@ -1,11 +1,11 @@ package mucp import ( - "github.com/micro/go-micro/v3/broker/http" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/registry/mdns" - "github.com/micro/go-micro/v3/server" - thttp "github.com/micro/go-micro/v3/transport/http" + "github.com/unistack-org/micro/v3/broker/http" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/server" + thttp "github.com/unistack-org/micro/v3/transport/http" ) func newOptions(opt ...server.Option) server.Options { diff --git a/server/mucp/rpc_codec.go b/server/mucp/rpc_codec.go index e0a0202a..d3e0f06c 100644 --- a/server/mucp/rpc_codec.go +++ b/server/mucp/rpc_codec.go @@ -4,14 +4,14 @@ import ( "bytes" "sync" - "github.com/micro/go-micro/v3/codec" - raw "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/codec/grpc" - "github.com/micro/go-micro/v3/codec/json" - "github.com/micro/go-micro/v3/codec/jsonrpc" - "github.com/micro/go-micro/v3/codec/proto" - "github.com/micro/go-micro/v3/codec/protorpc" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/codec" + raw "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/codec/grpc" + "github.com/unistack-org/micro/v3/codec/json" + "github.com/unistack-org/micro/v3/codec/jsonrpc" + "github.com/unistack-org/micro/v3/codec/proto" + "github.com/unistack-org/micro/v3/codec/protorpc" + "github.com/unistack-org/micro/v3/transport" "github.com/oxtoacart/bpool" "github.com/pkg/errors" ) diff --git a/server/mucp/rpc_codec_test.go b/server/mucp/rpc_codec_test.go index 61a7bd9f..1b5d19ef 100644 --- a/server/mucp/rpc_codec_test.go +++ b/server/mucp/rpc_codec_test.go @@ -5,8 +5,8 @@ import ( "errors" "testing" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/transport" ) // testCodec is a dummy codec that only knows how to encode nil bodies diff --git a/server/mucp/rpc_handler.go b/server/mucp/rpc_handler.go index 194ee439..57942d7e 100644 --- a/server/mucp/rpc_handler.go +++ b/server/mucp/rpc_handler.go @@ -3,8 +3,8 @@ package mucp import ( "reflect" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" ) type rpcHandler struct { diff --git a/server/mucp/rpc_request.go b/server/mucp/rpc_request.go index 5520adee..0171ded2 100644 --- a/server/mucp/rpc_request.go +++ b/server/mucp/rpc_request.go @@ -3,9 +3,9 @@ package mucp import ( "bytes" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/util/buf" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/util/buf" ) type rpcRequest struct { diff --git a/server/mucp/rpc_response.go b/server/mucp/rpc_response.go index 5a161d8e..502498c2 100644 --- a/server/mucp/rpc_response.go +++ b/server/mucp/rpc_response.go @@ -3,8 +3,8 @@ package mucp import ( "net/http" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/transport" ) type rpcResponse struct { diff --git a/server/mucp/rpc_router.go b/server/mucp/rpc_router.go index d527f3f6..b7c55184 100644 --- a/server/mucp/rpc_router.go +++ b/server/mucp/rpc_router.go @@ -18,9 +18,9 @@ import ( "unicode" "unicode/utf8" - "github.com/micro/go-micro/v3/codec" - merrors "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/codec" + merrors "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/server" ) var ( diff --git a/server/mucp/rpc_server.go b/server/mucp/rpc_server.go index d650b8d1..d5460623 100644 --- a/server/mucp/rpc_server.go +++ b/server/mucp/rpc_server.go @@ -12,18 +12,18 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/codec" - raw "github.com/micro/go-micro/v3/codec/bytes" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/util/addr" - "github.com/micro/go-micro/v3/util/backoff" - mnet "github.com/micro/go-micro/v3/util/net" - "github.com/micro/go-micro/v3/util/socket" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/codec" + raw "github.com/unistack-org/micro/v3/codec/bytes" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/util/addr" + "github.com/unistack-org/micro/v3/util/backoff" + mnet "github.com/unistack-org/micro/v3/util/net" + "github.com/unistack-org/micro/v3/util/socket" ) type rpcServer struct { diff --git a/server/mucp/rpc_stream.go b/server/mucp/rpc_stream.go index ce032caa..977524b5 100644 --- a/server/mucp/rpc_stream.go +++ b/server/mucp/rpc_stream.go @@ -6,8 +6,8 @@ import ( "io" "sync" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/server" ) // Implements the Streamer interface diff --git a/server/mucp/rpc_stream_test.go b/server/mucp/rpc_stream_test.go index c7bdb0f7..1965536b 100644 --- a/server/mucp/rpc_stream_test.go +++ b/server/mucp/rpc_stream_test.go @@ -10,8 +10,8 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/micro/go-micro/v3/codec/json" - protoCodec "github.com/micro/go-micro/v3/codec/proto" + "github.com/unistack-org/micro/v3/codec/json" + protoCodec "github.com/unistack-org/micro/v3/codec/proto" ) // protoStruct implements proto.Message diff --git a/server/mucp/subscriber.go b/server/mucp/subscriber.go index 149226be..4a7e6406 100644 --- a/server/mucp/subscriber.go +++ b/server/mucp/subscriber.go @@ -4,10 +4,10 @@ import ( "fmt" "reflect" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/server" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/server" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/transport" ) const ( diff --git a/server/options.go b/server/options.go index 59611363..5d7dc35f 100644 --- a/server/options.go +++ b/server/options.go @@ -6,15 +6,15 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/broker/http" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/debug/trace" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/mdns" - "github.com/micro/go-micro/v3/transport" - thttp "github.com/micro/go-micro/v3/transport/http" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/broker/http" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/debug/trace" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/mdns" + "github.com/unistack-org/micro/v3/transport" + thttp "github.com/unistack-org/micro/v3/transport/http" ) type Options struct { diff --git a/server/proto/server.pb.go b/server/proto/server.pb.go index 5813ff28..3fbb696c 100644 --- a/server/proto/server.pb.go +++ b/server/proto/server.pb.go @@ -1,324 +1,349 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: server/proto/server.proto package go_micro_server import ( - context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 HandleRequest struct { - Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` - Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` + Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"` } -func (m *HandleRequest) Reset() { *m = HandleRequest{} } -func (m *HandleRequest) String() string { return proto.CompactTextString(m) } -func (*HandleRequest) ProtoMessage() {} +func (x *HandleRequest) Reset() { + *x = HandleRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HandleRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HandleRequest) ProtoMessage() {} + +func (x *HandleRequest) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_server_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 HandleRequest.ProtoReflect.Descriptor instead. func (*HandleRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1959cecd4d1121a1, []int{0} + return file_server_proto_server_proto_rawDescGZIP(), []int{0} } -func (m *HandleRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HandleRequest.Unmarshal(m, b) -} -func (m *HandleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HandleRequest.Marshal(b, m, deterministic) -} -func (m *HandleRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_HandleRequest.Merge(m, src) -} -func (m *HandleRequest) XXX_Size() int { - return xxx_messageInfo_HandleRequest.Size(m) -} -func (m *HandleRequest) XXX_DiscardUnknown() { - xxx_messageInfo_HandleRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_HandleRequest proto.InternalMessageInfo - -func (m *HandleRequest) GetService() string { - if m != nil { - return m.Service +func (x *HandleRequest) GetService() string { + if x != nil { + return x.Service } return "" } -func (m *HandleRequest) GetEndpoint() string { - if m != nil { - return m.Endpoint +func (x *HandleRequest) GetEndpoint() string { + if x != nil { + return x.Endpoint } return "" } -func (m *HandleRequest) GetProtocol() string { - if m != nil { - return m.Protocol +func (x *HandleRequest) GetProtocol() string { + if x != nil { + return x.Protocol } return "" } type HandleResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *HandleResponse) Reset() { *m = HandleResponse{} } -func (m *HandleResponse) String() string { return proto.CompactTextString(m) } -func (*HandleResponse) ProtoMessage() {} +func (x *HandleResponse) Reset() { + *x = HandleResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HandleResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HandleResponse) ProtoMessage() {} + +func (x *HandleResponse) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_server_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 HandleResponse.ProtoReflect.Descriptor instead. func (*HandleResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1959cecd4d1121a1, []int{1} + return file_server_proto_server_proto_rawDescGZIP(), []int{1} } -func (m *HandleResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_HandleResponse.Unmarshal(m, b) -} -func (m *HandleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_HandleResponse.Marshal(b, m, deterministic) -} -func (m *HandleResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_HandleResponse.Merge(m, src) -} -func (m *HandleResponse) XXX_Size() int { - return xxx_messageInfo_HandleResponse.Size(m) -} -func (m *HandleResponse) XXX_DiscardUnknown() { - xxx_messageInfo_HandleResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_HandleResponse proto.InternalMessageInfo - type SubscribeRequest struct { - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"` } -func (m *SubscribeRequest) Reset() { *m = SubscribeRequest{} } -func (m *SubscribeRequest) String() string { return proto.CompactTextString(m) } -func (*SubscribeRequest) ProtoMessage() {} +func (x *SubscribeRequest) Reset() { + *x = SubscribeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_server_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRequest) ProtoMessage() {} + +func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_server_proto_msgTypes[2] + 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 SubscribeRequest.ProtoReflect.Descriptor instead. func (*SubscribeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1959cecd4d1121a1, []int{2} + return file_server_proto_server_proto_rawDescGZIP(), []int{2} } -func (m *SubscribeRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SubscribeRequest.Unmarshal(m, b) -} -func (m *SubscribeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SubscribeRequest.Marshal(b, m, deterministic) -} -func (m *SubscribeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubscribeRequest.Merge(m, src) -} -func (m *SubscribeRequest) XXX_Size() int { - return xxx_messageInfo_SubscribeRequest.Size(m) -} -func (m *SubscribeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SubscribeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SubscribeRequest proto.InternalMessageInfo - -func (m *SubscribeRequest) GetTopic() string { - if m != nil { - return m.Topic +func (x *SubscribeRequest) GetTopic() string { + if x != nil { + return x.Topic } return "" } type SubscribeResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *SubscribeResponse) Reset() { *m = SubscribeResponse{} } -func (m *SubscribeResponse) String() string { return proto.CompactTextString(m) } -func (*SubscribeResponse) ProtoMessage() {} +func (x *SubscribeResponse) Reset() { + *x = SubscribeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_server_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeResponse) ProtoMessage() {} + +func (x *SubscribeResponse) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_server_proto_msgTypes[3] + 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 SubscribeResponse.ProtoReflect.Descriptor instead. func (*SubscribeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1959cecd4d1121a1, []int{3} + return file_server_proto_server_proto_rawDescGZIP(), []int{3} } -func (m *SubscribeResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_SubscribeResponse.Unmarshal(m, b) -} -func (m *SubscribeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_SubscribeResponse.Marshal(b, m, deterministic) -} -func (m *SubscribeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SubscribeResponse.Merge(m, src) -} -func (m *SubscribeResponse) XXX_Size() int { - return xxx_messageInfo_SubscribeResponse.Size(m) -} -func (m *SubscribeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SubscribeResponse.DiscardUnknown(m) +var File_server_proto_server_proto protoreflect.FileDescriptor + +var file_server_proto_server_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x2e, + 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x61, 0x0a, 0x0d, + 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, + 0x10, 0x0a, 0x0e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x28, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x22, 0x13, 0x0a, 0x11, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xab, 0x01, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x06, 0x48, + 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x21, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_SubscribeResponse proto.InternalMessageInfo +var ( + file_server_proto_server_proto_rawDescOnce sync.Once + file_server_proto_server_proto_rawDescData = file_server_proto_server_proto_rawDesc +) -func init() { - proto.RegisterType((*HandleRequest)(nil), "go.micro.server.HandleRequest") - proto.RegisterType((*HandleResponse)(nil), "go.micro.server.HandleResponse") - proto.RegisterType((*SubscribeRequest)(nil), "go.micro.server.SubscribeRequest") - proto.RegisterType((*SubscribeResponse)(nil), "go.micro.server.SubscribeResponse") +func file_server_proto_server_proto_rawDescGZIP() []byte { + file_server_proto_server_proto_rawDescOnce.Do(func() { + file_server_proto_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_server_proto_server_proto_rawDescData) + }) + return file_server_proto_server_proto_rawDescData } -func init() { proto.RegisterFile("server/proto/server.proto", fileDescriptor_1959cecd4d1121a1) } - -var fileDescriptor_1959cecd4d1121a1 = []byte{ - // 223 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2c, 0x4e, 0x2d, 0x2a, - 0x4b, 0x2d, 0xd2, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x70, 0xf4, 0xc0, 0x1c, 0x21, 0xfe, - 0xf4, 0x7c, 0xbd, 0xdc, 0xcc, 0xe4, 0xa2, 0x7c, 0x3d, 0x88, 0xb0, 0x52, 0x22, 0x17, 0xaf, 0x47, - 0x62, 0x5e, 0x4a, 0x4e, 0x6a, 0x50, 0x6a, 0x61, 0x69, 0x6a, 0x71, 0x89, 0x90, 0x04, 0x17, 0x3b, - 0x48, 0x2a, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc6, 0x15, 0x92, 0xe2, - 0xe2, 0x48, 0xcd, 0x4b, 0x29, 0xc8, 0xcf, 0xcc, 0x2b, 0x91, 0x60, 0x02, 0x4b, 0xc1, 0xf9, 0x20, - 0x39, 0xb0, 0x05, 0xc9, 0xf9, 0x39, 0x12, 0xcc, 0x10, 0x39, 0x18, 0x5f, 0x49, 0x80, 0x8b, 0x0f, - 0x66, 0x45, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x92, 0x06, 0x97, 0x40, 0x70, 0x69, 0x52, 0x71, - 0x72, 0x51, 0x66, 0x12, 0xdc, 0x5e, 0x11, 0x2e, 0xd6, 0x92, 0xfc, 0x82, 0xcc, 0x64, 0xa8, 0xad, - 0x10, 0x8e, 0x92, 0x30, 0x97, 0x20, 0x92, 0x4a, 0x88, 0x76, 0xa3, 0xd5, 0x8c, 0x5c, 0x6c, 0xc1, - 0x60, 0xe7, 0x0b, 0x79, 0x73, 0xb1, 0x41, 0xcc, 0x16, 0x92, 0xd3, 0x43, 0xf3, 0x9a, 0x1e, 0x8a, - 0xbf, 0xa4, 0xe4, 0x71, 0xca, 0x43, 0x1d, 0xc5, 0x20, 0x14, 0xc2, 0xc5, 0x09, 0xb7, 0x4c, 0x48, - 0x11, 0x43, 0x3d, 0xba, 0x93, 0xa5, 0x94, 0xf0, 0x29, 0x81, 0x99, 0x9a, 0xc4, 0x06, 0x0e, 0x08, - 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x3f, 0x79, 0x80, 0x96, 0x01, 0x00, 0x00, +var file_server_proto_server_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_server_proto_server_proto_goTypes = []interface{}{ + (*HandleRequest)(nil), // 0: go.micro.server.HandleRequest + (*HandleResponse)(nil), // 1: go.micro.server.HandleResponse + (*SubscribeRequest)(nil), // 2: go.micro.server.SubscribeRequest + (*SubscribeResponse)(nil), // 3: go.micro.server.SubscribeResponse +} +var file_server_proto_server_proto_depIdxs = []int32{ + 0, // 0: go.micro.server.Server.Handle:input_type -> go.micro.server.HandleRequest + 2, // 1: go.micro.server.Server.Subscribe:input_type -> go.micro.server.SubscribeRequest + 1, // 2: go.micro.server.Server.Handle:output_type -> go.micro.server.HandleResponse + 3, // 3: go.micro.server.Server.Subscribe:output_type -> go.micro.server.SubscribeResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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 } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ServerClient is the client API for Server service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ServerClient interface { - Handle(ctx context.Context, in *HandleRequest, opts ...grpc.CallOption) (*HandleResponse, error) - Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SubscribeResponse, error) -} - -type serverClient struct { - cc *grpc.ClientConn -} - -func NewServerClient(cc *grpc.ClientConn) ServerClient { - return &serverClient{cc} -} - -func (c *serverClient) Handle(ctx context.Context, in *HandleRequest, opts ...grpc.CallOption) (*HandleResponse, error) { - out := new(HandleResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.Server/Handle", in, out, opts...) - if err != nil { - return nil, err +func init() { file_server_proto_server_proto_init() } +func file_server_proto_server_proto_init() { + if File_server_proto_server_proto != nil { + return } - return out, nil -} - -func (c *serverClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SubscribeResponse, error) { - out := new(SubscribeResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.Server/Subscribe", in, out, opts...) - if err != nil { - return nil, err + if !protoimpl.UnsafeEnabled { + file_server_proto_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HandleRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_server_proto_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HandleResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_server_proto_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_server_proto_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - return out, nil -} - -// ServerServer is the server API for Server service. -type ServerServer interface { - Handle(context.Context, *HandleRequest) (*HandleResponse, error) - Subscribe(context.Context, *SubscribeRequest) (*SubscribeResponse, error) -} - -// UnimplementedServerServer can be embedded to have forward compatible implementations. -type UnimplementedServerServer struct { -} - -func (*UnimplementedServerServer) Handle(ctx context.Context, req *HandleRequest) (*HandleResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented") -} -func (*UnimplementedServerServer) Subscribe(ctx context.Context, req *SubscribeRequest) (*SubscribeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Subscribe not implemented") -} - -func RegisterServerServer(s *grpc.Server, srv ServerServer) { - s.RegisterService(&_Server_serviceDesc, srv) -} - -func _Server_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HandleRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServerServer).Handle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.Server/Handle", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServerServer).Handle(ctx, req.(*HandleRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Server_Subscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(SubscribeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ServerServer).Subscribe(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.Server/Subscribe", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServerServer).Subscribe(ctx, req.(*SubscribeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Server_serviceDesc = grpc.ServiceDesc{ - ServiceName: "go.micro.server.Server", - HandlerType: (*ServerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Handle", - Handler: _Server_Handle_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_server_proto_server_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, }, - { - MethodName: "Subscribe", - Handler: _Server_Subscribe_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "server/proto/server.proto", + GoTypes: file_server_proto_server_proto_goTypes, + DependencyIndexes: file_server_proto_server_proto_depIdxs, + MessageInfos: file_server_proto_server_proto_msgTypes, + }.Build() + File_server_proto_server_proto = out.File + file_server_proto_server_proto_rawDesc = nil + file_server_proto_server_proto_goTypes = nil + file_server_proto_server_proto_depIdxs = nil } diff --git a/server/proto/server.pb.micro.go b/server/proto/server.pb.micro.go index ecb350e8..8f77b59d 100644 --- a/server/proto/server.pb.micro.go +++ b/server/proto/server.pb.micro.go @@ -11,9 +11,9 @@ import ( import ( context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/server/proto/server_grpc.pb.go b/server/proto/server_grpc.pb.go new file mode 100644 index 00000000..398f139c --- /dev/null +++ b/server/proto/server_grpc.pb.go @@ -0,0 +1,126 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package go_micro_server + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ServerClient is the client API for Server service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ServerClient interface { + Handle(ctx context.Context, in *HandleRequest, opts ...grpc.CallOption) (*HandleResponse, error) + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SubscribeResponse, error) +} + +type serverClient struct { + cc grpc.ClientConnInterface +} + +func NewServerClient(cc grpc.ClientConnInterface) ServerClient { + return &serverClient{cc} +} + +func (c *serverClient) Handle(ctx context.Context, in *HandleRequest, opts ...grpc.CallOption) (*HandleResponse, error) { + out := new(HandleResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.Server/Handle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *serverClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SubscribeResponse, error) { + out := new(SubscribeResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.Server/Subscribe", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ServerServer is the server API for Server service. +// All implementations must embed UnimplementedServerServer +// for forward compatibility +type ServerServer interface { + Handle(context.Context, *HandleRequest) (*HandleResponse, error) + Subscribe(context.Context, *SubscribeRequest) (*SubscribeResponse, error) + mustEmbedUnimplementedServerServer() +} + +// UnimplementedServerServer must be embedded to have forward compatible implementations. +type UnimplementedServerServer struct { +} + +func (*UnimplementedServerServer) Handle(context.Context, *HandleRequest) (*HandleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented") +} +func (*UnimplementedServerServer) Subscribe(context.Context, *SubscribeRequest) (*SubscribeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Subscribe not implemented") +} +func (*UnimplementedServerServer) mustEmbedUnimplementedServerServer() {} + +func RegisterServerServer(s *grpc.Server, srv ServerServer) { + s.RegisterService(&_Server_serviceDesc, srv) +} + +func _Server_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HandleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerServer).Handle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.Server/Handle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerServer).Handle(ctx, req.(*HandleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Server_Subscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubscribeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ServerServer).Subscribe(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.Server/Subscribe", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ServerServer).Subscribe(ctx, req.(*SubscribeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Server_serviceDesc = grpc.ServiceDesc{ + ServiceName: "go.micro.server.Server", + HandlerType: (*ServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Handle", + Handler: _Server_Handle_Handler, + }, + { + MethodName: "Subscribe", + Handler: _Server_Subscribe_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "server/proto/server.proto", +} diff --git a/server/server.go b/server/server.go index c70656d6..7e63ff81 100644 --- a/server/server.go +++ b/server/server.go @@ -6,8 +6,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/registry" ) // Server is a simple micro server abstraction diff --git a/store/cache/cache.go b/store/cache/cache.go index 775f4096..54393e0a 100644 --- a/store/cache/cache.go +++ b/store/cache/cache.go @@ -1,8 +1,8 @@ package cache import ( - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/store/memory" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/store/memory" ) // cache store is a store with caching to reduce IO where applicable. diff --git a/store/cache/cache_test.go b/store/cache/cache_test.go index 08e664ca..c8444e99 100644 --- a/store/cache/cache_test.go +++ b/store/cache/cache_test.go @@ -5,8 +5,8 @@ import ( "path/filepath" "testing" - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/store/file" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/store/file" "github.com/stretchr/testify/assert" ) diff --git a/store/cockroach/cockroach.go b/store/cockroach/cockroach.go index 2b2f3987..66cbb4f3 100644 --- a/store/cockroach/cockroach.go +++ b/store/cockroach/cockroach.go @@ -11,8 +11,8 @@ import ( "time" "github.com/lib/pq" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/store" "github.com/pkg/errors" ) diff --git a/store/cockroach/cockroach_test.go b/store/cockroach/cockroach_test.go index 2b794fb1..9dedcc47 100644 --- a/store/cockroach/cockroach_test.go +++ b/store/cockroach/cockroach_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/kr/pretty" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) func TestSQL(t *testing.T) { diff --git a/store/file/file.go b/store/file/file.go index 11cbfdd1..2b171f1d 100644 --- a/store/file/file.go +++ b/store/file/file.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" bolt "go.etcd.io/bbolt" ) diff --git a/store/file/file_test.go b/store/file/file_test.go index 7f9cf7c8..9ff31c55 100644 --- a/store/file/file_test.go +++ b/store/file/file_test.go @@ -10,7 +10,7 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/kr/pretty" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) func cleanup(db string, s store.Store) { diff --git a/store/memory/memory.go b/store/memory/memory.go index 20c190ca..63947565 100644 --- a/store/memory/memory.go +++ b/store/memory/memory.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" "github.com/patrickmn/go-cache" "github.com/pkg/errors" ) diff --git a/store/memory/memory_test.go b/store/memory/memory_test.go index 59dba5d5..3fe1f42e 100644 --- a/store/memory/memory_test.go +++ b/store/memory/memory_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/kr/pretty" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) func TestMemoryReInit(t *testing.T) { diff --git a/sync/etcd/etcd.go b/sync/etcd/etcd.go index 553a6b25..a7c48eed 100644 --- a/sync/etcd/etcd.go +++ b/sync/etcd/etcd.go @@ -11,7 +11,7 @@ import ( client "github.com/coreos/etcd/clientv3" cc "github.com/coreos/etcd/clientv3/concurrency" - "github.com/micro/go-micro/v3/sync" + "github.com/unistack-org/micro/v3/sync" ) type etcdSync struct { diff --git a/sync/memory/memory.go b/sync/memory/memory.go index 1f201b20..c097fc7b 100644 --- a/sync/memory/memory.go +++ b/sync/memory/memory.go @@ -5,7 +5,7 @@ import ( gosync "sync" "time" - "github.com/micro/go-micro/v3/sync" + "github.com/unistack-org/micro/v3/sync" ) type memorySync struct { diff --git a/transport/grpc/grpc.go b/transport/grpc/grpc.go index d5ee7083..b3ee5cff 100644 --- a/transport/grpc/grpc.go +++ b/transport/grpc/grpc.go @@ -6,15 +6,15 @@ import ( "crypto/tls" "net" - "github.com/micro/go-micro/v3/transport" - maddr "github.com/micro/go-micro/v3/util/addr" - mnet "github.com/micro/go-micro/v3/util/net" - mls "github.com/micro/go-micro/v3/util/tls" + "github.com/unistack-org/micro/v3/transport" + maddr "github.com/unistack-org/micro/v3/util/addr" + mnet "github.com/unistack-org/micro/v3/util/net" + mls "github.com/unistack-org/micro/v3/util/tls" "google.golang.org/grpc" "google.golang.org/grpc/credentials" - pb "github.com/micro/go-micro/v3/transport/grpc/proto" + pb "github.com/unistack-org/micro/v3/transport/grpc/proto" ) type grpcTransport struct { diff --git a/transport/grpc/grpc_test.go b/transport/grpc/grpc_test.go index 6d577f9c..0d0cf57a 100644 --- a/transport/grpc/grpc_test.go +++ b/transport/grpc/grpc_test.go @@ -4,7 +4,7 @@ import ( "net" "testing" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) func expectedPort(t *testing.T, expected string, lsn transport.Listener) { diff --git a/transport/grpc/handler.go b/transport/grpc/handler.go index 956d55cf..3d03eb4a 100644 --- a/transport/grpc/handler.go +++ b/transport/grpc/handler.go @@ -3,15 +3,16 @@ package grpc import ( "runtime/debug" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/transport" - pb "github.com/micro/go-micro/v3/transport/grpc/proto" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/transport" + pb "github.com/unistack-org/micro/v3/transport/grpc/proto" "google.golang.org/grpc/peer" ) // microTransport satisfies the pb.TransportServer inteface type microTransport struct { + pb.UnimplementedTransportServer addr string fn func(transport.Socket) } diff --git a/transport/grpc/proto/transport.pb.go b/transport/grpc/proto/transport.pb.go index 88abb01a..b32a3324 100644 --- a/transport/grpc/proto/transport.pb.go +++ b/transport/grpc/proto/transport.pb.go @@ -1,211 +1,174 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: transport/grpc/proto/transport.proto package go_micro_transport_grpc import ( - context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 Message struct { - Header map[string]string `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header map[string]string `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` } -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_transport_grpc_proto_transport_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_transport_grpc_proto_transport_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 Message.ProtoReflect.Descriptor instead. func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_651718cd7c7ae974, []int{0} + return file_transport_grpc_proto_transport_proto_rawDescGZIP(), []int{0} } -func (m *Message) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Message.Unmarshal(m, b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return xxx_messageInfo_Message.Size(m) -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func (m *Message) GetHeader() map[string]string { - if m != nil { - return m.Header +func (x *Message) GetHeader() map[string]string { + if x != nil { + return x.Header } return nil } -func (m *Message) GetBody() []byte { - if m != nil { - return m.Body +func (x *Message) GetBody() []byte { + if x != nil { + return x.Body } return nil } -func init() { - proto.RegisterType((*Message)(nil), "go.micro.transport.grpc.Message") - proto.RegisterMapType((map[string]string)(nil), "go.micro.transport.grpc.Message.HeaderEntry") +var File_transport_grpc_proto_transport_proto protoreflect.FileDescriptor + +var file_transport_grpc_proto_transport_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x22, + 0x9e, 0x01, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x67, 0x6f, + 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, + 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x1a, 0x39, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x32, 0x5f, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x52, 0x0a, + 0x06, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, + 0x72, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x20, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, + 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, + 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterFile("transport/grpc/proto/transport.proto", fileDescriptor_651718cd7c7ae974) +var ( + file_transport_grpc_proto_transport_proto_rawDescOnce sync.Once + file_transport_grpc_proto_transport_proto_rawDescData = file_transport_grpc_proto_transport_proto_rawDesc +) + +func file_transport_grpc_proto_transport_proto_rawDescGZIP() []byte { + file_transport_grpc_proto_transport_proto_rawDescOnce.Do(func() { + file_transport_grpc_proto_transport_proto_rawDescData = protoimpl.X.CompressGZIP(file_transport_grpc_proto_transport_proto_rawDescData) + }) + return file_transport_grpc_proto_transport_proto_rawDescData } -var fileDescriptor_651718cd7c7ae974 = []byte{ - // 209 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x29, 0x29, 0x4a, 0xcc, - 0x2b, 0x2e, 0xc8, 0x2f, 0x2a, 0xd1, 0x4f, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, - 0xd7, 0x87, 0x0b, 0xea, 0x81, 0xf9, 0x42, 0xe2, 0xe9, 0xf9, 0x7a, 0xb9, 0x99, 0xc9, 0x45, 0xf9, - 0x7a, 0x08, 0x19, 0x90, 0x72, 0xa5, 0x79, 0x8c, 0x5c, 0xec, 0xbe, 0xa9, 0xc5, 0xc5, 0x89, 0xe9, - 0xa9, 0x42, 0x2e, 0x5c, 0x6c, 0x19, 0xa9, 0x89, 0x29, 0xa9, 0x45, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, - 0xdc, 0x46, 0x3a, 0x7a, 0x38, 0x74, 0xe9, 0x41, 0x75, 0xe8, 0x79, 0x80, 0x95, 0xbb, 0xe6, 0x95, - 0x14, 0x55, 0x06, 0x41, 0xf5, 0x0a, 0x09, 0x71, 0xb1, 0x24, 0xe5, 0xa7, 0x54, 0x4a, 0x30, 0x29, - 0x30, 0x6a, 0xf0, 0x04, 0x81, 0xd9, 0x52, 0x96, 0x5c, 0xdc, 0x48, 0x4a, 0x85, 0x04, 0xb8, 0x98, - 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x40, 0x4c, 0x21, 0x11, 0x2e, 0xd6, - 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0xb0, 0x2e, 0xce, 0x20, 0x08, 0xc7, 0x8a, 0xc9, 0x82, 0xd1, 0x28, - 0x9e, 0x8b, 0x33, 0x04, 0x66, 0xb9, 0x50, 0x10, 0x17, 0x5b, 0x70, 0x49, 0x51, 0x6a, 0x62, 0xae, - 0x90, 0x02, 0x21, 0xb7, 0x49, 0x11, 0x54, 0xa1, 0xc4, 0xa0, 0xc1, 0x68, 0xc0, 0x98, 0xc4, 0x06, - 0x0e, 0x21, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd4, 0xd0, 0x4b, 0x4b, 0x49, 0x01, 0x00, - 0x00, +var file_transport_grpc_proto_transport_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_transport_grpc_proto_transport_proto_goTypes = []interface{}{ + (*Message)(nil), // 0: go.micro.transport.grpc.Message + nil, // 1: go.micro.transport.grpc.Message.HeaderEntry +} +var file_transport_grpc_proto_transport_proto_depIdxs = []int32{ + 1, // 0: go.micro.transport.grpc.Message.header:type_name -> go.micro.transport.grpc.Message.HeaderEntry + 0, // 1: go.micro.transport.grpc.Transport.Stream:input_type -> go.micro.transport.grpc.Message + 0, // 2: go.micro.transport.grpc.Transport.Stream:output_type -> go.micro.transport.grpc.Message + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// TransportClient is the client API for Transport service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TransportClient interface { - Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error) -} - -type transportClient struct { - cc *grpc.ClientConn -} - -func NewTransportClient(cc *grpc.ClientConn) TransportClient { - return &transportClient{cc} -} - -func (c *transportClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error) { - stream, err := c.cc.NewStream(ctx, &_Transport_serviceDesc.Streams[0], "/go.micro.transport.grpc.Transport/Stream", opts...) - if err != nil { - return nil, err +func init() { file_transport_grpc_proto_transport_proto_init() } +func file_transport_grpc_proto_transport_proto_init() { + if File_transport_grpc_proto_transport_proto != nil { + return } - x := &transportStreamClient{stream} - return x, nil -} - -type Transport_StreamClient interface { - Send(*Message) error - Recv() (*Message, error) - grpc.ClientStream -} - -type transportStreamClient struct { - grpc.ClientStream -} - -func (x *transportStreamClient) Send(m *Message) error { - return x.ClientStream.SendMsg(m) -} - -func (x *transportStreamClient) Recv() (*Message, error) { - m := new(Message) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err + if !protoimpl.UnsafeEnabled { + file_transport_grpc_proto_transport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - return m, nil -} - -// TransportServer is the server API for Transport service. -type TransportServer interface { - Stream(Transport_StreamServer) error -} - -// UnimplementedTransportServer can be embedded to have forward compatible implementations. -type UnimplementedTransportServer struct { -} - -func (*UnimplementedTransportServer) Stream(srv Transport_StreamServer) error { - return status.Errorf(codes.Unimplemented, "method Stream not implemented") -} - -func RegisterTransportServer(s *grpc.Server, srv TransportServer) { - s.RegisterService(&_Transport_serviceDesc, srv) -} - -func _Transport_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TransportServer).Stream(&transportStreamServer{stream}) -} - -type Transport_StreamServer interface { - Send(*Message) error - Recv() (*Message, error) - grpc.ServerStream -} - -type transportStreamServer struct { - grpc.ServerStream -} - -func (x *transportStreamServer) Send(m *Message) error { - return x.ServerStream.SendMsg(m) -} - -func (x *transportStreamServer) Recv() (*Message, error) { - m := new(Message) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _Transport_serviceDesc = grpc.ServiceDesc{ - ServiceName: "go.micro.transport.grpc.Transport", - HandlerType: (*TransportServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Stream", - Handler: _Transport_Stream_Handler, - ServerStreams: true, - ClientStreams: true, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_transport_grpc_proto_transport_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, }, - }, - Metadata: "transport/grpc/proto/transport.proto", + GoTypes: file_transport_grpc_proto_transport_proto_goTypes, + DependencyIndexes: file_transport_grpc_proto_transport_proto_depIdxs, + MessageInfos: file_transport_grpc_proto_transport_proto_msgTypes, + }.Build() + File_transport_grpc_proto_transport_proto = out.File + file_transport_grpc_proto_transport_proto_rawDesc = nil + file_transport_grpc_proto_transport_proto_goTypes = nil + file_transport_grpc_proto_transport_proto_depIdxs = nil } diff --git a/transport/grpc/proto/transport.pb.micro.go b/transport/grpc/proto/transport.pb.micro.go index c5a18636..ec88c7a7 100644 --- a/transport/grpc/proto/transport.pb.micro.go +++ b/transport/grpc/proto/transport.pb.micro.go @@ -11,9 +11,9 @@ import ( import ( context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/transport/grpc/proto/transport_grpc.pb.go b/transport/grpc/proto/transport_grpc.pb.go new file mode 100644 index 00000000..44d040db --- /dev/null +++ b/transport/grpc/proto/transport_grpc.pb.go @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package go_micro_transport_grpc + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// TransportClient is the client API for Transport service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type TransportClient interface { + Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error) +} + +type transportClient struct { + cc grpc.ClientConnInterface +} + +func NewTransportClient(cc grpc.ClientConnInterface) TransportClient { + return &transportClient{cc} +} + +func (c *transportClient) Stream(ctx context.Context, opts ...grpc.CallOption) (Transport_StreamClient, error) { + stream, err := c.cc.NewStream(ctx, &_Transport_serviceDesc.Streams[0], "/go.micro.transport.grpc.Transport/Stream", opts...) + if err != nil { + return nil, err + } + x := &transportStreamClient{stream} + return x, nil +} + +type Transport_StreamClient interface { + Send(*Message) error + Recv() (*Message, error) + grpc.ClientStream +} + +type transportStreamClient struct { + grpc.ClientStream +} + +func (x *transportStreamClient) Send(m *Message) error { + return x.ClientStream.SendMsg(m) +} + +func (x *transportStreamClient) Recv() (*Message, error) { + m := new(Message) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// TransportServer is the server API for Transport service. +// All implementations must embed UnimplementedTransportServer +// for forward compatibility +type TransportServer interface { + Stream(Transport_StreamServer) error + mustEmbedUnimplementedTransportServer() +} + +// UnimplementedTransportServer must be embedded to have forward compatible implementations. +type UnimplementedTransportServer struct { +} + +func (*UnimplementedTransportServer) Stream(Transport_StreamServer) error { + return status.Errorf(codes.Unimplemented, "method Stream not implemented") +} +func (*UnimplementedTransportServer) mustEmbedUnimplementedTransportServer() {} + +func RegisterTransportServer(s *grpc.Server, srv TransportServer) { + s.RegisterService(&_Transport_serviceDesc, srv) +} + +func _Transport_Stream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TransportServer).Stream(&transportStreamServer{stream}) +} + +type Transport_StreamServer interface { + Send(*Message) error + Recv() (*Message, error) + grpc.ServerStream +} + +type transportStreamServer struct { + grpc.ServerStream +} + +func (x *transportStreamServer) Send(m *Message) error { + return x.ServerStream.SendMsg(m) +} + +func (x *transportStreamServer) Recv() (*Message, error) { + m := new(Message) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _Transport_serviceDesc = grpc.ServiceDesc{ + ServiceName: "go.micro.transport.grpc.Transport", + HandlerType: (*TransportServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Stream", + Handler: _Transport_Stream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "transport/grpc/proto/transport.proto", +} diff --git a/transport/grpc/socket.go b/transport/grpc/socket.go index d260800c..88baced8 100644 --- a/transport/grpc/socket.go +++ b/transport/grpc/socket.go @@ -1,8 +1,8 @@ package grpc import ( - "github.com/micro/go-micro/v3/transport" - pb "github.com/micro/go-micro/v3/transport/grpc/proto" + "github.com/unistack-org/micro/v3/transport" + pb "github.com/unistack-org/micro/v3/transport/grpc/proto" "google.golang.org/grpc" ) diff --git a/transport/http/http.go b/transport/http/http.go index 63f3ff58..a73e116f 100644 --- a/transport/http/http.go +++ b/transport/http/http.go @@ -13,11 +13,11 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/transport" - maddr "github.com/micro/go-micro/v3/util/addr" - "github.com/micro/go-micro/v3/util/buf" - mnet "github.com/micro/go-micro/v3/util/net" - mls "github.com/micro/go-micro/v3/util/tls" + "github.com/unistack-org/micro/v3/transport" + maddr "github.com/unistack-org/micro/v3/util/addr" + "github.com/unistack-org/micro/v3/util/buf" + mnet "github.com/unistack-org/micro/v3/util/net" + mls "github.com/unistack-org/micro/v3/util/tls" "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" ) diff --git a/transport/http/http_test.go b/transport/http/http_test.go index 72b4314b..04000a2e 100644 --- a/transport/http/http_test.go +++ b/transport/http/http_test.go @@ -4,7 +4,7 @@ import ( "sync" "testing" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) func call(b *testing.B, c int) { diff --git a/transport/http/http_transport_test.go b/transport/http/http_transport_test.go index 4f26e674..ca1ead1c 100644 --- a/transport/http/http_transport_test.go +++ b/transport/http/http_transport_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) func expectedPort(t *testing.T, expected string, lsn transport.Listener) { diff --git a/transport/http/options.go b/transport/http/options.go index 1f45dba4..3a02a5f7 100644 --- a/transport/http/options.go +++ b/transport/http/options.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) // Handle registers the handler for the given pattern. diff --git a/transport/memory/memory.go b/transport/memory/memory.go index 6d1488e5..faf8a973 100644 --- a/transport/memory/memory.go +++ b/transport/memory/memory.go @@ -10,9 +10,9 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/transport" - maddr "github.com/micro/go-micro/v3/util/addr" - mnet "github.com/micro/go-micro/v3/util/net" + "github.com/unistack-org/micro/v3/transport" + maddr "github.com/unistack-org/micro/v3/util/addr" + mnet "github.com/unistack-org/micro/v3/util/net" ) type memorySocket struct { diff --git a/transport/memory/memory_test.go b/transport/memory/memory_test.go index 5c53fde2..6d759e42 100644 --- a/transport/memory/memory_test.go +++ b/transport/memory/memory_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) func TestMemoryTransport(t *testing.T) { diff --git a/transport/options.go b/transport/options.go index 343bed8d..0fc1617c 100644 --- a/transport/options.go +++ b/transport/options.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "time" - "github.com/micro/go-micro/v3/codec" + "github.com/unistack-org/micro/v3/codec" ) type Options struct { diff --git a/transport/quic/quic.go b/transport/quic/quic.go index 76305b9c..47c00809 100644 --- a/transport/quic/quic.go +++ b/transport/quic/quic.go @@ -8,8 +8,8 @@ import ( "time" quic "github.com/lucas-clemente/quic-go" - "github.com/micro/go-micro/v3/transport" - utls "github.com/micro/go-micro/v3/util/tls" + "github.com/unistack-org/micro/v3/transport" + utls "github.com/unistack-org/micro/v3/util/tls" ) type quicSocket struct { diff --git a/tunnel/broker/broker.go b/tunnel/broker/broker.go index caa1eb27..578317f8 100644 --- a/tunnel/broker/broker.go +++ b/tunnel/broker/broker.go @@ -4,10 +4,10 @@ package broker import ( "context" - "github.com/micro/go-micro/v3/broker" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" - "github.com/micro/go-micro/v3/tunnel/mucp" + "github.com/unistack-org/micro/v3/broker" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" + "github.com/unistack-org/micro/v3/tunnel/mucp" ) type tunBroker struct { diff --git a/tunnel/mucp/crypto.go b/tunnel/mucp/crypto.go index 534e96f2..3ab5493d 100644 --- a/tunnel/mucp/crypto.go +++ b/tunnel/mucp/crypto.go @@ -6,7 +6,7 @@ import ( "crypto/rand" "crypto/sha256" - "github.com/micro/go-micro/v3/tunnel" + "github.com/unistack-org/micro/v3/tunnel" "github.com/oxtoacart/bpool" ) diff --git a/tunnel/mucp/link.go b/tunnel/mucp/link.go index aa34f085..655ece18 100644 --- a/tunnel/mucp/link.go +++ b/tunnel/mucp/link.go @@ -8,8 +8,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/transport" ) type link struct { diff --git a/tunnel/mucp/listener.go b/tunnel/mucp/listener.go index c1d6a305..452d4770 100644 --- a/tunnel/mucp/listener.go +++ b/tunnel/mucp/listener.go @@ -4,8 +4,8 @@ import ( "io" "sync" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/tunnel" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/tunnel" ) type tunListener struct { diff --git a/tunnel/mucp/mucp.go b/tunnel/mucp/mucp.go index 37329bd2..d9d8103f 100644 --- a/tunnel/mucp/mucp.go +++ b/tunnel/mucp/mucp.go @@ -8,9 +8,9 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" ) var ( diff --git a/tunnel/mucp/mucp_test.go b/tunnel/mucp/mucp_test.go index 7be28ec6..4c022250 100644 --- a/tunnel/mucp/mucp_test.go +++ b/tunnel/mucp/mucp_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" ) func testBrokenTunAccept(t *testing.T, tun tunnel.Tunnel, wait chan bool, wg *sync.WaitGroup) { diff --git a/tunnel/mucp/session.go b/tunnel/mucp/session.go index e73d924b..38a59d25 100644 --- a/tunnel/mucp/session.go +++ b/tunnel/mucp/session.go @@ -7,9 +7,9 @@ import ( "sync" "time" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" ) // session is our pseudo session for transport.Socket diff --git a/tunnel/options.go b/tunnel/options.go index 6b055c7b..fb6b1f52 100644 --- a/tunnel/options.go +++ b/tunnel/options.go @@ -4,8 +4,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/transport/quic" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/transport/quic" ) var ( diff --git a/tunnel/transport/listener.go b/tunnel/transport/listener.go index bdb848ea..2ef48244 100644 --- a/tunnel/transport/listener.go +++ b/tunnel/transport/listener.go @@ -1,8 +1,8 @@ package transport import ( - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" ) type tunListener struct { diff --git a/tunnel/transport/transport.go b/tunnel/transport/transport.go index f96b2b30..095b96a7 100644 --- a/tunnel/transport/transport.go +++ b/tunnel/transport/transport.go @@ -4,9 +4,9 @@ package transport import ( "context" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/tunnel" - "github.com/micro/go-micro/v3/tunnel/mucp" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/tunnel" + "github.com/unistack-org/micro/v3/tunnel/mucp" ) type tunTransport struct { diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 55fed2ad..7beee57f 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) const ( diff --git a/util/auth/auth.go b/util/auth/auth.go index 07eea23a..b715a9d4 100644 --- a/util/auth/auth.go +++ b/util/auth/auth.go @@ -4,8 +4,8 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/logger" ) // Verify the auth credentials and refresh the auth token periodically diff --git a/util/client/client.go b/util/client/client.go index 284d801e..0f680b80 100644 --- a/util/client/client.go +++ b/util/client/client.go @@ -3,7 +3,7 @@ package client import ( "context" - "github.com/micro/go-micro/v3/client" + "github.com/unistack-org/micro/v3/client" ) type staticClient struct { diff --git a/util/client/client_test.go b/util/client/client_test.go index aa78ab11..e9317114 100644 --- a/util/client/client_test.go +++ b/util/client/client_test.go @@ -4,17 +4,17 @@ import ( "context" "testing" - "github.com/micro/go-micro/v3/broker" - bmemory "github.com/micro/go-micro/v3/broker/memory" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/client/grpc" - rmemory "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" - rtreg "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/server" - grpcsrv "github.com/micro/go-micro/v3/server/grpc" - tmemory "github.com/micro/go-micro/v3/transport/memory" - cw "github.com/micro/go-micro/v3/util/client" + "github.com/unistack-org/micro/v3/broker" + bmemory "github.com/unistack-org/micro/v3/broker/memory" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/client/grpc" + rmemory "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" + rtreg "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/server" + grpcsrv "github.com/unistack-org/micro/v3/server/grpc" + tmemory "github.com/unistack-org/micro/v3/transport/memory" + cw "github.com/unistack-org/micro/v3/util/client" ) type TestFoo struct { diff --git a/util/ctx/ctx.go b/util/ctx/ctx.go index c28e30a4..6e96bfde 100644 --- a/util/ctx/ctx.go +++ b/util/ctx/ctx.go @@ -6,7 +6,7 @@ import ( "net/textproto" "strings" - "github.com/micro/go-micro/v3/metadata" + "github.com/unistack-org/micro/v3/metadata" ) func FromRequest(r *http.Request) context.Context { diff --git a/util/ctx/ctx_test.go b/util/ctx/ctx_test.go index 8e28a4cc..10e62200 100644 --- a/util/ctx/ctx_test.go +++ b/util/ctx/ctx_test.go @@ -4,7 +4,7 @@ import ( "net/http" "testing" - "github.com/micro/go-micro/v3/metadata" + "github.com/unistack-org/micro/v3/metadata" ) func TestRequestToContext(t *testing.T) { diff --git a/util/file/client.go b/util/file/client.go index 1be623a5..5163a8ab 100644 --- a/util/file/client.go +++ b/util/file/client.go @@ -9,8 +9,8 @@ import ( "log" "os" - "github.com/micro/go-micro/v3/client" - proto "github.com/micro/go-micro/v3/util/file/proto" + "github.com/unistack-org/micro/v3/client" + proto "github.com/unistack-org/micro/v3/util/file/proto" ) // Client is the client interface to access files diff --git a/util/file/handler.go b/util/file/handler.go index 2d0c1669..ffddb22a 100644 --- a/util/file/handler.go +++ b/util/file/handler.go @@ -6,10 +6,10 @@ import ( "path/filepath" "sync" - "github.com/micro/go-micro/v3/errors" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/server" - proto "github.com/micro/go-micro/v3/util/file/proto" + "github.com/unistack-org/micro/v3/errors" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/server" + proto "github.com/unistack-org/micro/v3/util/file/proto" "golang.org/x/net/context" ) diff --git a/util/file/proto/file.pb.go b/util/file/proto/file.pb.go index 826ca43b..14dd9504 100644 --- a/util/file/proto/file.pb.go +++ b/util/file/proto/file.pb.go @@ -1,854 +1,967 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.6.1 // source: util/file/proto/file.proto package go_micro_server import ( - context "context" - fmt "fmt" proto "github.com/golang/protobuf/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - 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 OpenRequest struct { - Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` - Truncate bool `protobuf:"varint,2,opt,name=truncate,proto3" json:"truncate,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + Truncate bool `protobuf:"varint,2,opt,name=truncate,proto3" json:"truncate,omitempty"` } -func (m *OpenRequest) Reset() { *m = OpenRequest{} } -func (m *OpenRequest) String() string { return proto.CompactTextString(m) } -func (*OpenRequest) ProtoMessage() {} +func (x *OpenRequest) Reset() { + *x = OpenRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OpenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpenRequest) ProtoMessage() {} + +func (x *OpenRequest) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_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 OpenRequest.ProtoReflect.Descriptor instead. func (*OpenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{0} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{0} } -func (m *OpenRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OpenRequest.Unmarshal(m, b) -} -func (m *OpenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OpenRequest.Marshal(b, m, deterministic) -} -func (m *OpenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_OpenRequest.Merge(m, src) -} -func (m *OpenRequest) XXX_Size() int { - return xxx_messageInfo_OpenRequest.Size(m) -} -func (m *OpenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_OpenRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_OpenRequest proto.InternalMessageInfo - -func (m *OpenRequest) GetFilename() string { - if m != nil { - return m.Filename +func (x *OpenRequest) GetFilename() string { + if x != nil { + return x.Filename } return "" } -func (m *OpenRequest) GetTruncate() bool { - if m != nil { - return m.Truncate +func (x *OpenRequest) GetTruncate() bool { + if x != nil { + return x.Truncate } return false } type OpenResponse struct { - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Result bool `protobuf:"varint,2,opt,name=result,proto3" json:"result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Result bool `protobuf:"varint,2,opt,name=result,proto3" json:"result,omitempty"` } -func (m *OpenResponse) Reset() { *m = OpenResponse{} } -func (m *OpenResponse) String() string { return proto.CompactTextString(m) } -func (*OpenResponse) ProtoMessage() {} +func (x *OpenResponse) Reset() { + *x = OpenResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OpenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OpenResponse) ProtoMessage() {} + +func (x *OpenResponse) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_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 OpenResponse.ProtoReflect.Descriptor instead. func (*OpenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{1} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{1} } -func (m *OpenResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OpenResponse.Unmarshal(m, b) -} -func (m *OpenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OpenResponse.Marshal(b, m, deterministic) -} -func (m *OpenResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_OpenResponse.Merge(m, src) -} -func (m *OpenResponse) XXX_Size() int { - return xxx_messageInfo_OpenResponse.Size(m) -} -func (m *OpenResponse) XXX_DiscardUnknown() { - xxx_messageInfo_OpenResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_OpenResponse proto.InternalMessageInfo - -func (m *OpenResponse) GetId() int64 { - if m != nil { - return m.Id +func (x *OpenResponse) GetId() int64 { + if x != nil { + return x.Id } return 0 } -func (m *OpenResponse) GetResult() bool { - if m != nil { - return m.Result +func (x *OpenResponse) GetResult() bool { + if x != nil { + return x.Result } return false } type CloseRequest struct { - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` } -func (m *CloseRequest) Reset() { *m = CloseRequest{} } -func (m *CloseRequest) String() string { return proto.CompactTextString(m) } -func (*CloseRequest) ProtoMessage() {} +func (x *CloseRequest) Reset() { + *x = CloseRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseRequest) ProtoMessage() {} + +func (x *CloseRequest) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[2] + 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 CloseRequest.ProtoReflect.Descriptor instead. func (*CloseRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{2} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{2} } -func (m *CloseRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CloseRequest.Unmarshal(m, b) -} -func (m *CloseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CloseRequest.Marshal(b, m, deterministic) -} -func (m *CloseRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CloseRequest.Merge(m, src) -} -func (m *CloseRequest) XXX_Size() int { - return xxx_messageInfo_CloseRequest.Size(m) -} -func (m *CloseRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CloseRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CloseRequest proto.InternalMessageInfo - -func (m *CloseRequest) GetId() int64 { - if m != nil { - return m.Id +func (x *CloseRequest) GetId() int64 { + if x != nil { + return x.Id } return 0 } type CloseResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *CloseResponse) Reset() { *m = CloseResponse{} } -func (m *CloseResponse) String() string { return proto.CompactTextString(m) } -func (*CloseResponse) ProtoMessage() {} +func (x *CloseResponse) Reset() { + *x = CloseResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CloseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CloseResponse) ProtoMessage() {} + +func (x *CloseResponse) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[3] + 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 CloseResponse.ProtoReflect.Descriptor instead. func (*CloseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{3} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{3} } -func (m *CloseResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CloseResponse.Unmarshal(m, b) -} -func (m *CloseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CloseResponse.Marshal(b, m, deterministic) -} -func (m *CloseResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CloseResponse.Merge(m, src) -} -func (m *CloseResponse) XXX_Size() int { - return xxx_messageInfo_CloseResponse.Size(m) -} -func (m *CloseResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CloseResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_CloseResponse proto.InternalMessageInfo - type StatRequest struct { - Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` } -func (m *StatRequest) Reset() { *m = StatRequest{} } -func (m *StatRequest) String() string { return proto.CompactTextString(m) } -func (*StatRequest) ProtoMessage() {} +func (x *StatRequest) Reset() { + *x = StatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatRequest) ProtoMessage() {} + +func (x *StatRequest) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[4] + 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 StatRequest.ProtoReflect.Descriptor instead. func (*StatRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{4} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{4} } -func (m *StatRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatRequest.Unmarshal(m, b) -} -func (m *StatRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatRequest.Marshal(b, m, deterministic) -} -func (m *StatRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatRequest.Merge(m, src) -} -func (m *StatRequest) XXX_Size() int { - return xxx_messageInfo_StatRequest.Size(m) -} -func (m *StatRequest) XXX_DiscardUnknown() { - xxx_messageInfo_StatRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_StatRequest proto.InternalMessageInfo - -func (m *StatRequest) GetFilename() string { - if m != nil { - return m.Filename +func (x *StatRequest) GetFilename() string { + if x != nil { + return x.Filename } return "" } type StatResponse struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` - LastModified int64 `protobuf:"varint,3,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + LastModified int64 `protobuf:"varint,3,opt,name=last_modified,json=lastModified,proto3" json:"last_modified,omitempty"` } -func (m *StatResponse) Reset() { *m = StatResponse{} } -func (m *StatResponse) String() string { return proto.CompactTextString(m) } -func (*StatResponse) ProtoMessage() {} +func (x *StatResponse) Reset() { + *x = StatResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatResponse) ProtoMessage() {} + +func (x *StatResponse) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[5] + 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 StatResponse.ProtoReflect.Descriptor instead. func (*StatResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{5} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{5} } -func (m *StatResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StatResponse.Unmarshal(m, b) -} -func (m *StatResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StatResponse.Marshal(b, m, deterministic) -} -func (m *StatResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_StatResponse.Merge(m, src) -} -func (m *StatResponse) XXX_Size() int { - return xxx_messageInfo_StatResponse.Size(m) -} -func (m *StatResponse) XXX_DiscardUnknown() { - xxx_messageInfo_StatResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_StatResponse proto.InternalMessageInfo - -func (m *StatResponse) GetType() string { - if m != nil { - return m.Type +func (x *StatResponse) GetType() string { + if x != nil { + return x.Type } return "" } -func (m *StatResponse) GetSize() int64 { - if m != nil { - return m.Size +func (x *StatResponse) GetSize() int64 { + if x != nil { + return x.Size } return 0 } -func (m *StatResponse) GetLastModified() int64 { - if m != nil { - return m.LastModified +func (x *StatResponse) GetLastModified() int64 { + if x != nil { + return x.LastModified } return 0 } type ReadRequest struct { - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` - Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` } -func (m *ReadRequest) Reset() { *m = ReadRequest{} } -func (m *ReadRequest) String() string { return proto.CompactTextString(m) } -func (*ReadRequest) ProtoMessage() {} +func (x *ReadRequest) Reset() { + *x = ReadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadRequest) ProtoMessage() {} + +func (x *ReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[6] + 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 ReadRequest.ProtoReflect.Descriptor instead. func (*ReadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{6} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{6} } -func (m *ReadRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadRequest.Unmarshal(m, b) -} -func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic) -} -func (m *ReadRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadRequest.Merge(m, src) -} -func (m *ReadRequest) XXX_Size() int { - return xxx_messageInfo_ReadRequest.Size(m) -} -func (m *ReadRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ReadRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ReadRequest proto.InternalMessageInfo - -func (m *ReadRequest) GetId() int64 { - if m != nil { - return m.Id +func (x *ReadRequest) GetId() int64 { + if x != nil { + return x.Id } return 0 } -func (m *ReadRequest) GetOffset() int64 { - if m != nil { - return m.Offset +func (x *ReadRequest) GetOffset() int64 { + if x != nil { + return x.Offset } return 0 } -func (m *ReadRequest) GetSize() int64 { - if m != nil { - return m.Size +func (x *ReadRequest) GetSize() int64 { + if x != nil { + return x.Size } return 0 } type ReadResponse struct { - Size int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - Eof bool `protobuf:"varint,3,opt,name=eof,proto3" json:"eof,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Size int64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Eof bool `protobuf:"varint,3,opt,name=eof,proto3" json:"eof,omitempty"` } -func (m *ReadResponse) Reset() { *m = ReadResponse{} } -func (m *ReadResponse) String() string { return proto.CompactTextString(m) } -func (*ReadResponse) ProtoMessage() {} +func (x *ReadResponse) Reset() { + *x = ReadResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadResponse) ProtoMessage() {} + +func (x *ReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[7] + 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 ReadResponse.ProtoReflect.Descriptor instead. func (*ReadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{7} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{7} } -func (m *ReadResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ReadResponse.Unmarshal(m, b) -} -func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic) -} -func (m *ReadResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ReadResponse.Merge(m, src) -} -func (m *ReadResponse) XXX_Size() int { - return xxx_messageInfo_ReadResponse.Size(m) -} -func (m *ReadResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ReadResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ReadResponse proto.InternalMessageInfo - -func (m *ReadResponse) GetSize() int64 { - if m != nil { - return m.Size +func (x *ReadResponse) GetSize() int64 { + if x != nil { + return x.Size } return 0 } -func (m *ReadResponse) GetData() []byte { - if m != nil { - return m.Data +func (x *ReadResponse) GetData() []byte { + if x != nil { + return x.Data } return nil } -func (m *ReadResponse) GetEof() bool { - if m != nil { - return m.Eof +func (x *ReadResponse) GetEof() bool { + if x != nil { + return x.Eof } return false } type GetRequest struct { - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - BlockId int64 `protobuf:"varint,2,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + BlockId int64 `protobuf:"varint,2,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` } -func (m *GetRequest) Reset() { *m = GetRequest{} } -func (m *GetRequest) String() string { return proto.CompactTextString(m) } -func (*GetRequest) ProtoMessage() {} +func (x *GetRequest) Reset() { + *x = GetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetRequest) ProtoMessage() {} + +func (x *GetRequest) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[8] + 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 GetRequest.ProtoReflect.Descriptor instead. func (*GetRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{8} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{8} } -func (m *GetRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetRequest.Unmarshal(m, b) -} -func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetRequest.Marshal(b, m, deterministic) -} -func (m *GetRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetRequest.Merge(m, src) -} -func (m *GetRequest) XXX_Size() int { - return xxx_messageInfo_GetRequest.Size(m) -} -func (m *GetRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_GetRequest proto.InternalMessageInfo - -func (m *GetRequest) GetId() int64 { - if m != nil { - return m.Id +func (x *GetRequest) GetId() int64 { + if x != nil { + return x.Id } return 0 } -func (m *GetRequest) GetBlockId() int64 { - if m != nil { - return m.BlockId +func (x *GetRequest) GetBlockId() int64 { + if x != nil { + return x.BlockId } return 0 } type GetResponse struct { - BlockId int64 `protobuf:"varint,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` - Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BlockId int64 `protobuf:"varint,1,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` } -func (m *GetResponse) Reset() { *m = GetResponse{} } -func (m *GetResponse) String() string { return proto.CompactTextString(m) } -func (*GetResponse) ProtoMessage() {} +func (x *GetResponse) Reset() { + *x = GetResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetResponse) ProtoMessage() {} + +func (x *GetResponse) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[9] + 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 GetResponse.ProtoReflect.Descriptor instead. func (*GetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{9} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{9} } -func (m *GetResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetResponse.Unmarshal(m, b) -} -func (m *GetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetResponse.Marshal(b, m, deterministic) -} -func (m *GetResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetResponse.Merge(m, src) -} -func (m *GetResponse) XXX_Size() int { - return xxx_messageInfo_GetResponse.Size(m) -} -func (m *GetResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_GetResponse proto.InternalMessageInfo - -func (m *GetResponse) GetBlockId() int64 { - if m != nil { - return m.BlockId +func (x *GetResponse) GetBlockId() int64 { + if x != nil { + return x.BlockId } return 0 } -func (m *GetResponse) GetSize() int64 { - if m != nil { - return m.Size +func (x *GetResponse) GetSize() int64 { + if x != nil { + return x.Size } return 0 } -func (m *GetResponse) GetData() []byte { - if m != nil { - return m.Data +func (x *GetResponse) GetData() []byte { + if x != nil { + return x.Data } return nil } type WriteRequest struct { - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` } -func (m *WriteRequest) Reset() { *m = WriteRequest{} } -func (m *WriteRequest) String() string { return proto.CompactTextString(m) } -func (*WriteRequest) ProtoMessage() {} +func (x *WriteRequest) Reset() { + *x = WriteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteRequest) ProtoMessage() {} + +func (x *WriteRequest) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[10] + 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 WriteRequest.ProtoReflect.Descriptor instead. func (*WriteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{10} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{10} } -func (m *WriteRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteRequest.Unmarshal(m, b) -} -func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic) -} -func (m *WriteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteRequest.Merge(m, src) -} -func (m *WriteRequest) XXX_Size() int { - return xxx_messageInfo_WriteRequest.Size(m) -} -func (m *WriteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_WriteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_WriteRequest proto.InternalMessageInfo - -func (m *WriteRequest) GetId() int64 { - if m != nil { - return m.Id +func (x *WriteRequest) GetId() int64 { + if x != nil { + return x.Id } return 0 } -func (m *WriteRequest) GetOffset() int64 { - if m != nil { - return m.Offset +func (x *WriteRequest) GetOffset() int64 { + if x != nil { + return x.Offset } return 0 } -func (m *WriteRequest) GetData() []byte { - if m != nil { - return m.Data +func (x *WriteRequest) GetData() []byte { + if x != nil { + return x.Data } return nil } type WriteResponse struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (m *WriteResponse) Reset() { *m = WriteResponse{} } -func (m *WriteResponse) String() string { return proto.CompactTextString(m) } -func (*WriteResponse) ProtoMessage() {} +func (x *WriteResponse) Reset() { + *x = WriteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_util_file_proto_file_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WriteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteResponse) ProtoMessage() {} + +func (x *WriteResponse) ProtoReflect() protoreflect.Message { + mi := &file_util_file_proto_file_proto_msgTypes[11] + 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 WriteResponse.ProtoReflect.Descriptor instead. func (*WriteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c90a6c4a93f92bf4, []int{11} + return file_util_file_proto_file_proto_rawDescGZIP(), []int{11} } -func (m *WriteResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_WriteResponse.Unmarshal(m, b) -} -func (m *WriteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_WriteResponse.Marshal(b, m, deterministic) -} -func (m *WriteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_WriteResponse.Merge(m, src) -} -func (m *WriteResponse) XXX_Size() int { - return xxx_messageInfo_WriteResponse.Size(m) -} -func (m *WriteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_WriteResponse.DiscardUnknown(m) +var File_util_file_proto_file_proto protoreflect.FileDescriptor + +var file_util_file_proto_file_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67, 0x6f, + 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x45, 0x0a, + 0x0b, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x72, 0x75, 0x6e, + 0x63, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x74, 0x72, 0x75, 0x6e, + 0x63, 0x61, 0x74, 0x65, 0x22, 0x36, 0x0a, 0x0c, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1e, 0x0a, 0x0c, + 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22, 0x0f, 0x0a, 0x0d, + 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, + 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x5b, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x12, 0x23, 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x64, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x22, 0x49, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x22, 0x48, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, + 0x73, 0x69, 0x7a, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6f, 0x66, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x65, 0x6f, 0x66, 0x22, 0x37, 0x0a, 0x0a, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x4a, 0x0a, 0x0c, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x22, 0x0f, 0x0a, 0x0d, 0x57, 0x72, 0x69, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x32, 0xef, 0x02, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x45, 0x0a, 0x04, 0x4f, + 0x70, 0x65, 0x6e, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x45, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, + 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x45, 0x0a, 0x04, 0x52, 0x65, 0x61, + 0x64, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x48, 0x0a, 0x05, 0x57, 0x72, 0x69, 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, + 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x57, 0x72, 0x69, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x05, 0x43, 0x6c, + 0x6f, 0x73, 0x65, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x6f, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -var xxx_messageInfo_WriteResponse proto.InternalMessageInfo +var ( + file_util_file_proto_file_proto_rawDescOnce sync.Once + file_util_file_proto_file_proto_rawDescData = file_util_file_proto_file_proto_rawDesc +) -func init() { - proto.RegisterType((*OpenRequest)(nil), "go.micro.server.OpenRequest") - proto.RegisterType((*OpenResponse)(nil), "go.micro.server.OpenResponse") - proto.RegisterType((*CloseRequest)(nil), "go.micro.server.CloseRequest") - proto.RegisterType((*CloseResponse)(nil), "go.micro.server.CloseResponse") - proto.RegisterType((*StatRequest)(nil), "go.micro.server.StatRequest") - proto.RegisterType((*StatResponse)(nil), "go.micro.server.StatResponse") - proto.RegisterType((*ReadRequest)(nil), "go.micro.server.ReadRequest") - proto.RegisterType((*ReadResponse)(nil), "go.micro.server.ReadResponse") - proto.RegisterType((*GetRequest)(nil), "go.micro.server.GetRequest") - proto.RegisterType((*GetResponse)(nil), "go.micro.server.GetResponse") - proto.RegisterType((*WriteRequest)(nil), "go.micro.server.WriteRequest") - proto.RegisterType((*WriteResponse)(nil), "go.micro.server.WriteResponse") +func file_util_file_proto_file_proto_rawDescGZIP() []byte { + file_util_file_proto_file_proto_rawDescOnce.Do(func() { + file_util_file_proto_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_util_file_proto_file_proto_rawDescData) + }) + return file_util_file_proto_file_proto_rawDescData } -func init() { proto.RegisterFile("util/file/proto/file.proto", fileDescriptor_c90a6c4a93f92bf4) } - -var fileDescriptor_c90a6c4a93f92bf4 = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcf, 0x8e, 0xd3, 0x30, - 0x10, 0xc6, 0x9b, 0x3f, 0x2c, 0x61, 0x92, 0x52, 0xe4, 0x03, 0x2a, 0x11, 0xac, 0x56, 0xe6, 0xb2, - 0x5c, 0xb2, 0x12, 0x48, 0xf0, 0x00, 0x68, 0x61, 0x17, 0x09, 0x81, 0xcc, 0x81, 0x03, 0x87, 0x55, - 0xb6, 0x9e, 0x20, 0x8b, 0x34, 0x0e, 0xb1, 0x83, 0x04, 0x2f, 0xcd, 0x2b, 0x20, 0x3b, 0x6e, 0xeb, - 0xb6, 0x89, 0x84, 0xf6, 0x36, 0xe3, 0x19, 0xff, 0xfc, 0xd9, 0xf9, 0x26, 0x90, 0xf7, 0x5a, 0xd4, - 0x17, 0x95, 0xa8, 0xf1, 0xa2, 0xed, 0xa4, 0x96, 0x36, 0x2c, 0x6c, 0x48, 0x16, 0xdf, 0x65, 0xb1, - 0x16, 0xab, 0x4e, 0x16, 0x0a, 0xbb, 0x5f, 0xd8, 0xd1, 0x4b, 0x48, 0x3f, 0xb5, 0xd8, 0x30, 0xfc, - 0xd9, 0xa3, 0xd2, 0x24, 0x87, 0xc4, 0x74, 0x37, 0xe5, 0x1a, 0x97, 0xc1, 0x59, 0x70, 0xfe, 0x80, - 0x6d, 0x73, 0x53, 0xd3, 0x5d, 0xdf, 0xac, 0x4a, 0x8d, 0xcb, 0xf0, 0x2c, 0x38, 0x4f, 0xd8, 0x36, - 0xa7, 0xaf, 0x21, 0x1b, 0x30, 0xaa, 0x95, 0x8d, 0x42, 0xf2, 0x10, 0x42, 0xc1, 0x2d, 0x21, 0x62, - 0xa1, 0xe0, 0xe4, 0x31, 0x9c, 0x74, 0xa8, 0xfa, 0x5a, 0xbb, 0x9d, 0x2e, 0xa3, 0xa7, 0x90, 0xbd, - 0xad, 0xa5, 0xc2, 0xcd, 0xf9, 0x07, 0xfb, 0xe8, 0x02, 0xe6, 0xae, 0x3e, 0x80, 0xe9, 0x0b, 0x48, - 0xbf, 0xe8, 0x52, 0xff, 0x87, 0x5e, 0xfa, 0x0d, 0xb2, 0xa1, 0xd5, 0x69, 0x22, 0x10, 0xeb, 0xdf, - 0xed, 0xa6, 0xcf, 0xc6, 0x66, 0x4d, 0x89, 0x3f, 0xc3, 0x7d, 0x22, 0x66, 0x63, 0xf2, 0x1c, 0xe6, - 0x75, 0xa9, 0xf4, 0xcd, 0x5a, 0x72, 0x51, 0x09, 0xe4, 0xcb, 0xc8, 0x16, 0x33, 0xb3, 0xf8, 0xd1, - 0xad, 0xd1, 0x6b, 0x48, 0x19, 0x96, 0x7c, 0x42, 0xb7, 0xb9, 0xaf, 0xac, 0x2a, 0x85, 0xda, 0x91, - 0x5d, 0xb6, 0x3d, 0x2f, 0xda, 0x9d, 0x47, 0xaf, 0x20, 0x1b, 0x50, 0x3b, 0x9d, 0xb6, 0x27, 0xf0, - 0x34, 0x11, 0x88, 0x79, 0xa9, 0x4b, 0x4b, 0xcb, 0x98, 0x8d, 0xc9, 0x23, 0x88, 0x50, 0x56, 0x16, - 0x95, 0x30, 0x13, 0xd2, 0x37, 0x00, 0xef, 0x51, 0x4f, 0x69, 0x7a, 0x02, 0xc9, 0x6d, 0x2d, 0x57, - 0x3f, 0x6e, 0x04, 0x77, 0xaa, 0xee, 0xdb, 0xfc, 0x9a, 0xd3, 0xcf, 0x90, 0xda, 0x8d, 0x4e, 0x81, - 0xdf, 0x19, 0xec, 0x75, 0x8e, 0x3e, 0xd8, 0x46, 0x5c, 0xb4, 0x13, 0x47, 0x3f, 0x40, 0xf6, 0xb5, - 0x13, 0x1a, 0xef, 0xf0, 0x40, 0x47, 0xac, 0x05, 0xcc, 0x1d, 0x6b, 0xd0, 0xf7, 0xf2, 0x6f, 0x08, - 0xf1, 0x3b, 0x51, 0x23, 0xb9, 0x84, 0xd8, 0xd8, 0x8e, 0x3c, 0x2d, 0x0e, 0x7c, 0x5d, 0x78, 0xa6, - 0xce, 0x9f, 0x4d, 0x54, 0x9d, 0xa5, 0x66, 0x06, 0x63, 0x9c, 0x32, 0x82, 0xf1, 0xbc, 0x36, 0x82, - 0xf1, 0xed, 0x35, 0x60, 0xcc, 0x87, 0x1c, 0xc1, 0x78, 0x56, 0x19, 0xc1, 0xf8, 0x5f, 0x9f, 0xce, - 0xc8, 0x15, 0xdc, 0xb3, 0xd7, 0x25, 0xc7, 0x9d, 0xfe, 0x93, 0xe6, 0xa7, 0x53, 0x65, 0x9f, 0x64, - 0xa7, 0x67, 0x84, 0xe4, 0x4f, 0xdd, 0x08, 0x69, 0x7f, 0xe8, 0x66, 0xb7, 0x27, 0xf6, 0xf7, 0xf1, - 0xea, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x08, 0x7e, 0x74, 0x5c, 0x04, 0x00, 0x00, +var file_util_file_proto_file_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_util_file_proto_file_proto_goTypes = []interface{}{ + (*OpenRequest)(nil), // 0: go.micro.server.OpenRequest + (*OpenResponse)(nil), // 1: go.micro.server.OpenResponse + (*CloseRequest)(nil), // 2: go.micro.server.CloseRequest + (*CloseResponse)(nil), // 3: go.micro.server.CloseResponse + (*StatRequest)(nil), // 4: go.micro.server.StatRequest + (*StatResponse)(nil), // 5: go.micro.server.StatResponse + (*ReadRequest)(nil), // 6: go.micro.server.ReadRequest + (*ReadResponse)(nil), // 7: go.micro.server.ReadResponse + (*GetRequest)(nil), // 8: go.micro.server.GetRequest + (*GetResponse)(nil), // 9: go.micro.server.GetResponse + (*WriteRequest)(nil), // 10: go.micro.server.WriteRequest + (*WriteResponse)(nil), // 11: go.micro.server.WriteResponse +} +var file_util_file_proto_file_proto_depIdxs = []int32{ + 0, // 0: go.micro.server.File.Open:input_type -> go.micro.server.OpenRequest + 4, // 1: go.micro.server.File.Stat:input_type -> go.micro.server.StatRequest + 6, // 2: go.micro.server.File.Read:input_type -> go.micro.server.ReadRequest + 10, // 3: go.micro.server.File.Write:input_type -> go.micro.server.WriteRequest + 2, // 4: go.micro.server.File.Close:input_type -> go.micro.server.CloseRequest + 1, // 5: go.micro.server.File.Open:output_type -> go.micro.server.OpenResponse + 5, // 6: go.micro.server.File.Stat:output_type -> go.micro.server.StatResponse + 7, // 7: go.micro.server.File.Read:output_type -> go.micro.server.ReadResponse + 11, // 8: go.micro.server.File.Write:output_type -> go.micro.server.WriteResponse + 3, // 9: go.micro.server.File.Close:output_type -> go.micro.server.CloseResponse + 5, // [5:10] is the sub-list for method output_type + 0, // [0:5] 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 } -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// FileClient is the client API for File service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type FileClient interface { - Open(ctx context.Context, in *OpenRequest, opts ...grpc.CallOption) (*OpenResponse, error) - Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) - Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) - Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) - Close(ctx context.Context, in *CloseRequest, opts ...grpc.CallOption) (*CloseResponse, error) -} - -type fileClient struct { - cc *grpc.ClientConn -} - -func NewFileClient(cc *grpc.ClientConn) FileClient { - return &fileClient{cc} -} - -func (c *fileClient) Open(ctx context.Context, in *OpenRequest, opts ...grpc.CallOption) (*OpenResponse, error) { - out := new(OpenResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.File/Open", in, out, opts...) - if err != nil { - return nil, err +func init() { file_util_file_proto_file_proto_init() } +func file_util_file_proto_file_proto_init() { + if File_util_file_proto_file_proto != nil { + return } - return out, nil -} - -func (c *fileClient) Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) { - out := new(StatResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.File/Stat", in, out, opts...) - if err != nil { - return nil, err + if !protoimpl.UnsafeEnabled { + file_util_file_proto_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OpenRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OpenResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CloseResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReadResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_util_file_proto_file_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WriteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } - return out, nil -} - -func (c *fileClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) { - out := new(ReadResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.File/Read", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *fileClient) Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) { - out := new(WriteResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.File/Write", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *fileClient) Close(ctx context.Context, in *CloseRequest, opts ...grpc.CallOption) (*CloseResponse, error) { - out := new(CloseResponse) - err := c.cc.Invoke(ctx, "/go.micro.server.File/Close", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// FileServer is the server API for File service. -type FileServer interface { - Open(context.Context, *OpenRequest) (*OpenResponse, error) - Stat(context.Context, *StatRequest) (*StatResponse, error) - Read(context.Context, *ReadRequest) (*ReadResponse, error) - Write(context.Context, *WriteRequest) (*WriteResponse, error) - Close(context.Context, *CloseRequest) (*CloseResponse, error) -} - -// UnimplementedFileServer can be embedded to have forward compatible implementations. -type UnimplementedFileServer struct { -} - -func (*UnimplementedFileServer) Open(ctx context.Context, req *OpenRequest) (*OpenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Open not implemented") -} -func (*UnimplementedFileServer) Stat(ctx context.Context, req *StatRequest) (*StatResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stat not implemented") -} -func (*UnimplementedFileServer) Read(ctx context.Context, req *ReadRequest) (*ReadResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Read not implemented") -} -func (*UnimplementedFileServer) Write(ctx context.Context, req *WriteRequest) (*WriteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Write not implemented") -} -func (*UnimplementedFileServer) Close(ctx context.Context, req *CloseRequest) (*CloseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Close not implemented") -} - -func RegisterFileServer(s *grpc.Server, srv FileServer) { - s.RegisterService(&_File_serviceDesc, srv) -} - -func _File_Open_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Open(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.File/Open", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Open(ctx, req.(*OpenRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _File_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StatRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Stat(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.File/Stat", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Stat(ctx, req.(*StatRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _File_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Read(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.File/Read", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Read(ctx, req.(*ReadRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _File_Write_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WriteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Write(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.File/Write", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Write(ctx, req.(*WriteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _File_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(FileServer).Close(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/go.micro.server.File/Close", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(FileServer).Close(ctx, req.(*CloseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _File_serviceDesc = grpc.ServiceDesc{ - ServiceName: "go.micro.server.File", - HandlerType: (*FileServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Open", - Handler: _File_Open_Handler, + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_util_file_proto_file_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, }, - { - MethodName: "Stat", - Handler: _File_Stat_Handler, - }, - { - MethodName: "Read", - Handler: _File_Read_Handler, - }, - { - MethodName: "Write", - Handler: _File_Write_Handler, - }, - { - MethodName: "Close", - Handler: _File_Close_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "util/file/proto/file.proto", + GoTypes: file_util_file_proto_file_proto_goTypes, + DependencyIndexes: file_util_file_proto_file_proto_depIdxs, + MessageInfos: file_util_file_proto_file_proto_msgTypes, + }.Build() + File_util_file_proto_file_proto = out.File + file_util_file_proto_file_proto_rawDesc = nil + file_util_file_proto_file_proto_goTypes = nil + file_util_file_proto_file_proto_depIdxs = nil } diff --git a/util/file/proto/file.pb.micro.go b/util/file/proto/file.pb.micro.go index b5ed664e..57af68c2 100644 --- a/util/file/proto/file.pb.micro.go +++ b/util/file/proto/file.pb.micro.go @@ -11,9 +11,9 @@ import ( import ( context "context" - api "github.com/micro/go-micro/v3/api" - client "github.com/micro/go-micro/v3/client" - server "github.com/micro/go-micro/v3/server" + api "github.com/unistack-org/micro/v3/api" + client "github.com/unistack-org/micro/v3/client" + server "github.com/unistack-org/micro/v3/server" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/util/file/proto/file_grpc.pb.go b/util/file/proto/file_grpc.pb.go new file mode 100644 index 00000000..2d6a1f4f --- /dev/null +++ b/util/file/proto/file_grpc.pb.go @@ -0,0 +1,234 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package go_micro_server + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// FileClient is the client API for File service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type FileClient interface { + Open(ctx context.Context, in *OpenRequest, opts ...grpc.CallOption) (*OpenResponse, error) + Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) + Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) + Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) + Close(ctx context.Context, in *CloseRequest, opts ...grpc.CallOption) (*CloseResponse, error) +} + +type fileClient struct { + cc grpc.ClientConnInterface +} + +func NewFileClient(cc grpc.ClientConnInterface) FileClient { + return &fileClient{cc} +} + +func (c *fileClient) Open(ctx context.Context, in *OpenRequest, opts ...grpc.CallOption) (*OpenResponse, error) { + out := new(OpenResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.File/Open", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) Stat(ctx context.Context, in *StatRequest, opts ...grpc.CallOption) (*StatResponse, error) { + out := new(StatResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.File/Stat", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) { + out := new(ReadResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.File/Read", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*WriteResponse, error) { + out := new(WriteResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.File/Write", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileClient) Close(ctx context.Context, in *CloseRequest, opts ...grpc.CallOption) (*CloseResponse, error) { + out := new(CloseResponse) + err := c.cc.Invoke(ctx, "/go.micro.server.File/Close", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FileServer is the server API for File service. +// All implementations must embed UnimplementedFileServer +// for forward compatibility +type FileServer interface { + Open(context.Context, *OpenRequest) (*OpenResponse, error) + Stat(context.Context, *StatRequest) (*StatResponse, error) + Read(context.Context, *ReadRequest) (*ReadResponse, error) + Write(context.Context, *WriteRequest) (*WriteResponse, error) + Close(context.Context, *CloseRequest) (*CloseResponse, error) + mustEmbedUnimplementedFileServer() +} + +// UnimplementedFileServer must be embedded to have forward compatible implementations. +type UnimplementedFileServer struct { +} + +func (*UnimplementedFileServer) Open(context.Context, *OpenRequest) (*OpenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Open not implemented") +} +func (*UnimplementedFileServer) Stat(context.Context, *StatRequest) (*StatResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stat not implemented") +} +func (*UnimplementedFileServer) Read(context.Context, *ReadRequest) (*ReadResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Read not implemented") +} +func (*UnimplementedFileServer) Write(context.Context, *WriteRequest) (*WriteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Write not implemented") +} +func (*UnimplementedFileServer) Close(context.Context, *CloseRequest) (*CloseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Close not implemented") +} +func (*UnimplementedFileServer) mustEmbedUnimplementedFileServer() {} + +func RegisterFileServer(s *grpc.Server, srv FileServer) { + s.RegisterService(&_File_serviceDesc, srv) +} + +func _File_Open_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Open(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.File/Open", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Open(ctx, req.(*OpenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_Stat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Stat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.File/Stat", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Stat(ctx, req.(*StatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Read(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.File/Read", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Read(ctx, req.(*ReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_Write_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WriteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Write(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.File/Write", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Write(ctx, req.(*WriteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _File_Close_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServer).Close(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/go.micro.server.File/Close", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServer).Close(ctx, req.(*CloseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _File_serviceDesc = grpc.ServiceDesc{ + ServiceName: "go.micro.server.File", + HandlerType: (*FileServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Open", + Handler: _File_Open_Handler, + }, + { + MethodName: "Stat", + Handler: _File_Stat_Handler, + }, + { + MethodName: "Read", + Handler: _File_Read_Handler, + }, + { + MethodName: "Write", + Handler: _File_Write_Handler, + }, + { + MethodName: "Close", + Handler: _File_Close_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "util/file/proto/file.proto", +} diff --git a/util/http/http.go b/util/http/http.go index 9b80c899..09f4134d 100644 --- a/util/http/http.go +++ b/util/http/http.go @@ -8,9 +8,9 @@ import ( "net/http" "strings" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/router/registry" - "github.com/micro/go-micro/v3/selector/random" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/router/registry" + "github.com/unistack-org/micro/v3/selector/random" ) // Write sets the status and body on a http ResponseWriter diff --git a/util/http/http_test.go b/util/http/http_test.go index 7d659f9a..119261fe 100644 --- a/util/http/http_test.go +++ b/util/http/http_test.go @@ -6,10 +6,10 @@ import ( "net/http" "testing" - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/registry/memory" - "github.com/micro/go-micro/v3/router" - regRouter "github.com/micro/go-micro/v3/router/registry" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/registry/memory" + "github.com/unistack-org/micro/v3/router" + regRouter "github.com/unistack-org/micro/v3/router/registry" ) func TestRoundTripper(t *testing.T) { diff --git a/util/http/options.go b/util/http/options.go index d7b8d6b8..58fc3847 100644 --- a/util/http/options.go +++ b/util/http/options.go @@ -1,6 +1,6 @@ package http -import "github.com/micro/go-micro/v3/router" +import "github.com/unistack-org/micro/v3/router" type Options struct { Router router.Router diff --git a/util/http/roundtripper.go b/util/http/roundtripper.go index a4e3988b..2dfa22d6 100644 --- a/util/http/roundtripper.go +++ b/util/http/roundtripper.go @@ -4,8 +4,8 @@ import ( "errors" "net/http" - "github.com/micro/go-micro/v3/router" - "github.com/micro/go-micro/v3/selector" + "github.com/unistack-org/micro/v3/router" + "github.com/unistack-org/micro/v3/selector" ) type roundTripper struct { diff --git a/util/io/io.go b/util/io/io.go index d06bb7bb..7a892b49 100644 --- a/util/io/io.go +++ b/util/io/io.go @@ -4,7 +4,7 @@ package io import ( "io" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) type rwc struct { diff --git a/util/kubernetes/api/request.go b/util/kubernetes/api/request.go index db73f615..81b7441a 100644 --- a/util/kubernetes/api/request.go +++ b/util/kubernetes/api/request.go @@ -10,7 +10,7 @@ import ( "net/http" "net/url" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/logger" ) // Request is used to construct a http request for the k8s API. diff --git a/util/kubernetes/client/client.go b/util/kubernetes/client/client.go index 7b14e08c..195c0468 100644 --- a/util/kubernetes/client/client.go +++ b/util/kubernetes/client/client.go @@ -13,8 +13,8 @@ import ( "regexp" "strings" - "github.com/micro/go-micro/v3/logger" - "github.com/micro/go-micro/v3/util/kubernetes/api" + "github.com/unistack-org/micro/v3/logger" + "github.com/unistack-org/micro/v3/util/kubernetes/api" ) var ( diff --git a/util/kubernetes/client/watch.go b/util/kubernetes/client/watch.go index 81999209..dc799c43 100644 --- a/util/kubernetes/client/watch.go +++ b/util/kubernetes/client/watch.go @@ -7,7 +7,7 @@ import ( "errors" "net/http" - "github.com/micro/go-micro/v3/util/kubernetes/api" + "github.com/unistack-org/micro/v3/util/kubernetes/api" ) const ( diff --git a/util/log/log.go b/util/log/log.go index e86a757b..bbfb6e81 100644 --- a/util/log/log.go +++ b/util/log/log.go @@ -1,5 +1,5 @@ // Package log is a global internal logger -// DEPRECATED: this is frozen package, use github.com/micro/go-micro/v3/logger +// DEPRECATED: this is frozen package, use github.com/unistack-org/micro/v3/logger package log import ( @@ -7,8 +7,8 @@ import ( "os" "sync/atomic" - dlog "github.com/micro/go-micro/v3/debug/log" - nlog "github.com/micro/go-micro/v3/logger" + dlog "github.com/unistack-org/micro/v3/debug/log" + nlog "github.com/unistack-org/micro/v3/logger" ) // level is a log level diff --git a/util/mdns/server.go b/util/mdns/server.go index cdc2695b..a2e0bc9f 100644 --- a/util/mdns/server.go +++ b/util/mdns/server.go @@ -8,7 +8,7 @@ import ( "sync/atomic" "time" - log "github.com/micro/go-micro/v3/logger" + log "github.com/unistack-org/micro/v3/logger" "github.com/miekg/dns" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" diff --git a/util/pool/default.go b/util/pool/default.go index d27350c2..b22da3dd 100644 --- a/util/pool/default.go +++ b/util/pool/default.go @@ -5,7 +5,7 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) type pool struct { diff --git a/util/pool/default_test.go b/util/pool/default_test.go index 20a49300..19b9b5b0 100644 --- a/util/pool/default_test.go +++ b/util/pool/default_test.go @@ -4,8 +4,8 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/transport" - "github.com/micro/go-micro/v3/transport/memory" + "github.com/unistack-org/micro/v3/transport" + "github.com/unistack-org/micro/v3/transport/memory" ) func testPool(t *testing.T, size int, ttl time.Duration) { diff --git a/util/pool/options.go b/util/pool/options.go index a4c3178f..54a653cb 100644 --- a/util/pool/options.go +++ b/util/pool/options.go @@ -3,7 +3,7 @@ package pool import ( "time" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) type Options struct { diff --git a/util/pool/pool.go b/util/pool/pool.go index ce540f46..22e914d0 100644 --- a/util/pool/pool.go +++ b/util/pool/pool.go @@ -4,7 +4,7 @@ package pool import ( "time" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) // Pool is an interface for connection pooling diff --git a/util/registry/util.go b/util/registry/util.go index e0d67ab3..e430f35c 100644 --- a/util/registry/util.go +++ b/util/registry/util.go @@ -1,7 +1,7 @@ package registry import ( - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func addNodes(old, neu []*registry.Node) []*registry.Node { diff --git a/util/registry/util_test.go b/util/registry/util_test.go index 1b7eef6d..83c3a78d 100644 --- a/util/registry/util_test.go +++ b/util/registry/util_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) func TestRemove(t *testing.T) { diff --git a/util/router/parse.go b/util/router/parse.go index 1e3b844d..2ffcdd9f 100644 --- a/util/router/parse.go +++ b/util/router/parse.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/logger" ) // InvalidTemplateError indicates that the path template is not valid. diff --git a/util/router/parse_test.go b/util/router/parse_test.go index 9f102ff9..526d2f37 100644 --- a/util/router/parse_test.go +++ b/util/router/parse_test.go @@ -8,7 +8,7 @@ import ( "reflect" "testing" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/logger" ) func TestTokenize(t *testing.T) { diff --git a/util/router/router.go b/util/router/router.go index b9b5a517..921f7768 100644 --- a/util/router/router.go +++ b/util/router/router.go @@ -1,8 +1,8 @@ package router import ( - "github.com/micro/go-micro/v3/registry" - "github.com/micro/go-micro/v3/router" + "github.com/unistack-org/micro/v3/registry" + "github.com/unistack-org/micro/v3/router" ) type apiRouter struct { diff --git a/util/router/runtime.go b/util/router/runtime.go index 24cc5d59..13a702fd 100644 --- a/util/router/runtime.go +++ b/util/router/runtime.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "github.com/micro/go-micro/v3/logger" + "github.com/unistack-org/micro/v3/logger" ) var ( diff --git a/util/scope/scope.go b/util/scope/scope.go index eb75a7bb..4467d08b 100644 --- a/util/scope/scope.go +++ b/util/scope/scope.go @@ -3,7 +3,7 @@ package scope import ( "fmt" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) // Scope extends the store, applying a prefix to each request diff --git a/util/socket/socket.go b/util/socket/socket.go index 4a8bc6a8..5a5cf72a 100644 --- a/util/socket/socket.go +++ b/util/socket/socket.go @@ -4,7 +4,7 @@ package socket import ( "io" - "github.com/micro/go-micro/v3/transport" + "github.com/unistack-org/micro/v3/transport" ) // Socket is our pseudo socket for transport.Socket diff --git a/util/stream/stream.go b/util/stream/stream.go index 1c26350e..4cf6f081 100644 --- a/util/stream/stream.go +++ b/util/stream/stream.go @@ -5,11 +5,11 @@ import ( "context" "sync" - "github.com/micro/go-micro/v3/client" - "github.com/micro/go-micro/v3/client/mucp" - "github.com/micro/go-micro/v3/codec" - "github.com/micro/go-micro/v3/metadata" - "github.com/micro/go-micro/v3/server" + "github.com/unistack-org/micro/v3/client" + "github.com/unistack-org/micro/v3/client/mucp" + "github.com/unistack-org/micro/v3/codec" + "github.com/unistack-org/micro/v3/metadata" + "github.com/unistack-org/micro/v3/server" ) type Stream interface { diff --git a/util/sync/manager.go b/util/sync/manager.go index 794c60a7..c15e58a7 100644 --- a/util/sync/manager.go +++ b/util/sync/manager.go @@ -3,7 +3,7 @@ package sync import ( "time" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" "github.com/pkg/errors" ) diff --git a/util/sync/options.go b/util/sync/options.go index ed2cbec0..0dcdb617 100644 --- a/util/sync/options.go +++ b/util/sync/options.go @@ -3,7 +3,7 @@ package sync import ( "time" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) // Options represents Sync options diff --git a/util/sync/sync.go b/util/sync/sync.go index 43d73fc4..e6bffeea 100644 --- a/util/sync/sync.go +++ b/util/sync/sync.go @@ -7,7 +7,7 @@ import ( "time" "github.com/ef-ds/deque" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" "github.com/pkg/errors" ) diff --git a/util/test/test.go b/util/test/test.go index b7be6b63..2d7dcdc3 100644 --- a/util/test/test.go +++ b/util/test/test.go @@ -1,7 +1,7 @@ package test import ( - "github.com/micro/go-micro/v3/registry" + "github.com/unistack-org/micro/v3/registry" ) var ( diff --git a/util/token/basic/basic.go b/util/token/basic/basic.go index 53cb0284..72818b48 100644 --- a/util/token/basic/basic.go +++ b/util/token/basic/basic.go @@ -6,9 +6,9 @@ import ( "time" "github.com/google/uuid" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/store" - "github.com/micro/go-micro/v3/util/token" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/store" + "github.com/unistack-org/micro/v3/util/token" ) // Basic implementation of token provider, backed by the store diff --git a/util/token/basic/basic_test.go b/util/token/basic/basic_test.go index 2bb775b4..17f7b978 100644 --- a/util/token/basic/basic_test.go +++ b/util/token/basic/basic_test.go @@ -3,9 +3,9 @@ package basic import ( "testing" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/store/memory" - "github.com/micro/go-micro/v3/util/token" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/store/memory" + "github.com/unistack-org/micro/v3/util/token" ) func TestGenerate(t *testing.T) { diff --git a/util/token/jwt/jwt.go b/util/token/jwt/jwt.go index 40673192..c621055a 100644 --- a/util/token/jwt/jwt.go +++ b/util/token/jwt/jwt.go @@ -5,8 +5,8 @@ import ( "time" "github.com/dgrijalva/jwt-go" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/util/token" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/util/token" ) // authClaims to be encoded in the JWT diff --git a/util/token/jwt/jwt_test.go b/util/token/jwt/jwt_test.go index 2afd9f7d..3de492ef 100644 --- a/util/token/jwt/jwt_test.go +++ b/util/token/jwt/jwt_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/micro/go-micro/v3/auth" - "github.com/micro/go-micro/v3/util/token" + "github.com/unistack-org/micro/v3/auth" + "github.com/unistack-org/micro/v3/util/token" ) func TestGenerate(t *testing.T) { diff --git a/util/token/options.go b/util/token/options.go index 1e7be0e4..9f479b24 100644 --- a/util/token/options.go +++ b/util/token/options.go @@ -3,7 +3,7 @@ package token import ( "time" - "github.com/micro/go-micro/v3/store" + "github.com/unistack-org/micro/v3/store" ) type Options struct { diff --git a/util/token/token.go b/util/token/token.go index ae8e4c78..9ef8850b 100644 --- a/util/token/token.go +++ b/util/token/token.go @@ -4,7 +4,7 @@ import ( "errors" "time" - "github.com/micro/go-micro/v3/auth" + "github.com/unistack-org/micro/v3/auth" ) var (