diff --git a/server/accounts.go b/server/accounts.go index 0708b338..75fd479c 100644 --- a/server/accounts.go +++ b/server/accounts.go @@ -106,7 +106,7 @@ type serviceImport struct { } // This is used to record when we create a mapping for implicit service -// imports. We use this to clean up entries that are not singeltons when +// imports. We use this to clean up entries that are not singletons when // we detect that interest is no longer present. The key to the map will // be the actual interest. We record the mapped subject and the serviceImport type serviceRespEntry struct { @@ -117,9 +117,9 @@ type serviceRespEntry struct { // ServiceRespType represents the types of service request response types. type ServiceRespType uint8 -// Service response types. Defaults to a singelton. +// Service response types. Defaults to a singleton. const ( - Singelton ServiceRespType = iota + Singleton ServiceRespType = iota Stream Chunked ) @@ -127,8 +127,8 @@ const ( // String helper. func (rt ServiceRespType) String() string { switch rt { - case Singelton: - return "Singelton" + case Singleton: + return "Singleton" case Stream: return "Stream" case Chunked: @@ -360,7 +360,7 @@ func (a *Account) randomClient() *client { // AddServiceExport will configure the account with the defined export. func (a *Account) AddServiceExport(subject string, accounts []*Account) error { - return a.AddServiceExportWithResponse(subject, Singelton, accounts) + return a.AddServiceExportWithResponse(subject, Singleton, accounts) } // AddServiceExportWithresponse will configure the account with the defined export and response type. @@ -376,7 +376,7 @@ func (a *Account) AddServiceExportWithResponse(subject string, respType ServiceR ea := a.exports.services[subject] - if respType != Singelton { + if respType != Singleton { if ea == nil { ea = &exportAuth{} } @@ -581,7 +581,7 @@ func (a *Account) SetMaxResponseMaps(max int) { // This does no checks and should be only called by the msg processing code. Use // AddServiceImport from above if responding to user input or config changes, etc. func (a *Account) addServiceImport(dest *Account, from, to string, claim *jwt.Import) *serviceImport { - rt := Singelton + rt := Singleton dest.mu.Lock() if ae := dest.exports.services[to]; ae != nil { rt = ae.respType @@ -605,7 +605,7 @@ func (a *Account) addResponseServiceImport(dest *Account, from, to string, rt Se if a.imports.services == nil { a.imports.services = make(map[string]*serviceImport) } - ae := rt == Singelton + ae := rt == Singleton si := &serviceImport{dest, nil, from, to, rt, 0, ae, true, false} a.imports.services[from] = si if ae { @@ -620,7 +620,7 @@ func (a *Account) addResponseServiceImport(dest *Account, from, to string, rt Se return si } -// This will prune off the non auto-expire (non singelton) response maps. +// This will prune off the non auto-expire (non singleton) response maps. func (a *Account) pruneNonAutoExpireResponseMaps() { var sres []*serviceRespEntry a.mu.Lock() @@ -1200,7 +1200,7 @@ func (s *Server) updateAccountClaims(a *Account, ac *jwt.AccountClaims) { } case jwt.Service: s.Debugf("Adding service export %q for %s", e.Subject, a.Name) - rt := Singelton + rt := Singleton switch e.ResponseType { case jwt.ResponseTypeStream: rt = Stream diff --git a/server/accounts_test.go b/server/accounts_test.go index 90e91da2..e1cbeb25 100644 --- a/server/accounts_test.go +++ b/server/accounts_test.go @@ -446,8 +446,8 @@ func TestAccountParseConfigImportsExports(t *testing.T) { if ea == nil { t.Fatalf("Expected to get a non-nil exportAuth for service") } - if ea.respType != Singelton { - t.Fatalf("Expected to get a Singelton response type, got %q", ea.respType) + if ea.respType != Singleton { + t.Fatalf("Expected to get a Singleton response type, got %q", ea.respType) } if synAcc == nil { diff --git a/server/client.go b/server/client.go index 992162ab..830d6237 100644 --- a/server/client.go +++ b/server/client.go @@ -2482,7 +2482,7 @@ func (c *client) checkForImportServices(acc *Account, msg []byte) { si.acc.addResponseServiceImport(acc, string(nrr), string(c.pa.reply), si.rt) // Track our responses for cleanup if not auto-expire. - if si.rt != Singelton { + if si.rt != Singleton { acc.addRespMapEntry(si.acc, string(c.pa.reply), string(nrr)) } diff --git a/server/configs/accounts.conf b/server/configs/accounts.conf index 952eda19..f9586a19 100644 --- a/server/configs/accounts.conf +++ b/server/configs/accounts.conf @@ -41,7 +41,7 @@ accounts: { exports = [ {service: "nats.time", response: stream} {service: "nats.photo", response: chunked} - {service: "nats.add", response: singelton, accounts: [cncf]} + {service: "nats.add", response: singleton, accounts: [cncf]} {service: "nats.sub"} ] } diff --git a/server/const.go b/server/const.go index 20f6899a..e8d1d472 100644 --- a/server/const.go +++ b/server/const.go @@ -134,7 +134,7 @@ const ( DEFAULT_MAX_ACCOUNT_AE_RESPONSE_MAPS = 100000 // DEFAULT_MAX_ACCOUNT_INTERNAL_RESPONSE_MAPS is for non auto-expire response maps for imports. - // These are present for non-singelton response types. + // These are present for non-singleton response types. DEFAULT_MAX_ACCOUNT_INTERNAL_RESPONSE_MAPS = 100000 // DEFAULT_TTL_AE_RESPONSE_MAP is the default time to expire auto-response map entries. diff --git a/server/jwt_test.go b/server/jwt_test.go index be05c4ee..892d916e 100644 --- a/server/jwt_test.go +++ b/server/jwt_test.go @@ -902,7 +902,7 @@ func TestJWTAccountExportWithResponseType(t *testing.T) { if !se.tokenReq { t.Fatalf("Expected the service export to not require tokens") } - if se.respType != Singelton { + if se.respType != Singleton { t.Fatalf("Expected the service export to respond with a stream") } @@ -913,7 +913,7 @@ func TestJWTAccountExportWithResponseType(t *testing.T) { if !se.tokenReq { t.Fatalf("Expected the service export to not require tokens") } - if se.respType != Singelton { + if se.respType != Singleton { t.Fatalf("Expected the service export to respond with a stream") } diff --git a/server/opts.go b/server/opts.go index 4309320f..5be2aa4a 100644 --- a/server/opts.go +++ b/server/opts.go @@ -1620,8 +1620,8 @@ func parseExportStreamOrService(v interface{}, errors, warnings *[]error) (*expo continue } switch strings.ToLower(mvs) { - case "single", "singelton": - rt = Singelton + case "single", "singleton": + rt = Singleton case "stream": rt = Stream case "chunk", "chunked": @@ -2019,7 +2019,7 @@ func parseVariablePermissions(v interface{}, errors, warnings *[]error) (*Subjec } } -// Helper function to parse subject singeltons and/or arrays +// Helper function to parse subject singletons and/or arrays func parseSubjects(v interface{}, errors, warnings *[]error) ([]string, error) { tk, v := unwrapValue(v)