go.temporal.io/server@v1.23.0/common/dynamicconfig/static_properties.go (about) 1 // The MIT License 2 // 3 // Copyright (c) 2020 Temporal Technologies Inc. All rights reserved. 4 // 5 // Copyright (c) 2020 Uber Technologies, Inc. 6 // 7 // Permission is hereby granted, free of charge, to any person obtaining a copy 8 // of this software and associated documentation files (the "Software"), to deal 9 // in the Software without restriction, including without limitation the rights 10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 // copies of the Software, and to permit persons to whom the Software is 12 // furnished to do so, subject to the following conditions: 13 // 14 // The above copyright notice and this permission notice shall be included in 15 // all copies or substantial portions of the Software. 16 // 17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 // THE SOFTWARE. 24 25 package dynamicconfig 26 27 import ( 28 "time" 29 30 enumspb "go.temporal.io/api/enums/v1" 31 ) 32 33 // These mock functions are for tests to use config properties that are dynamic 34 35 // GetIntPropertyFn returns value as IntPropertyFn 36 func GetIntPropertyFn(value int) func() int { 37 return func() int { return value } 38 } 39 40 // GetIntPropertyFilteredByNamespace returns values as IntPropertyFnWithNamespaceFilters 41 func GetIntPropertyFilteredByNamespace(value int) func(namespace string) int { 42 return func(namespace string) int { return value } 43 } 44 45 // GetIntPropertyFilteredByTaskQueueInfo returns value as IntPropertyFnWithTaskQueueInfoFilters 46 func GetIntPropertyFilteredByTaskQueueInfo(value int) func(namespace string, taskQueue string, taskType enumspb.TaskQueueType) int { 47 return func(namespace string, taskQueue string, taskType enumspb.TaskQueueType) int { return value } 48 } 49 50 // GetFloatPropertyFn returns value as FloatPropertyFn 51 func GetFloatPropertyFn(value float64) func() float64 { 52 return func() float64 { return value } 53 } 54 55 // GetBoolPropertyFn returns value as BoolPropertyFn 56 func GetBoolPropertyFn(value bool) func() bool { 57 return func() bool { return value } 58 } 59 60 // GetBoolPropertyFnFilteredByNamespace returns value as BoolPropertyFnWithNamespaceFilters 61 func GetBoolPropertyFnFilteredByNamespace(value bool) func(namespace string) bool { 62 return func(namespace string) bool { return value } 63 } 64 65 // GetBoolPropertyFnFilteredByTaskQueueInfo returns value as BoolPropertyFnWithTaskQueueInfoFilters 66 func GetBoolPropertyFnFilteredByTaskQueueInfo(value bool) func(namespace string, taskQueue string, taskType enumspb.TaskQueueType) bool { 67 return func(namespace string, taskQueue string, taskType enumspb.TaskQueueType) bool { return value } 68 } 69 70 // GetDurationPropertyFnFilteredByNamespace returns value as DurationPropertyFnFilteredByNamespace 71 func GetDurationPropertyFnFilteredByNamespace(value time.Duration) func(namespace string) time.Duration { 72 return func(namespace string) time.Duration { return value } 73 } 74 75 // GetDurationPropertyFn returns value as DurationPropertyFn 76 func GetDurationPropertyFn(value time.Duration) func() time.Duration { 77 return func() time.Duration { return value } 78 } 79 80 // GetDurationPropertyFnFilteredByTaskQueueInfo returns value as DurationPropertyFnWithTaskQueueInfoFilters 81 func GetDurationPropertyFnFilteredByTaskQueueInfo(value time.Duration) func(namespace string, taskQueue string, taskType enumspb.TaskQueueType) time.Duration { 82 return func(namespace string, taskQueue string, taskType enumspb.TaskQueueType) time.Duration { return value } 83 } 84 85 // GetStringPropertyFn returns value as StringPropertyFn 86 func GetStringPropertyFn(value string) func() string { 87 return func() string { return value } 88 } 89 90 // GetMapPropertyFn returns value as MapPropertyFn 91 func GetMapPropertyFn(value map[string]interface{}) func() map[string]interface{} { 92 return func() map[string]interface{} { return value } 93 } 94 95 // GetMapPropertyFnWithNamespaceFilter returns value as MapPropertyFn 96 func GetMapPropertyFnWithNamespaceFilter(value map[string]interface{}) func(namespace string) map[string]interface{} { 97 return func(namespace string) map[string]interface{} { return value } 98 }