Files
tasks/common/dynamicconfig/setting_gen.go
David ReissandGitHub a45779b689 Support subscriptions to settings with constrained defaults (#8180)
## What changed?
Fill in support for subscriptions to dynamic config values with
constrained defaults.

## Why?
We'd like to use this combination of functionality.

## How did you test it?
- [x] added new unit test(s)
2025-08-18 15:34:34 -07:00

1734 lines
67 KiB
Go

// Code generated by cmd/tools/gendynamicconfig. DO NOT EDIT.
package dynamicconfig
import (
"time"
enumspb "go.temporal.io/api/enums/v1"
enumsspb "go.temporal.io/server/api/enums/v1"
"go.temporal.io/server/common/namespace"
)
const (
PrecedenceUnknown Precedence = iota
PrecedenceGlobal
PrecedenceNamespace
PrecedenceNamespaceID
PrecedenceTaskQueue
PrecedenceShardID
PrecedenceTaskType
PrecedenceDestination
)
type GlobalBoolSetting = GlobalTypedSetting[bool]
type GlobalBoolConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[bool]
func NewGlobalBoolSetting(key Key, def bool, description string) GlobalBoolSetting {
return NewGlobalTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewGlobalBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) GlobalBoolConstrainedDefaultSetting {
return NewGlobalTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFn = TypedPropertyFn[bool]
func GetBoolPropertyFn(value bool) BoolPropertyFn {
return GetTypedPropertyFn(value)
}
type NamespaceBoolSetting = NamespaceTypedSetting[bool]
type NamespaceBoolConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[bool]
func NewNamespaceBoolSetting(key Key, def bool, description string) NamespaceBoolSetting {
return NewNamespaceTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewNamespaceBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) NamespaceBoolConstrainedDefaultSetting {
return NewNamespaceTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[bool]
func GetBoolPropertyFnFilteredByNamespace(value bool) BoolPropertyFnWithNamespaceFilter {
return GetTypedPropertyFnFilteredByNamespace(value)
}
type NamespaceIDBoolSetting = NamespaceIDTypedSetting[bool]
type NamespaceIDBoolConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[bool]
func NewNamespaceIDBoolSetting(key Key, def bool, description string) NamespaceIDBoolSetting {
return NewNamespaceIDTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewNamespaceIDBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) NamespaceIDBoolConstrainedDefaultSetting {
return NewNamespaceIDTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFnWithNamespaceIDFilter = TypedPropertyFnWithNamespaceIDFilter[bool]
func GetBoolPropertyFnFilteredByNamespaceID(value bool) BoolPropertyFnWithNamespaceIDFilter {
return GetTypedPropertyFnFilteredByNamespaceID(value)
}
type TaskQueueBoolSetting = TaskQueueTypedSetting[bool]
type TaskQueueBoolConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[bool]
func NewTaskQueueBoolSetting(key Key, def bool, description string) TaskQueueBoolSetting {
return NewTaskQueueTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewTaskQueueBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) TaskQueueBoolConstrainedDefaultSetting {
return NewTaskQueueTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[bool]
func GetBoolPropertyFnFilteredByTaskQueue(value bool) BoolPropertyFnWithTaskQueueFilter {
return GetTypedPropertyFnFilteredByTaskQueue(value)
}
type ShardIDBoolSetting = ShardIDTypedSetting[bool]
type ShardIDBoolConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[bool]
func NewShardIDBoolSetting(key Key, def bool, description string) ShardIDBoolSetting {
return NewShardIDTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewShardIDBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) ShardIDBoolConstrainedDefaultSetting {
return NewShardIDTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFnWithShardIDFilter = TypedPropertyFnWithShardIDFilter[bool]
func GetBoolPropertyFnFilteredByShardID(value bool) BoolPropertyFnWithShardIDFilter {
return GetTypedPropertyFnFilteredByShardID(value)
}
type TaskTypeBoolSetting = TaskTypeTypedSetting[bool]
type TaskTypeBoolConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[bool]
func NewTaskTypeBoolSetting(key Key, def bool, description string) TaskTypeBoolSetting {
return NewTaskTypeTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewTaskTypeBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) TaskTypeBoolConstrainedDefaultSetting {
return NewTaskTypeTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFnWithTaskTypeFilter = TypedPropertyFnWithTaskTypeFilter[bool]
func GetBoolPropertyFnFilteredByTaskType(value bool) BoolPropertyFnWithTaskTypeFilter {
return GetTypedPropertyFnFilteredByTaskType(value)
}
type DestinationBoolSetting = DestinationTypedSetting[bool]
type DestinationBoolConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[bool]
func NewDestinationBoolSetting(key Key, def bool, description string) DestinationBoolSetting {
return NewDestinationTypedSettingWithConverter[bool](key, convertBool, def, description)
}
func NewDestinationBoolSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[bool], description string) DestinationBoolConstrainedDefaultSetting {
return NewDestinationTypedSettingWithConstrainedDefault[bool](key, convertBool, cdef, description)
}
type BoolPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[bool]
func GetBoolPropertyFnFilteredByDestination(value bool) BoolPropertyFnWithDestinationFilter {
return GetTypedPropertyFnFilteredByDestination(value)
}
type GlobalIntSetting = GlobalTypedSetting[int]
type GlobalIntConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[int]
func NewGlobalIntSetting(key Key, def int, description string) GlobalIntSetting {
return NewGlobalTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewGlobalIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) GlobalIntConstrainedDefaultSetting {
return NewGlobalTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFn = TypedPropertyFn[int]
func GetIntPropertyFn(value int) IntPropertyFn {
return GetTypedPropertyFn(value)
}
type NamespaceIntSetting = NamespaceTypedSetting[int]
type NamespaceIntConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[int]
func NewNamespaceIntSetting(key Key, def int, description string) NamespaceIntSetting {
return NewNamespaceTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewNamespaceIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) NamespaceIntConstrainedDefaultSetting {
return NewNamespaceTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[int]
func GetIntPropertyFnFilteredByNamespace(value int) IntPropertyFnWithNamespaceFilter {
return GetTypedPropertyFnFilteredByNamespace(value)
}
type NamespaceIDIntSetting = NamespaceIDTypedSetting[int]
type NamespaceIDIntConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[int]
func NewNamespaceIDIntSetting(key Key, def int, description string) NamespaceIDIntSetting {
return NewNamespaceIDTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewNamespaceIDIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) NamespaceIDIntConstrainedDefaultSetting {
return NewNamespaceIDTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFnWithNamespaceIDFilter = TypedPropertyFnWithNamespaceIDFilter[int]
func GetIntPropertyFnFilteredByNamespaceID(value int) IntPropertyFnWithNamespaceIDFilter {
return GetTypedPropertyFnFilteredByNamespaceID(value)
}
type TaskQueueIntSetting = TaskQueueTypedSetting[int]
type TaskQueueIntConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[int]
func NewTaskQueueIntSetting(key Key, def int, description string) TaskQueueIntSetting {
return NewTaskQueueTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewTaskQueueIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) TaskQueueIntConstrainedDefaultSetting {
return NewTaskQueueTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[int]
func GetIntPropertyFnFilteredByTaskQueue(value int) IntPropertyFnWithTaskQueueFilter {
return GetTypedPropertyFnFilteredByTaskQueue(value)
}
type ShardIDIntSetting = ShardIDTypedSetting[int]
type ShardIDIntConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[int]
func NewShardIDIntSetting(key Key, def int, description string) ShardIDIntSetting {
return NewShardIDTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewShardIDIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) ShardIDIntConstrainedDefaultSetting {
return NewShardIDTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFnWithShardIDFilter = TypedPropertyFnWithShardIDFilter[int]
func GetIntPropertyFnFilteredByShardID(value int) IntPropertyFnWithShardIDFilter {
return GetTypedPropertyFnFilteredByShardID(value)
}
type TaskTypeIntSetting = TaskTypeTypedSetting[int]
type TaskTypeIntConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[int]
func NewTaskTypeIntSetting(key Key, def int, description string) TaskTypeIntSetting {
return NewTaskTypeTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewTaskTypeIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) TaskTypeIntConstrainedDefaultSetting {
return NewTaskTypeTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFnWithTaskTypeFilter = TypedPropertyFnWithTaskTypeFilter[int]
func GetIntPropertyFnFilteredByTaskType(value int) IntPropertyFnWithTaskTypeFilter {
return GetTypedPropertyFnFilteredByTaskType(value)
}
type DestinationIntSetting = DestinationTypedSetting[int]
type DestinationIntConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[int]
func NewDestinationIntSetting(key Key, def int, description string) DestinationIntSetting {
return NewDestinationTypedSettingWithConverter[int](key, convertInt, def, description)
}
func NewDestinationIntSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[int], description string) DestinationIntConstrainedDefaultSetting {
return NewDestinationTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
}
type IntPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[int]
func GetIntPropertyFnFilteredByDestination(value int) IntPropertyFnWithDestinationFilter {
return GetTypedPropertyFnFilteredByDestination(value)
}
type GlobalFloatSetting = GlobalTypedSetting[float64]
type GlobalFloatConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[float64]
func NewGlobalFloatSetting(key Key, def float64, description string) GlobalFloatSetting {
return NewGlobalTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewGlobalFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) GlobalFloatConstrainedDefaultSetting {
return NewGlobalTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFn = TypedPropertyFn[float64]
func GetFloatPropertyFn(value float64) FloatPropertyFn {
return GetTypedPropertyFn(value)
}
type NamespaceFloatSetting = NamespaceTypedSetting[float64]
type NamespaceFloatConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[float64]
func NewNamespaceFloatSetting(key Key, def float64, description string) NamespaceFloatSetting {
return NewNamespaceTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewNamespaceFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) NamespaceFloatConstrainedDefaultSetting {
return NewNamespaceTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[float64]
func GetFloatPropertyFnFilteredByNamespace(value float64) FloatPropertyFnWithNamespaceFilter {
return GetTypedPropertyFnFilteredByNamespace(value)
}
type NamespaceIDFloatSetting = NamespaceIDTypedSetting[float64]
type NamespaceIDFloatConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[float64]
func NewNamespaceIDFloatSetting(key Key, def float64, description string) NamespaceIDFloatSetting {
return NewNamespaceIDTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewNamespaceIDFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) NamespaceIDFloatConstrainedDefaultSetting {
return NewNamespaceIDTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFnWithNamespaceIDFilter = TypedPropertyFnWithNamespaceIDFilter[float64]
func GetFloatPropertyFnFilteredByNamespaceID(value float64) FloatPropertyFnWithNamespaceIDFilter {
return GetTypedPropertyFnFilteredByNamespaceID(value)
}
type TaskQueueFloatSetting = TaskQueueTypedSetting[float64]
type TaskQueueFloatConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[float64]
func NewTaskQueueFloatSetting(key Key, def float64, description string) TaskQueueFloatSetting {
return NewTaskQueueTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewTaskQueueFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) TaskQueueFloatConstrainedDefaultSetting {
return NewTaskQueueTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[float64]
func GetFloatPropertyFnFilteredByTaskQueue(value float64) FloatPropertyFnWithTaskQueueFilter {
return GetTypedPropertyFnFilteredByTaskQueue(value)
}
type ShardIDFloatSetting = ShardIDTypedSetting[float64]
type ShardIDFloatConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[float64]
func NewShardIDFloatSetting(key Key, def float64, description string) ShardIDFloatSetting {
return NewShardIDTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewShardIDFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) ShardIDFloatConstrainedDefaultSetting {
return NewShardIDTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFnWithShardIDFilter = TypedPropertyFnWithShardIDFilter[float64]
func GetFloatPropertyFnFilteredByShardID(value float64) FloatPropertyFnWithShardIDFilter {
return GetTypedPropertyFnFilteredByShardID(value)
}
type TaskTypeFloatSetting = TaskTypeTypedSetting[float64]
type TaskTypeFloatConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[float64]
func NewTaskTypeFloatSetting(key Key, def float64, description string) TaskTypeFloatSetting {
return NewTaskTypeTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewTaskTypeFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) TaskTypeFloatConstrainedDefaultSetting {
return NewTaskTypeTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFnWithTaskTypeFilter = TypedPropertyFnWithTaskTypeFilter[float64]
func GetFloatPropertyFnFilteredByTaskType(value float64) FloatPropertyFnWithTaskTypeFilter {
return GetTypedPropertyFnFilteredByTaskType(value)
}
type DestinationFloatSetting = DestinationTypedSetting[float64]
type DestinationFloatConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[float64]
func NewDestinationFloatSetting(key Key, def float64, description string) DestinationFloatSetting {
return NewDestinationTypedSettingWithConverter[float64](key, convertFloat, def, description)
}
func NewDestinationFloatSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[float64], description string) DestinationFloatConstrainedDefaultSetting {
return NewDestinationTypedSettingWithConstrainedDefault[float64](key, convertFloat, cdef, description)
}
type FloatPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[float64]
func GetFloatPropertyFnFilteredByDestination(value float64) FloatPropertyFnWithDestinationFilter {
return GetTypedPropertyFnFilteredByDestination(value)
}
type GlobalStringSetting = GlobalTypedSetting[string]
type GlobalStringConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[string]
func NewGlobalStringSetting(key Key, def string, description string) GlobalStringSetting {
return NewGlobalTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewGlobalStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) GlobalStringConstrainedDefaultSetting {
return NewGlobalTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFn = TypedPropertyFn[string]
func GetStringPropertyFn(value string) StringPropertyFn {
return GetTypedPropertyFn(value)
}
type NamespaceStringSetting = NamespaceTypedSetting[string]
type NamespaceStringConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[string]
func NewNamespaceStringSetting(key Key, def string, description string) NamespaceStringSetting {
return NewNamespaceTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewNamespaceStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) NamespaceStringConstrainedDefaultSetting {
return NewNamespaceTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[string]
func GetStringPropertyFnFilteredByNamespace(value string) StringPropertyFnWithNamespaceFilter {
return GetTypedPropertyFnFilteredByNamespace(value)
}
type NamespaceIDStringSetting = NamespaceIDTypedSetting[string]
type NamespaceIDStringConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[string]
func NewNamespaceIDStringSetting(key Key, def string, description string) NamespaceIDStringSetting {
return NewNamespaceIDTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewNamespaceIDStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) NamespaceIDStringConstrainedDefaultSetting {
return NewNamespaceIDTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFnWithNamespaceIDFilter = TypedPropertyFnWithNamespaceIDFilter[string]
func GetStringPropertyFnFilteredByNamespaceID(value string) StringPropertyFnWithNamespaceIDFilter {
return GetTypedPropertyFnFilteredByNamespaceID(value)
}
type TaskQueueStringSetting = TaskQueueTypedSetting[string]
type TaskQueueStringConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[string]
func NewTaskQueueStringSetting(key Key, def string, description string) TaskQueueStringSetting {
return NewTaskQueueTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewTaskQueueStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) TaskQueueStringConstrainedDefaultSetting {
return NewTaskQueueTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[string]
func GetStringPropertyFnFilteredByTaskQueue(value string) StringPropertyFnWithTaskQueueFilter {
return GetTypedPropertyFnFilteredByTaskQueue(value)
}
type ShardIDStringSetting = ShardIDTypedSetting[string]
type ShardIDStringConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[string]
func NewShardIDStringSetting(key Key, def string, description string) ShardIDStringSetting {
return NewShardIDTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewShardIDStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) ShardIDStringConstrainedDefaultSetting {
return NewShardIDTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFnWithShardIDFilter = TypedPropertyFnWithShardIDFilter[string]
func GetStringPropertyFnFilteredByShardID(value string) StringPropertyFnWithShardIDFilter {
return GetTypedPropertyFnFilteredByShardID(value)
}
type TaskTypeStringSetting = TaskTypeTypedSetting[string]
type TaskTypeStringConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[string]
func NewTaskTypeStringSetting(key Key, def string, description string) TaskTypeStringSetting {
return NewTaskTypeTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewTaskTypeStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) TaskTypeStringConstrainedDefaultSetting {
return NewTaskTypeTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFnWithTaskTypeFilter = TypedPropertyFnWithTaskTypeFilter[string]
func GetStringPropertyFnFilteredByTaskType(value string) StringPropertyFnWithTaskTypeFilter {
return GetTypedPropertyFnFilteredByTaskType(value)
}
type DestinationStringSetting = DestinationTypedSetting[string]
type DestinationStringConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[string]
func NewDestinationStringSetting(key Key, def string, description string) DestinationStringSetting {
return NewDestinationTypedSettingWithConverter[string](key, convertString, def, description)
}
func NewDestinationStringSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[string], description string) DestinationStringConstrainedDefaultSetting {
return NewDestinationTypedSettingWithConstrainedDefault[string](key, convertString, cdef, description)
}
type StringPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[string]
func GetStringPropertyFnFilteredByDestination(value string) StringPropertyFnWithDestinationFilter {
return GetTypedPropertyFnFilteredByDestination(value)
}
type GlobalDurationSetting = GlobalTypedSetting[time.Duration]
type GlobalDurationConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[time.Duration]
func NewGlobalDurationSetting(key Key, def time.Duration, description string) GlobalDurationSetting {
return NewGlobalTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewGlobalDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) GlobalDurationConstrainedDefaultSetting {
return NewGlobalTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFn = TypedPropertyFn[time.Duration]
func GetDurationPropertyFn(value time.Duration) DurationPropertyFn {
return GetTypedPropertyFn(value)
}
type NamespaceDurationSetting = NamespaceTypedSetting[time.Duration]
type NamespaceDurationConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[time.Duration]
func NewNamespaceDurationSetting(key Key, def time.Duration, description string) NamespaceDurationSetting {
return NewNamespaceTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewNamespaceDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceDurationConstrainedDefaultSetting {
return NewNamespaceTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[time.Duration]
func GetDurationPropertyFnFilteredByNamespace(value time.Duration) DurationPropertyFnWithNamespaceFilter {
return GetTypedPropertyFnFilteredByNamespace(value)
}
type NamespaceIDDurationSetting = NamespaceIDTypedSetting[time.Duration]
type NamespaceIDDurationConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[time.Duration]
func NewNamespaceIDDurationSetting(key Key, def time.Duration, description string) NamespaceIDDurationSetting {
return NewNamespaceIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewNamespaceIDDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceIDDurationConstrainedDefaultSetting {
return NewNamespaceIDTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFnWithNamespaceIDFilter = TypedPropertyFnWithNamespaceIDFilter[time.Duration]
func GetDurationPropertyFnFilteredByNamespaceID(value time.Duration) DurationPropertyFnWithNamespaceIDFilter {
return GetTypedPropertyFnFilteredByNamespaceID(value)
}
type TaskQueueDurationSetting = TaskQueueTypedSetting[time.Duration]
type TaskQueueDurationConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[time.Duration]
func NewTaskQueueDurationSetting(key Key, def time.Duration, description string) TaskQueueDurationSetting {
return NewTaskQueueTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewTaskQueueDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) TaskQueueDurationConstrainedDefaultSetting {
return NewTaskQueueTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[time.Duration]
func GetDurationPropertyFnFilteredByTaskQueue(value time.Duration) DurationPropertyFnWithTaskQueueFilter {
return GetTypedPropertyFnFilteredByTaskQueue(value)
}
type ShardIDDurationSetting = ShardIDTypedSetting[time.Duration]
type ShardIDDurationConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[time.Duration]
func NewShardIDDurationSetting(key Key, def time.Duration, description string) ShardIDDurationSetting {
return NewShardIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewShardIDDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) ShardIDDurationConstrainedDefaultSetting {
return NewShardIDTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFnWithShardIDFilter = TypedPropertyFnWithShardIDFilter[time.Duration]
func GetDurationPropertyFnFilteredByShardID(value time.Duration) DurationPropertyFnWithShardIDFilter {
return GetTypedPropertyFnFilteredByShardID(value)
}
type TaskTypeDurationSetting = TaskTypeTypedSetting[time.Duration]
type TaskTypeDurationConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[time.Duration]
func NewTaskTypeDurationSetting(key Key, def time.Duration, description string) TaskTypeDurationSetting {
return NewTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewTaskTypeDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) TaskTypeDurationConstrainedDefaultSetting {
return NewTaskTypeTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFnWithTaskTypeFilter = TypedPropertyFnWithTaskTypeFilter[time.Duration]
func GetDurationPropertyFnFilteredByTaskType(value time.Duration) DurationPropertyFnWithTaskTypeFilter {
return GetTypedPropertyFnFilteredByTaskType(value)
}
type DestinationDurationSetting = DestinationTypedSetting[time.Duration]
type DestinationDurationConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[time.Duration]
func NewDestinationDurationSetting(key Key, def time.Duration, description string) DestinationDurationSetting {
return NewDestinationTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
}
func NewDestinationDurationSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[time.Duration], description string) DestinationDurationConstrainedDefaultSetting {
return NewDestinationTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
}
type DurationPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[time.Duration]
func GetDurationPropertyFnFilteredByDestination(value time.Duration) DurationPropertyFnWithDestinationFilter {
return GetTypedPropertyFnFilteredByDestination(value)
}
type GlobalMapSetting = GlobalTypedSetting[map[string]any]
type GlobalMapConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[map[string]any]
func NewGlobalMapSetting(key Key, def map[string]any, description string) GlobalMapSetting {
return NewGlobalTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewGlobalMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) GlobalMapConstrainedDefaultSetting {
return NewGlobalTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFn = TypedPropertyFn[map[string]any]
func GetMapPropertyFn(value map[string]any) MapPropertyFn {
return GetTypedPropertyFn(value)
}
type NamespaceMapSetting = NamespaceTypedSetting[map[string]any]
type NamespaceMapConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[map[string]any]
func NewNamespaceMapSetting(key Key, def map[string]any, description string) NamespaceMapSetting {
return NewNamespaceTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewNamespaceMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) NamespaceMapConstrainedDefaultSetting {
return NewNamespaceTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[map[string]any]
func GetMapPropertyFnFilteredByNamespace(value map[string]any) MapPropertyFnWithNamespaceFilter {
return GetTypedPropertyFnFilteredByNamespace(value)
}
type NamespaceIDMapSetting = NamespaceIDTypedSetting[map[string]any]
type NamespaceIDMapConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[map[string]any]
func NewNamespaceIDMapSetting(key Key, def map[string]any, description string) NamespaceIDMapSetting {
return NewNamespaceIDTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewNamespaceIDMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) NamespaceIDMapConstrainedDefaultSetting {
return NewNamespaceIDTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFnWithNamespaceIDFilter = TypedPropertyFnWithNamespaceIDFilter[map[string]any]
func GetMapPropertyFnFilteredByNamespaceID(value map[string]any) MapPropertyFnWithNamespaceIDFilter {
return GetTypedPropertyFnFilteredByNamespaceID(value)
}
type TaskQueueMapSetting = TaskQueueTypedSetting[map[string]any]
type TaskQueueMapConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[map[string]any]
func NewTaskQueueMapSetting(key Key, def map[string]any, description string) TaskQueueMapSetting {
return NewTaskQueueTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewTaskQueueMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) TaskQueueMapConstrainedDefaultSetting {
return NewTaskQueueTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[map[string]any]
func GetMapPropertyFnFilteredByTaskQueue(value map[string]any) MapPropertyFnWithTaskQueueFilter {
return GetTypedPropertyFnFilteredByTaskQueue(value)
}
type ShardIDMapSetting = ShardIDTypedSetting[map[string]any]
type ShardIDMapConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[map[string]any]
func NewShardIDMapSetting(key Key, def map[string]any, description string) ShardIDMapSetting {
return NewShardIDTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewShardIDMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) ShardIDMapConstrainedDefaultSetting {
return NewShardIDTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFnWithShardIDFilter = TypedPropertyFnWithShardIDFilter[map[string]any]
func GetMapPropertyFnFilteredByShardID(value map[string]any) MapPropertyFnWithShardIDFilter {
return GetTypedPropertyFnFilteredByShardID(value)
}
type TaskTypeMapSetting = TaskTypeTypedSetting[map[string]any]
type TaskTypeMapConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[map[string]any]
func NewTaskTypeMapSetting(key Key, def map[string]any, description string) TaskTypeMapSetting {
return NewTaskTypeTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewTaskTypeMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) TaskTypeMapConstrainedDefaultSetting {
return NewTaskTypeTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFnWithTaskTypeFilter = TypedPropertyFnWithTaskTypeFilter[map[string]any]
func GetMapPropertyFnFilteredByTaskType(value map[string]any) MapPropertyFnWithTaskTypeFilter {
return GetTypedPropertyFnFilteredByTaskType(value)
}
type DestinationMapSetting = DestinationTypedSetting[map[string]any]
type DestinationMapConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[map[string]any]
func NewDestinationMapSetting(key Key, def map[string]any, description string) DestinationMapSetting {
return NewDestinationTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
}
func NewDestinationMapSettingWithConstrainedDefault(key Key, cdef []TypedConstrainedValue[map[string]any], description string) DestinationMapConstrainedDefaultSetting {
return NewDestinationTypedSettingWithConstrainedDefault[map[string]any](key, convertMap, cdef, description)
}
type MapPropertyFnWithDestinationFilter = TypedPropertyFnWithDestinationFilter[map[string]any]
func GetMapPropertyFnFilteredByDestination(value map[string]any) MapPropertyFnWithDestinationFilter {
return GetTypedPropertyFnFilteredByDestination(value)
}
type GlobalTypedSetting[T any] setting[T, func()]
type GlobalTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func()]
// NewGlobalTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewGlobalTypedSetting[T any](key Key, def T, description string) GlobalTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := GlobalTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewGlobalTypedSettingWithConverter creates a setting with a custom converter function.
func NewGlobalTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) GlobalTypedSetting[T] {
s := GlobalTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewGlobalTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewGlobalTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) GlobalTypedConstrainedDefaultSetting[T] {
s := GlobalTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s GlobalTypedSetting[T]) Key() Key { return s.key }
func (s GlobalTypedSetting[T]) Precedence() Precedence { return PrecedenceGlobal }
func (s GlobalTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s GlobalTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s GlobalTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceGlobal }
func (s GlobalTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s GlobalTypedSetting[T]) WithDefault(v T) GlobalTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFn[T any] func() T
func (s GlobalTypedSetting[T]) Get(c *Collection) TypedPropertyFn[T] {
return func() T {
prec := []Constraints{{}}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s GlobalTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFn[T] {
return func() T {
prec := []Constraints{{}}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribable[T any] func(callback func(T)) (v T, cancel func())
func (s GlobalTypedSetting[T]) Subscribe(c *Collection) TypedSubscribable[T] {
return func(callback func(T)) (T, func()) {
prec := []Constraints{{}}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s GlobalTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s GlobalTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribable[T] {
return func(callback func(T)) (T, func()) {
prec := []Constraints{{}}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s GlobalTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFn[T any](value T) TypedPropertyFn[T] {
return func() T {
return value
}
}
type NamespaceTypedSetting[T any] setting[T, func(namespace string)]
type NamespaceTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func(namespace string)]
// NewNamespaceTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewNamespaceTypedSetting[T any](key Key, def T, description string) NamespaceTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := NamespaceTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewNamespaceTypedSettingWithConverter creates a setting with a custom converter function.
func NewNamespaceTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) NamespaceTypedSetting[T] {
s := NamespaceTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewNamespaceTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewNamespaceTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) NamespaceTypedConstrainedDefaultSetting[T] {
s := NamespaceTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s NamespaceTypedSetting[T]) Key() Key { return s.key }
func (s NamespaceTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespace }
func (s NamespaceTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s NamespaceTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s NamespaceTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceNamespace }
func (s NamespaceTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s NamespaceTypedSetting[T]) WithDefault(v T) NamespaceTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFnWithNamespaceFilter[T any] func(namespace string) T
func (s NamespaceTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithNamespaceFilter[T] {
return func(namespace string) T {
prec := []Constraints{{Namespace: namespace}, {}}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s NamespaceTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFnWithNamespaceFilter[T] {
return func(namespace string) T {
prec := []Constraints{{Namespace: namespace}, {}}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribableWithNamespaceFilter[T any] func(namespace string, callback func(T)) (v T, cancel func())
func (s NamespaceTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithNamespaceFilter[T] {
return func(namespace string, callback func(T)) (T, func()) {
prec := []Constraints{{Namespace: namespace}, {}}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s NamespaceTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s NamespaceTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribableWithNamespaceFilter[T] {
return func(namespace string, callback func(T)) (T, func()) {
prec := []Constraints{{Namespace: namespace}, {}}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s NamespaceTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFnFilteredByNamespace[T any](value T) TypedPropertyFnWithNamespaceFilter[T] {
return func(namespace string) T {
return value
}
}
type NamespaceIDTypedSetting[T any] setting[T, func(namespaceID namespace.ID)]
type NamespaceIDTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func(namespaceID namespace.ID)]
// NewNamespaceIDTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewNamespaceIDTypedSetting[T any](key Key, def T, description string) NamespaceIDTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := NamespaceIDTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewNamespaceIDTypedSettingWithConverter creates a setting with a custom converter function.
func NewNamespaceIDTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) NamespaceIDTypedSetting[T] {
s := NamespaceIDTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewNamespaceIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewNamespaceIDTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) NamespaceIDTypedConstrainedDefaultSetting[T] {
s := NamespaceIDTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s NamespaceIDTypedSetting[T]) Key() Key { return s.key }
func (s NamespaceIDTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespaceID }
func (s NamespaceIDTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s NamespaceIDTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s NamespaceIDTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceNamespaceID }
func (s NamespaceIDTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s NamespaceIDTypedSetting[T]) WithDefault(v T) NamespaceIDTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFnWithNamespaceIDFilter[T any] func(namespaceID namespace.ID) T
func (s NamespaceIDTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithNamespaceIDFilter[T] {
return func(namespaceID namespace.ID) T {
prec := []Constraints{{NamespaceID: namespaceID.String()}, {}}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s NamespaceIDTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFnWithNamespaceIDFilter[T] {
return func(namespaceID namespace.ID) T {
prec := []Constraints{{NamespaceID: namespaceID.String()}, {}}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribableWithNamespaceIDFilter[T any] func(namespaceID namespace.ID, callback func(T)) (v T, cancel func())
func (s NamespaceIDTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithNamespaceIDFilter[T] {
return func(namespaceID namespace.ID, callback func(T)) (T, func()) {
prec := []Constraints{{NamespaceID: namespaceID.String()}, {}}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s NamespaceIDTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s NamespaceIDTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribableWithNamespaceIDFilter[T] {
return func(namespaceID namespace.ID, callback func(T)) (T, func()) {
prec := []Constraints{{NamespaceID: namespaceID.String()}, {}}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s NamespaceIDTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFnFilteredByNamespaceID[T any](value T) TypedPropertyFnWithNamespaceIDFilter[T] {
return func(namespaceID namespace.ID) T {
return value
}
}
type TaskQueueTypedSetting[T any] setting[T, func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType)]
type TaskQueueTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType)]
// NewTaskQueueTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewTaskQueueTypedSetting[T any](key Key, def T, description string) TaskQueueTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := TaskQueueTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewTaskQueueTypedSettingWithConverter creates a setting with a custom converter function.
func NewTaskQueueTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) TaskQueueTypedSetting[T] {
s := TaskQueueTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewTaskQueueTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewTaskQueueTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) TaskQueueTypedConstrainedDefaultSetting[T] {
s := TaskQueueTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s TaskQueueTypedSetting[T]) Key() Key { return s.key }
func (s TaskQueueTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
func (s TaskQueueTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s TaskQueueTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s TaskQueueTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
func (s TaskQueueTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s TaskQueueTypedSetting[T]) WithDefault(v T) TaskQueueTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFnWithTaskQueueFilter[T any] func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType) T
func (s TaskQueueTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithTaskQueueFilter[T] {
return func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType) T {
prec := []Constraints{
{Namespace: namespace, TaskQueueName: taskQueue, TaskQueueType: taskQueueType},
{Namespace: namespace, TaskQueueName: taskQueue},
{TaskQueueName: taskQueue},
{Namespace: namespace},
{},
}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s TaskQueueTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFnWithTaskQueueFilter[T] {
return func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType) T {
prec := []Constraints{
{Namespace: namespace, TaskQueueName: taskQueue, TaskQueueType: taskQueueType},
{Namespace: namespace, TaskQueueName: taskQueue},
{TaskQueueName: taskQueue},
{Namespace: namespace},
{},
}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribableWithTaskQueueFilter[T any] func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType, callback func(T)) (v T, cancel func())
func (s TaskQueueTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithTaskQueueFilter[T] {
return func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType, callback func(T)) (T, func()) {
prec := []Constraints{
{Namespace: namespace, TaskQueueName: taskQueue, TaskQueueType: taskQueueType},
{Namespace: namespace, TaskQueueName: taskQueue},
{TaskQueueName: taskQueue},
{Namespace: namespace},
{},
}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s TaskQueueTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s TaskQueueTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribableWithTaskQueueFilter[T] {
return func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType, callback func(T)) (T, func()) {
prec := []Constraints{
{Namespace: namespace, TaskQueueName: taskQueue, TaskQueueType: taskQueueType},
{Namespace: namespace, TaskQueueName: taskQueue},
{TaskQueueName: taskQueue},
{Namespace: namespace},
{},
}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s TaskQueueTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFnFilteredByTaskQueue[T any](value T) TypedPropertyFnWithTaskQueueFilter[T] {
return func(namespace string, taskQueue string, taskQueueType enumspb.TaskQueueType) T {
return value
}
}
type ShardIDTypedSetting[T any] setting[T, func(shardID int32)]
type ShardIDTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func(shardID int32)]
// NewShardIDTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewShardIDTypedSetting[T any](key Key, def T, description string) ShardIDTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := ShardIDTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewShardIDTypedSettingWithConverter creates a setting with a custom converter function.
func NewShardIDTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) ShardIDTypedSetting[T] {
s := ShardIDTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewShardIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewShardIDTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) ShardIDTypedConstrainedDefaultSetting[T] {
s := ShardIDTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s ShardIDTypedSetting[T]) Key() Key { return s.key }
func (s ShardIDTypedSetting[T]) Precedence() Precedence { return PrecedenceShardID }
func (s ShardIDTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s ShardIDTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s ShardIDTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceShardID }
func (s ShardIDTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s ShardIDTypedSetting[T]) WithDefault(v T) ShardIDTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFnWithShardIDFilter[T any] func(shardID int32) T
func (s ShardIDTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithShardIDFilter[T] {
return func(shardID int32) T {
prec := []Constraints{{ShardID: shardID}, {}}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s ShardIDTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFnWithShardIDFilter[T] {
return func(shardID int32) T {
prec := []Constraints{{ShardID: shardID}, {}}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribableWithShardIDFilter[T any] func(shardID int32, callback func(T)) (v T, cancel func())
func (s ShardIDTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithShardIDFilter[T] {
return func(shardID int32, callback func(T)) (T, func()) {
prec := []Constraints{{ShardID: shardID}, {}}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s ShardIDTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s ShardIDTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribableWithShardIDFilter[T] {
return func(shardID int32, callback func(T)) (T, func()) {
prec := []Constraints{{ShardID: shardID}, {}}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s ShardIDTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFnFilteredByShardID[T any](value T) TypedPropertyFnWithShardIDFilter[T] {
return func(shardID int32) T {
return value
}
}
type TaskTypeTypedSetting[T any] setting[T, func(taskType enumsspb.TaskType)]
type TaskTypeTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func(taskType enumsspb.TaskType)]
// NewTaskTypeTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewTaskTypeTypedSetting[T any](key Key, def T, description string) TaskTypeTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := TaskTypeTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
func NewTaskTypeTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) TaskTypeTypedSetting[T] {
s := TaskTypeTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewTaskTypeTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) TaskTypeTypedConstrainedDefaultSetting[T] {
s := TaskTypeTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s TaskTypeTypedSetting[T]) Key() Key { return s.key }
func (s TaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskType }
func (s TaskTypeTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s TaskTypeTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s TaskTypeTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceTaskType }
func (s TaskTypeTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s TaskTypeTypedSetting[T]) WithDefault(v T) TaskTypeTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFnWithTaskTypeFilter[T any] func(taskType enumsspb.TaskType) T
func (s TaskTypeTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithTaskTypeFilter[T] {
return func(taskType enumsspb.TaskType) T {
prec := []Constraints{{TaskType: taskType}, {}}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s TaskTypeTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFnWithTaskTypeFilter[T] {
return func(taskType enumsspb.TaskType) T {
prec := []Constraints{{TaskType: taskType}, {}}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribableWithTaskTypeFilter[T any] func(taskType enumsspb.TaskType, callback func(T)) (v T, cancel func())
func (s TaskTypeTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithTaskTypeFilter[T] {
return func(taskType enumsspb.TaskType, callback func(T)) (T, func()) {
prec := []Constraints{{TaskType: taskType}, {}}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s TaskTypeTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s TaskTypeTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribableWithTaskTypeFilter[T] {
return func(taskType enumsspb.TaskType, callback func(T)) (T, func()) {
prec := []Constraints{{TaskType: taskType}, {}}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s TaskTypeTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFnFilteredByTaskType[T any](value T) TypedPropertyFnWithTaskTypeFilter[T] {
return func(taskType enumsspb.TaskType) T {
return value
}
}
type DestinationTypedSetting[T any] setting[T, func(namespace string, destination string)]
type DestinationTypedConstrainedDefaultSetting[T any] constrainedDefaultSetting[T, func(namespace string, destination string)]
// NewDestinationTypedSetting creates a setting that uses mapstructure to handle complex structured
// values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
// when using non-empty maps or slices as defaults, the result may not be what you want.
func NewDestinationTypedSetting[T any](key Key, def T, description string) DestinationTypedSetting[T] {
// Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
warnDefaultSharedStructure(key, def)
// If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
_ = deepCopyForMapstructure(def)
s := DestinationTypedSetting[T]{
key: key,
def: def,
convert: ConvertStructure[T](def),
description: description,
}
register(s)
return s
}
// NewDestinationTypedSettingWithConverter creates a setting with a custom converter function.
func NewDestinationTypedSettingWithConverter[T any](key Key, convert func(any) (T, error), def T, description string) DestinationTypedSetting[T] {
s := DestinationTypedSetting[T]{
key: key,
def: def,
convert: convert,
description: description,
}
register(s)
return s
}
// NewDestinationTypedSettingWithConstrainedDefault creates a setting with a compound default value.
func NewDestinationTypedSettingWithConstrainedDefault[T any](key Key, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) DestinationTypedConstrainedDefaultSetting[T] {
s := DestinationTypedConstrainedDefaultSetting[T]{
key: key,
cdef: cdef,
convert: convert,
description: description,
}
register(s)
return s
}
func (s DestinationTypedSetting[T]) Key() Key { return s.key }
func (s DestinationTypedSetting[T]) Precedence() Precedence { return PrecedenceDestination }
func (s DestinationTypedSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s DestinationTypedConstrainedDefaultSetting[T]) Key() Key { return s.key }
func (s DestinationTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceDestination }
func (s DestinationTypedConstrainedDefaultSetting[T]) Validate(v any) error {
_, err := s.convert(v)
return err
}
func (s DestinationTypedSetting[T]) WithDefault(v T) DestinationTypedSetting[T] {
newS := s
newS.def = v
return newS
}
type TypedPropertyFnWithDestinationFilter[T any] func(namespace string, destination string) T
func (s DestinationTypedSetting[T]) Get(c *Collection) TypedPropertyFnWithDestinationFilter[T] {
return func(namespace string, destination string) T {
prec := []Constraints{
{Namespace: namespace, Destination: destination},
{Destination: destination},
{Namespace: namespace},
{},
}
return matchAndConvert(
c,
s.key,
s.def,
s.convert,
prec,
)
}
}
func (s DestinationTypedConstrainedDefaultSetting[T]) Get(c *Collection) TypedPropertyFnWithDestinationFilter[T] {
return func(namespace string, destination string) T {
prec := []Constraints{
{Namespace: namespace, Destination: destination},
{Destination: destination},
{Namespace: namespace},
{},
}
return matchAndConvertWithConstrainedDefault(
c,
s.key,
s.cdef,
s.convert,
prec,
)
}
}
type TypedSubscribableWithDestinationFilter[T any] func(namespace string, destination string, callback func(T)) (v T, cancel func())
func (s DestinationTypedSetting[T]) Subscribe(c *Collection) TypedSubscribableWithDestinationFilter[T] {
return func(namespace string, destination string, callback func(T)) (T, func()) {
prec := []Constraints{
{Namespace: namespace, Destination: destination},
{Destination: destination},
{Namespace: namespace},
{},
}
return subscribe(c, s.key, s.def, s.convert, prec, callback)
}
}
func (s DestinationTypedSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdate(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func (s DestinationTypedConstrainedDefaultSetting[T]) Subscribe(c *Collection) TypedSubscribableWithDestinationFilter[T] {
return func(namespace string, destination string, callback func(T)) (T, func()) {
prec := []Constraints{
{Namespace: namespace, Destination: destination},
{Destination: destination},
{Namespace: namespace},
{},
}
return subscribeWithConstrainedDefault(c, s.key, s.cdef, s.convert, prec, callback)
}
}
func (s DestinationTypedConstrainedDefaultSetting[T]) dispatchUpdate(c *Collection, sub any, cvs []ConstrainedValue) {
dispatchUpdateWithConstrainedDefault(
c,
s.key,
s.convert,
sub.(*subscription[T]),
cvs,
)
}
func GetTypedPropertyFnFilteredByDestination[T any](value T) TypedPropertyFnWithDestinationFilter[T] {
return func(namespace string, destination string) T {
return value
}
}