diff --git a/client/client.go b/client/client.go index 7602f73ee..90b3d554d 100644 --- a/client/client.go +++ b/client/client.go @@ -172,7 +172,7 @@ type Client struct { // rpcServer is used to serve RPCs by the local agent. rpcServer *rpc.Server endpoints rpcEndpoints - streamingRpcs *structs.StreamingRpcRegistery + streamingRpcs *structs.StreamingRpcRegistry // baseLabels are used when emitting tagged metrics. All client metrics will // have these tags, and optionally more. @@ -206,7 +206,7 @@ func NewClient(cfg *config.Config, consulCatalog consul.CatalogAPI, consulServic start: time.Now(), connPool: pool.NewPool(cfg.LogOutput, clientRPCCache, clientMaxStreams, tlsWrap), tlsWrap: tlsWrap, - streamingRpcs: structs.NewStreamingRpcRegistery(), + streamingRpcs: structs.NewStreamingRpcRegistry(), logger: logger, allocs: make(map[string]*AllocRunner), allocUpdates: make(chan *structs.Allocation, 64), diff --git a/nomad/server.go b/nomad/server.go index 234391375..c2b7a00e4 100644 --- a/nomad/server.go +++ b/nomad/server.go @@ -132,7 +132,7 @@ type Server struct { staticEndpoints endpoints // streamingRpcs is the registry holding our streaming RPC handlers. - streamingRpcs *structs.StreamingRpcRegistery + streamingRpcs *structs.StreamingRpcRegistry // nodeConns is the set of multiplexed node connections we have keyed by // NodeID @@ -283,7 +283,7 @@ func NewServer(config *Config, consulCatalog consul.CatalogAPI, logger *log.Logg logger: logger, tlsWrap: tlsWrap, rpcServer: rpc.NewServer(), - streamingRpcs: structs.NewStreamingRpcRegistery(), + streamingRpcs: structs.NewStreamingRpcRegistry(), nodeConns: make(map[string]*nodeConnState), peers: make(map[string][]*serverParts), localPeers: make(map[raft.ServerAddress]*serverParts), diff --git a/nomad/structs/streaming_rpc.go b/nomad/structs/streaming_rpc.go index 6172c05e6..aac6e1910 100644 --- a/nomad/structs/streaming_rpc.go +++ b/nomad/structs/streaming_rpc.go @@ -24,26 +24,26 @@ type StreamingRpcAck struct { // StreamingRpcHandler defines the handler for a streaming RPC. type StreamingRpcHandler func(conn io.ReadWriteCloser) -// StreamingRpcRegistery is used to add and retrieve handlers -type StreamingRpcRegistery struct { +// StreamingRpcRegistry is used to add and retrieve handlers +type StreamingRpcRegistry struct { registry map[string]StreamingRpcHandler } -// NewStreamingRpcRegistery creates a new registry. All registrations of +// NewStreamingRpcRegistry creates a new registry. All registrations of // handlers should be done before retrieving handlers. -func NewStreamingRpcRegistery() *StreamingRpcRegistery { - return &StreamingRpcRegistery{ +func NewStreamingRpcRegistry() *StreamingRpcRegistry { + return &StreamingRpcRegistry{ registry: make(map[string]StreamingRpcHandler), } } // Register registers a new handler for the given method name -func (s *StreamingRpcRegistery) Register(method string, handler StreamingRpcHandler) { +func (s *StreamingRpcRegistry) Register(method string, handler StreamingRpcHandler) { s.registry[method] = handler } // GetHandler returns a handler for the given method or an error if it doesn't exist. -func (s *StreamingRpcRegistery) GetHandler(method string) (StreamingRpcHandler, error) { +func (s *StreamingRpcRegistry) GetHandler(method string) (StreamingRpcHandler, error) { h, ok := s.registry[method] if !ok { return nil, fmt.Errorf("%s: %q", ErrUnknownMethod, method)