Rename to hdlrWrappers for symmetry sake

This commit is contained in:
Asim 2015-12-02 21:12:09 +00:00
parent 96d7975052
commit 5e364693ee
6 changed files with 34 additions and 36 deletions

View File

@ -18,7 +18,7 @@ type options struct {
advertise string advertise string
id string id string
version string version string
wrappers []HandlerWrapper hdlrWrappers []HandlerWrapper
subWrappers []SubscriberWrapper subWrappers []SubscriberWrapper
} }
@ -159,7 +159,7 @@ func Metadata(md map[string]string) Option {
// Adds a handler Wrapper to a list of options passed into the server // Adds a handler Wrapper to a list of options passed into the server
func WrapHandler(w HandlerWrapper) Option { func WrapHandler(w HandlerWrapper) Option {
return func(o *options) { return func(o *options) {
o.wrappers = append(o.wrappers, w) o.hdlrWrappers = append(o.hdlrWrappers, w)
} }
} }

View File

@ -34,7 +34,7 @@ func newRpcServer(opts ...Option) Server {
rpc: &server{ rpc: &server{
name: options.name, name: options.name,
serviceMap: make(map[string]*service), serviceMap: make(map[string]*service),
wrappers: options.wrappers, hdlrWrappers: options.hdlrWrappers,
}, },
handlers: make(map[string]Handler), handlers: make(map[string]Handler),
subscribers: make(map[*subscriber][]broker.Subscriber), subscribers: make(map[*subscriber][]broker.Subscriber),

View File

@ -76,7 +76,7 @@ type server struct {
freeReq *request freeReq *request
respLock sync.Mutex // protects freeResp respLock sync.Mutex // protects freeResp
freeResp *response freeResp *response
wrappers []HandlerWrapper hdlrWrappers []HandlerWrapper
} }
// Is this an exported - upper case - name? // Is this an exported - upper case - name?
@ -256,8 +256,8 @@ func (s *service) call(ctx context.Context, server *server, sending *sync.Mutex,
return nil return nil
} }
for i := len(server.wrappers); i > 0; i-- { for i := len(server.hdlrWrappers); i > 0; i-- {
fn = server.wrappers[i-1](fn) fn = server.hdlrWrappers[i-1](fn)
} }
errmsg := "" errmsg := ""
@ -266,7 +266,6 @@ func (s *service) call(ctx context.Context, server *server, sending *sync.Mutex,
errmsg = err.Error() errmsg = err.Error()
} }
server.sendResponse(sending, req, replyv.Interface(), codec, errmsg, true) server.sendResponse(sending, req, replyv.Interface(), codec, errmsg, true)
server.freeRequest(req) server.freeRequest(req)
return return
@ -323,8 +322,8 @@ func (s *service) call(ctx context.Context, server *server, sending *sync.Mutex,
return nil return nil
} }
for i := len(server.wrappers); i > 0; i-- { for i := len(server.hdlrWrappers); i > 0; i-- {
fn = server.wrappers[i-1](fn) fn = server.hdlrWrappers[i-1](fn)
} }
// client.Stream request // client.Stream request

View File

@ -31,7 +31,6 @@ type Server interface {
Stop() error Stop() error
} }
type Publication interface { type Publication interface {
Topic() string Topic() string
Message() interface{} Message() interface{}