diff --git a/handler.go b/handler.go index 1d21b32..6b7b6b7 100644 --- a/handler.go +++ b/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 } diff --git a/http.go b/http.go index 0bb7d96..0de3c8d 100644 --- a/http.go +++ b/http.go @@ -24,20 +24,18 @@ import ( ) type httpServer struct { - sync.RWMutex - opts server.Options - handlers map[string]server.Handler - hd server.Handler - exit chan chan error - subscribers map[*httpSubscriber][]broker.Subscriber - // used for first registration - registered bool - // register service instance + hd server.Handler rsvc *register.Service - init bool + handlers map[string]server.Handler + exit chan chan error + subscribers map[*httpSubscriber][]broker.Subscriber 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) { diff --git a/message.go b/message.go index 195dc22..7995379 100644 --- a/message.go +++ b/message.go @@ -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 { diff --git a/request.go b/request.go index e70463f..036a4cb 100644 --- a/request.go +++ b/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 { diff --git a/server.go b/server.go index 37b67e2..166dad9 100644 --- a/server.go +++ b/server.go @@ -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 } diff --git a/subscriber.go b/subscriber.go index 1608283..0e89055 100644 --- a/subscriber.go +++ b/subscriber.go @@ -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 {