10
									
								
								handler.go
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								handler.go
									
									
									
									
									
								
							| @@ -28,19 +28,19 @@ var ( | ||||
| ) | ||||
|  | ||||
| type patHandler struct { | ||||
| 	pat   rutil.Pattern | ||||
| 	mtype *methodType | ||||
| 	name  string | ||||
| 	rcvr  reflect.Value | ||||
| 	name  string | ||||
| 	pat   rutil.Pattern | ||||
| } | ||||
|  | ||||
| type httpHandler struct { | ||||
| 	name     string | ||||
| 	opts     server.HandlerOptions | ||||
| 	sopts    server.Options | ||||
| 	eps      []*register.Endpoint | ||||
| 	hd       interface{} | ||||
| 	handlers map[string][]patHandler | ||||
| 	name     string | ||||
| 	eps      []*register.Endpoint | ||||
| 	sopts    server.Options | ||||
| 	sync.RWMutex | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										14
									
								
								http.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								http.go
									
									
									
									
									
								
							| @@ -24,20 +24,18 @@ import ( | ||||
| ) | ||||
|  | ||||
| type httpServer struct { | ||||
| 	sync.RWMutex | ||||
| 	opts        server.Options | ||||
| 	handlers    map[string]server.Handler | ||||
| 	hd                  server.Handler | ||||
| 	rsvc                *register.Service | ||||
| 	handlers            map[string]server.Handler | ||||
| 	exit                chan chan error | ||||
| 	subscribers         map[*httpSubscriber][]broker.Subscriber | ||||
| 	// used for first registration | ||||
| 	registered bool | ||||
| 	// register service instance | ||||
| 	rsvc                *register.Service | ||||
| 	init                bool | ||||
| 	errorHandler        func(context.Context, server.Handler, http.ResponseWriter, *http.Request, error, int) | ||||
| 	pathHandlers        map[*regexp.Regexp]http.HandlerFunc | ||||
| 	contentTypeHandlers map[string]http.HandlerFunc | ||||
| 	opts                server.Options | ||||
| 	sync.RWMutex | ||||
| 	registered bool | ||||
| 	init       bool | ||||
| } | ||||
|  | ||||
| func (h *httpServer) newCodec(ct string) (codec.Codec, error) { | ||||
|   | ||||
| @@ -6,12 +6,12 @@ import ( | ||||
| ) | ||||
|  | ||||
| type httpMessage struct { | ||||
| 	topic       string | ||||
| 	payload     interface{} | ||||
| 	contentType string | ||||
| 	header      metadata.Metadata | ||||
| 	body        []byte | ||||
| 	codec       codec.Codec | ||||
| 	header      metadata.Metadata | ||||
| 	topic       string | ||||
| 	contentType string | ||||
| 	body        []byte | ||||
| } | ||||
|  | ||||
| func (r *httpMessage) Topic() string { | ||||
|   | ||||
							
								
								
									
										18
									
								
								request.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								request.go
									
									
									
									
									
								
							| @@ -9,25 +9,25 @@ import ( | ||||
|  | ||||
| type rpcRequest struct { | ||||
| 	rw          io.ReadWriter | ||||
| 	service     string | ||||
| 	method      string | ||||
| 	endpoint    string | ||||
| 	target      string | ||||
| 	contentType string | ||||
| 	payload     interface{} | ||||
| 	codec       codec.Codec | ||||
| 	header      metadata.Metadata | ||||
| 	method      string | ||||
| 	endpoint    string | ||||
| 	contentType string | ||||
| 	service     string | ||||
| 	target      string | ||||
| 	body        []byte | ||||
| 	stream      bool | ||||
| 	payload     interface{} | ||||
| } | ||||
|  | ||||
| type rpcMessage struct { | ||||
| 	payload     interface{} | ||||
| 	codec       codec.Codec | ||||
| 	header      metadata.Metadata | ||||
| 	topic       string | ||||
| 	contentType string | ||||
| 	payload     interface{} | ||||
| 	header      metadata.Metadata | ||||
| 	body        []byte | ||||
| 	codec       codec.Codec | ||||
| } | ||||
|  | ||||
| func (r *rpcRequest) ContentType() string { | ||||
|   | ||||
| @@ -11,10 +11,10 @@ import ( | ||||
| ) | ||||
|  | ||||
| type methodType struct { | ||||
| 	method      reflect.Method | ||||
| 	ArgType     reflect.Type | ||||
| 	ReplyType   reflect.Type | ||||
| 	ContextType reflect.Type | ||||
| 	method      reflect.Method | ||||
| 	stream      bool | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -21,9 +21,9 @@ const ( | ||||
| var typeOfError = reflect.TypeOf((*error)(nil)).Elem() | ||||
|  | ||||
| type handler struct { | ||||
| 	method  reflect.Value | ||||
| 	reqType reflect.Type | ||||
| 	ctxType reflect.Type | ||||
| 	method  reflect.Value | ||||
| } | ||||
|  | ||||
| type httpSubscriber struct { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user