From f25f4dc0767d51318097ba3dc5ab61708afb1331 Mon Sep 17 00:00:00 2001 From: Arjen de Vos Date: Mon, 23 Nov 2026 14:49:51 +0000 Subject: [PATCH 1/2] feat(redis)!: Redis connections come from the app's config The queue and the cache built their Redis connections from REDIS_* or REDIS__* environment variables. The app now registers its connections once, app.WithRedis(config.Redis), and they look theirs up by name; one asked for before that fails with ErrNoConfig, and a name the config lacks is an error. config.RedisConnection gains the mode, addresses, master name and sentinel credentials the environment gave. BREAKING CHANGE: Redis connections need app.WithRedis; REDIS_* is no longer read. --- app/options.go | 10 +++ config/redis.go | 21 ++++- redis/connection.go | 136 ++++++++++++--------------------- redis/connection_test.go | 116 ---------------------------- tests/redis/connection_test.go | 107 ++++++++++++++++++++++++++ 5 files changed, 184 insertions(+), 206 deletions(-) delete mode 100644 redis/connection_test.go create mode 100644 tests/redis/connection_test.go diff --git a/app/options.go b/app/options.go index 257ec2c..d62d89a 100644 --- a/app/options.go +++ b/app/options.go @@ -4,12 +4,14 @@ import ( "embed" "github.com/gonstruct/core/cache" + "github.com/gonstruct/core/config" "github.com/gonstruct/core/console" "github.com/gonstruct/core/database/migration" "github.com/gonstruct/core/eventing" "github.com/gonstruct/core/facades/database" "github.com/gonstruct/core/facades/database/seeder" "github.com/gonstruct/core/queueing" + redisconnection "github.com/gonstruct/core/redis" "github.com/gonstruct/core/routing" "github.com/gonstruct/core/scheduling" ) @@ -54,6 +56,14 @@ func WithSeeders(seeders seeder.Seeders) option { } } +// WithRedis registers the app's Redis connections, which the queue and the +// cache use by name. +func WithRedis(redis config.Redis) option { + return func(*App) { + redisconnection.Configure(redis) + } +} + func WithCache(options ...cache.Option) option { return func(a *App) { a.cache = cache.New(options...) diff --git a/config/redis.go b/config/redis.go index 298419f..0760cb9 100644 --- a/config/redis.go +++ b/config/redis.go @@ -1,15 +1,28 @@ package config +// Redis is the Redis connections the app uses, by name, handed to +// app.WithRedis: the queue and the cache name the one they use. type Redis struct { Options any Connections map[RedisConnectionType]RedisConnection } +// RedisConnection is one Redis: a single server, a Sentinel-watched one, or +// a cluster. type RedisConnection struct { - Host string - Port string - Username string - Password string + // Mode is single (the default when empty), sentinel or cluster. + Mode string + // Addresses is its servers, or its sentinels; or Host and Port for one. + Addresses []string + Host string + Port string + // MasterName is the master the sentinels watch, in sentinel mode. + MasterName string + Username string + Password string + SentinelUsername string + SentinelPassword string + // Database is 0 to 15; always 0 in cluster mode. Database int TLS bool } diff --git a/redis/connection.go b/redis/connection.go index f58ab84..e68dbd5 100644 --- a/redis/connection.go +++ b/redis/connection.go @@ -2,11 +2,13 @@ package redis import ( "crypto/tls" + "errors" "fmt" "net" - "os" - "strconv" "strings" + "sync/atomic" + + "github.com/gonstruct/core/config" goredis "github.com/redis/go-redis/v9" ) @@ -31,40 +33,51 @@ type Configuration struct { TLS bool } +// ErrNoConfig is a Redis connection asked for before Configure. +var ErrNoConfig = errors.New("[redis] no config: pass app.WithRedis") + +// configured is the app's connections, by name. +var configured atomic.Pointer[config.Redis] + +// Configure registers the app's Redis connections. app.WithRedis calls it. +func Configure(redis config.Redis) { + configured.Store(&redis) +} + +// Load is the connection by that name, as configured: the default one when +// empty. func Load(connection string) (Configuration, error) { - prefix, err := connectionPrefix(connection) - if err != nil { - return Configuration{}, err + redis := configured.Load() + if redis == nil { + return Configuration{}, ErrNoConfig } - - configuration := Configuration{ - Mode: strings.ToLower(setting(prefix, "MODE", ModeSingle)), - MasterName: setting(prefix, "MASTER_NAME", ""), - Username: setting(prefix, "USERNAME", ""), - Password: setting(prefix, "PASSWORD", ""), - SentinelUsername: setting(prefix, "SENTINEL_USERNAME", ""), - SentinelPassword: setting(prefix, "SENTINEL_PASSWORD", ""), + if strings.TrimSpace(connection) == "" { + connection = DefaultConnection } - - addresses, err := loadAddresses(prefix) - if err != nil { - return Configuration{}, err + settings, found := redis.Connections[config.RedisConnectionType(connection)] + if !found { + return Configuration{}, fmt.Errorf("[redis] no connection %q in the config", connection) } - configuration.Addresses = addresses - database, err := strconv.Atoi(setting(prefix, "DATABASE", "0")) - if err != nil || database < 0 || database > 15 { - return Configuration{}, fmt.Errorf("%s_DATABASE must be between 0 and 15", prefix) + configuration := Configuration{ + Mode: strings.ToLower(settings.Mode), + Addresses: settings.Addresses, + MasterName: settings.MasterName, + Username: settings.Username, + Password: settings.Password, + SentinelUsername: settings.SentinelUsername, + SentinelPassword: settings.SentinelPassword, + Database: settings.Database, + TLS: settings.TLS, } - configuration.Database = database - - tlsEnabled, err := strconv.ParseBool(setting(prefix, "TLS", "false")) - if err != nil { - return Configuration{}, fmt.Errorf("%s_TLS must be true or false", prefix) + if configuration.Mode == "" { + configuration.Mode = ModeSingle + } + if len(configuration.Addresses) == 0 && settings.Host != "" && settings.Port != "" { + configuration.Addresses = []string{net.JoinHostPort(settings.Host, settings.Port)} } - configuration.TLS = tlsEnabled - if err := configuration.validate(prefix); err != nil { + if err := configuration.validate(connection); err != nil { return Configuration{}, err } @@ -104,76 +117,27 @@ func (configuration Configuration) Options() *goredis.UniversalOptions { return options } -func (configuration Configuration) validate(prefix string) error { +func (configuration Configuration) validate(connection string) error { + if configuration.Database < 0 || configuration.Database > 15 { + return fmt.Errorf("[redis] connection %s has Database %d: 0 to 15", connection, configuration.Database) + } + switch configuration.Mode { case ModeSingle: if len(configuration.Addresses) != 1 { - return fmt.Errorf("%s_ADDRESSES must contain one address in single mode", prefix) + return fmt.Errorf("[redis] connection %s needs one address in single mode", connection) } case ModeSentinel: if configuration.MasterName == "" { - return fmt.Errorf("%s_MASTER_NAME is required in sentinel mode", prefix) + return fmt.Errorf("[redis] connection %s needs a MasterName in sentinel mode", connection) } case ModeCluster: if configuration.Database != 0 { - return fmt.Errorf("%s_DATABASE must be 0 in cluster mode", prefix) + return fmt.Errorf("[redis] connection %s must use Database 0 in cluster mode", connection) } default: - return fmt.Errorf("%s_MODE must be single, sentinel, or cluster", prefix) + return fmt.Errorf("[redis] connection %s has Mode %q: single, sentinel or cluster", connection, configuration.Mode) } return nil } - -func loadAddresses(prefix string) ([]string, error) { - configured := setting(prefix, "ADDRESSES", "") - if configured == "" { - host := setting(prefix, "HOST", "") - port := setting(prefix, "PORT", "") - if host == "" || port == "" { - return nil, fmt.Errorf("%s_ADDRESSES or %s_HOST and %s_PORT are required", prefix, prefix, prefix) - } - configured = net.JoinHostPort(host, port) - } - - addresses := make([]string, 0) - for configuredAddress := range strings.SplitSeq(configured, ",") { - address := strings.TrimSpace(configuredAddress) - if address == "" { - continue - } - if _, _, err := net.SplitHostPort(address); err != nil { - return nil, fmt.Errorf("%s_ADDRESSES contains invalid address %q", prefix, address) - } - addresses = append(addresses, address) - } - if len(addresses) == 0 { - return nil, fmt.Errorf("%s_ADDRESSES must contain an address", prefix) - } - - return addresses, nil -} - -func setting(prefix, name, fallback string) string { - if value := strings.TrimSpace(os.Getenv(prefix + "_" + name)); value != "" { - return value - } - return fallback -} - -func connectionPrefix(connection string) (string, error) { - connection = strings.TrimSpace(connection) - if connection == "" || connection == DefaultConnection { - return "REDIS", nil - } - - for _, character := range connection { - if character >= 'a' && character <= 'z' || character >= 'A' && character <= 'Z' || - character >= '0' && character <= '9' || character == '_' { - continue - } - return "", fmt.Errorf("invalid Redis connection name %q", connection) - } - - return "REDIS_" + strings.ToUpper(connection), nil -} diff --git a/redis/connection_test.go b/redis/connection_test.go deleted file mode 100644 index 134274d..0000000 --- a/redis/connection_test.go +++ /dev/null @@ -1,116 +0,0 @@ -package redis_test - -import ( - "context" - "os" - "testing" - "time" - - redisconnection "github.com/gonstruct/core/redis" -) - -func TestLoadUsesDefaultConnectionSettings(t *testing.T) { - configureSharedRedis(t) - - configuration, err := redisconnection.Load(redisconnection.DefaultConnection) - if err != nil { - t.Fatal(err) - } - if configuration.Mode != redisconnection.ModeSingle || - len(configuration.Addresses) != 1 || configuration.Addresses[0] != "shared-redis:6379" { - t.Fatalf("unexpected default Redis configuration: %#v", configuration) - } -} - -func TestLoadBuildsNamedSentinelConnection(t *testing.T) { - configureSharedRedis(t) - t.Setenv("REDIS_QUEUE_MODE", "sentinel") - t.Setenv("REDIS_QUEUE_ADDRESSES", "sentinel-1:26379, sentinel-2:26379, sentinel-3:26379") - t.Setenv("REDIS_QUEUE_MASTER_NAME", "example-queue") - t.Setenv("REDIS_QUEUE_SENTINEL_USERNAME", "sentinel-user") - t.Setenv("REDIS_QUEUE_SENTINEL_PASSWORD", "sentinel-secret") - - configuration, err := redisconnection.Load("queue") - if err != nil { - t.Fatal(err) - } - options := configuration.Options() - if configuration.Mode != redisconnection.ModeSentinel || len(options.Addrs) != 3 || - options.MasterName != "example-queue" || options.SentinelUsername != "sentinel-user" || - options.SentinelPassword != "sentinel-secret" { - t.Fatalf("unexpected Sentinel configuration: %#v", configuration) - } -} - -func TestLoadAllowsDedicatedCacheCluster(t *testing.T) { - configureSharedRedis(t) - t.Setenv("REDIS_CACHE_MODE", "cluster") - t.Setenv("REDIS_CACHE_ADDRESSES", "cache-1:6379,cache-2:6379,cache-3:6379") - t.Setenv("REDIS_CACHE_DATABASE", "0") - - configuration, err := redisconnection.Load("cache") - if err != nil { - t.Fatal(err) - } - options := configuration.Options() - if configuration.Mode != redisconnection.ModeCluster || !options.IsClusterMode || len(options.Addrs) != 3 { - t.Fatalf("unexpected cluster configuration: %#v", configuration) - } -} - -func TestLoadRejectsNonzeroClusterDatabase(t *testing.T) { - configureSharedRedis(t) - t.Setenv("REDIS_QUEUE_MODE", "cluster") - t.Setenv("REDIS_QUEUE_ADDRESSES", "queue-1:6379,queue-2:6379") - t.Setenv("REDIS_QUEUE_DATABASE", "2") - - if _, err := redisconnection.Load("queue"); err == nil || - err.Error() != "REDIS_QUEUE_DATABASE must be 0 in cluster mode" { - t.Fatalf("unexpected cluster database validation: %v", err) - } -} - -func TestLoadRejectsSentinelWithoutMasterName(t *testing.T) { - configureSharedRedis(t) - t.Setenv("REDIS_QUEUE_MODE", "sentinel") - t.Setenv("REDIS_QUEUE_ADDRESSES", "sentinel-1:26379") - t.Setenv("REDIS_QUEUE_MASTER_NAME", "") - - if _, err := redisconnection.Load("queue"); err == nil || - err.Error() != "REDIS_QUEUE_MASTER_NAME is required in sentinel mode" { - t.Fatalf("unexpected Sentinel validation: %v", err) - } -} - -func TestConfiguredClientConnectsToRedis(t *testing.T) { - if os.Getenv("REDIS_TOPOLOGY_INTEGRATION") != "1" { - t.Skip("set REDIS_TOPOLOGY_INTEGRATION=1 to run the Redis topology integration test") - } - - client, err := redisconnection.NewClient(redisconnection.DefaultConnection) - if err != nil { - t.Fatal(err) - } - t.Cleanup(func() { _ = client.Close() }) - - pingContext, cancel := context.WithTimeout(t.Context(), 2*time.Second) - defer cancel() - if err := client.Ping(pingContext).Err(); err != nil { - t.Fatalf("configured Redis client could not connect: %v", err) - } -} - -func configureSharedRedis(t *testing.T) { - t.Helper() - t.Setenv("REDIS_MODE", "single") - t.Setenv("REDIS_ADDRESSES", "") - t.Setenv("REDIS_HOST", "shared-redis") - t.Setenv("REDIS_PORT", "6379") - t.Setenv("REDIS_DATABASE", "0") - t.Setenv("REDIS_USERNAME", "") - t.Setenv("REDIS_PASSWORD", "") - t.Setenv("REDIS_MASTER_NAME", "") - t.Setenv("REDIS_SENTINEL_USERNAME", "") - t.Setenv("REDIS_SENTINEL_PASSWORD", "") - t.Setenv("REDIS_TLS", "false") -} diff --git a/tests/redis/connection_test.go b/tests/redis/connection_test.go new file mode 100644 index 0000000..113dcba --- /dev/null +++ b/tests/redis/connection_test.go @@ -0,0 +1,107 @@ +package redis_test + +import ( + "context" + "errors" + "os" + "testing" + "time" + + "github.com/gonstruct/core/config" + redisconnection "github.com/gonstruct/core/redis" +) + +func configure(connections map[config.RedisConnectionType]config.RedisConnection) { + redisconnection.Configure(config.Redis{Connections: connections}) +} + +func TestAConnectionNeedsAConfig(t *testing.T) { + // Before any Configure in this process: the first test to run. + if _, err := redisconnection.Load("default"); !errors.Is(err, redisconnection.ErrNoConfig) { + t.Fatalf("expected ErrNoConfig, got %v", err) + } +} + +func TestLoadUsesTheDefaultConnection(t *testing.T) { + configure(map[config.RedisConnectionType]config.RedisConnection{ + config.DefaultRedisConnection: {Host: "shared-redis", Port: "6379"}, + }) + + configuration, err := redisconnection.Load("") + if err != nil { + t.Fatal(err) + } + if configuration.Mode != redisconnection.ModeSingle || len(configuration.Addresses) != 1 || configuration.Addresses[0] != "shared-redis:6379" { + t.Fatalf("unexpected default Redis configuration: %#v", configuration) + } +} + +func TestLoadBuildsANamedSentinelConnection(t *testing.T) { + configure(map[config.RedisConnectionType]config.RedisConnection{ + "queue": { + Mode: redisconnection.ModeSentinel, + Addresses: []string{"sentinel-1:26379", "sentinel-2:26379", "sentinel-3:26379"}, + MasterName: "example-queue", + SentinelUsername: "sentinel-user", + SentinelPassword: "sentinel-secret", + }, + }) + + configuration, err := redisconnection.Load("queue") + if err != nil { + t.Fatal(err) + } + options := configuration.Options() + if len(options.Addrs) != 3 || options.MasterName != "example-queue" || options.SentinelUsername != "sentinel-user" || + options.SentinelPassword != "sentinel-secret" { + t.Fatalf("unexpected Sentinel configuration: %#v", configuration) + } +} + +func TestLoadAllowsACluster(t *testing.T) { + configure(map[config.RedisConnectionType]config.RedisConnection{ + "cache": {Mode: redisconnection.ModeCluster, Addresses: []string{"cache-1:6379", "cache-2:6379", "cache-3:6379"}}, + }) + + configuration, err := redisconnection.Load("cache") + if err != nil || !configuration.Options().IsClusterMode || len(configuration.Options().Addrs) != 3 { + t.Fatalf("unexpected cluster configuration: %#v (%v)", configuration, err) + } +} + +func TestLoadRefuses(t *testing.T) { + configure(map[config.RedisConnectionType]config.RedisConnection{ + "no-address": {}, + "no-master": {Mode: redisconnection.ModeSentinel, Addresses: []string{"sentinel-1:26379"}}, + "cluster-db": {Mode: redisconnection.ModeCluster, Addresses: []string{"cache-1:6379"}, Database: 2}, + "bad-mode": {Mode: "ring", Addresses: []string{"a:1"}}, + "bad-db": {Host: "a", Port: "1", Database: 16}, + }) + + for _, name := range []string{"no-address", "no-master", "cluster-db", "bad-mode", "bad-db", "missing"} { + if _, err := redisconnection.Load(name); err == nil { + t.Errorf("expected %s refused", name) + } + } +} + +func TestConfiguredClientConnectsToRedis(t *testing.T) { + if os.Getenv("REDIS_TOPOLOGY_INTEGRATION") != "1" { + t.Skip("set REDIS_TOPOLOGY_INTEGRATION=1, REDIS_HOST and REDIS_PORT to run the Redis topology integration test") + } + configure(map[config.RedisConnectionType]config.RedisConnection{ + config.DefaultRedisConnection: {Host: os.Getenv("REDIS_HOST"), Port: os.Getenv("REDIS_PORT")}, + }) + + client, err := redisconnection.NewClient(redisconnection.DefaultConnection) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = client.Close() }) + + pingContext, cancel := context.WithTimeout(t.Context(), 2*time.Second) + defer cancel() + if err := client.Ping(pingContext).Err(); err != nil { + t.Fatalf("configured Redis client could not connect: %v", err) + } +} From f3818d4b946b8a60174d36776d0a73c31ca7bd29 Mon Sep 17 00:00:00 2001 From: Arjen de Vos Date: Mon, 23 Nov 2026 15:58:11 +0000 Subject: [PATCH 2/2] refactor(redis): type the connection mode in the config and keep the missing config error inline --- config/redis.go | 19 ++++++++++++++++++- redis/connection.go | 30 ++++++++++++++---------------- tests/redis/connection_test.go | 14 +++++++------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/config/redis.go b/config/redis.go index 0760cb9..3feaf01 100644 --- a/config/redis.go +++ b/config/redis.go @@ -11,7 +11,7 @@ type Redis struct { // a cluster. type RedisConnection struct { // Mode is single (the default when empty), sentinel or cluster. - Mode string + Mode redisMode // Addresses is its servers, or its sentinels; or Host and Port for one. Addresses []string Host string @@ -27,6 +27,23 @@ type RedisConnection struct { TLS bool } +// redisMode is how a Redis connection reaches its servers. +type redisMode string + +const ( + SingleRedisMode redisMode = "single" + SentinelRedisMode redisMode = "sentinel" + ClusterRedisMode redisMode = "cluster" +) + +func (mode redisMode) Values() []redisMode { + return []redisMode{SingleRedisMode, SentinelRedisMode, ClusterRedisMode} +} + +func (mode redisMode) String() string { + return string(mode) +} + type RedisConnectionType string const ( diff --git a/redis/connection.go b/redis/connection.go index e68dbd5..9a86155 100644 --- a/redis/connection.go +++ b/redis/connection.go @@ -16,9 +16,9 @@ import ( const ( DefaultConnection = "default" - ModeSingle = "single" - ModeSentinel = "sentinel" - ModeCluster = "cluster" + ModeSingle = string(config.SingleRedisMode) + ModeSentinel = string(config.SentinelRedisMode) + ModeCluster = string(config.ClusterRedisMode) ) type Configuration struct { @@ -33,9 +33,6 @@ type Configuration struct { TLS bool } -// ErrNoConfig is a Redis connection asked for before Configure. -var ErrNoConfig = errors.New("[redis] no config: pass app.WithRedis") - // configured is the app's connections, by name. var configured atomic.Pointer[config.Redis] @@ -49,7 +46,7 @@ func Configure(redis config.Redis) { func Load(connection string) (Configuration, error) { redis := configured.Load() if redis == nil { - return Configuration{}, ErrNoConfig + return Configuration{}, errors.New("[redis] no config: pass app.WithRedis") } if strings.TrimSpace(connection) == "" { connection = DefaultConnection @@ -59,9 +56,17 @@ func Load(connection string) (Configuration, error) { return Configuration{}, fmt.Errorf("[redis] no connection %q in the config", connection) } + mode, addresses := ModeSingle, settings.Addresses + if settings.Mode != "" { + mode = settings.Mode.String() + } + if len(addresses) == 0 && settings.Host != "" && settings.Port != "" { + addresses = []string{net.JoinHostPort(settings.Host, settings.Port)} + } + configuration := Configuration{ - Mode: strings.ToLower(settings.Mode), - Addresses: settings.Addresses, + Mode: mode, + Addresses: addresses, MasterName: settings.MasterName, Username: settings.Username, Password: settings.Password, @@ -70,13 +75,6 @@ func Load(connection string) (Configuration, error) { Database: settings.Database, TLS: settings.TLS, } - if configuration.Mode == "" { - configuration.Mode = ModeSingle - } - if len(configuration.Addresses) == 0 && settings.Host != "" && settings.Port != "" { - configuration.Addresses = []string{net.JoinHostPort(settings.Host, settings.Port)} - } - if err := configuration.validate(connection); err != nil { return Configuration{}, err } diff --git a/tests/redis/connection_test.go b/tests/redis/connection_test.go index 113dcba..ae878b7 100644 --- a/tests/redis/connection_test.go +++ b/tests/redis/connection_test.go @@ -2,8 +2,8 @@ package redis_test import ( "context" - "errors" "os" + "strings" "testing" "time" @@ -17,8 +17,8 @@ func configure(connections map[config.RedisConnectionType]config.RedisConnection func TestAConnectionNeedsAConfig(t *testing.T) { // Before any Configure in this process: the first test to run. - if _, err := redisconnection.Load("default"); !errors.Is(err, redisconnection.ErrNoConfig) { - t.Fatalf("expected ErrNoConfig, got %v", err) + if _, err := redisconnection.Load("default"); err == nil || !strings.Contains(err.Error(), "no config") { + t.Fatalf("expected no config, got %v", err) } } @@ -39,7 +39,7 @@ func TestLoadUsesTheDefaultConnection(t *testing.T) { func TestLoadBuildsANamedSentinelConnection(t *testing.T) { configure(map[config.RedisConnectionType]config.RedisConnection{ "queue": { - Mode: redisconnection.ModeSentinel, + Mode: config.SentinelRedisMode, Addresses: []string{"sentinel-1:26379", "sentinel-2:26379", "sentinel-3:26379"}, MasterName: "example-queue", SentinelUsername: "sentinel-user", @@ -60,7 +60,7 @@ func TestLoadBuildsANamedSentinelConnection(t *testing.T) { func TestLoadAllowsACluster(t *testing.T) { configure(map[config.RedisConnectionType]config.RedisConnection{ - "cache": {Mode: redisconnection.ModeCluster, Addresses: []string{"cache-1:6379", "cache-2:6379", "cache-3:6379"}}, + "cache": {Mode: config.ClusterRedisMode, Addresses: []string{"cache-1:6379", "cache-2:6379", "cache-3:6379"}}, }) configuration, err := redisconnection.Load("cache") @@ -72,8 +72,8 @@ func TestLoadAllowsACluster(t *testing.T) { func TestLoadRefuses(t *testing.T) { configure(map[config.RedisConnectionType]config.RedisConnection{ "no-address": {}, - "no-master": {Mode: redisconnection.ModeSentinel, Addresses: []string{"sentinel-1:26379"}}, - "cluster-db": {Mode: redisconnection.ModeCluster, Addresses: []string{"cache-1:6379"}, Database: 2}, + "no-master": {Mode: config.SentinelRedisMode, Addresses: []string{"sentinel-1:26379"}}, + "cluster-db": {Mode: config.ClusterRedisMode, Addresses: []string{"cache-1:6379"}, Database: 2}, "bad-mode": {Mode: "ring", Addresses: []string{"a:1"}}, "bad-db": {Host: "a", Port: "1", Database: 16}, })