go.temporal.io/server/common/namespace/mutate.go

85 LOC · 46 covered · 39 uncovered · 10 ranges · 15129 concepts · 8 introducers · 7510 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 package namespace
2
3 import (
4 namespacepb "go.temporal.io/api/namespace/v1"
5 "google.golang.org/protobuf/types/known/durationpb"
6 )
7
8 type mutationFunc func(*Namespace)
9
10 > func (f mutationFunc) apply(ns *Namespace) { mutate.go ×1
11 > f(ns)
12 > }
13
14 // WithActiveCluster assigns the active cluster to a Namespace during a Clone
15 // operation.
16 > func WithActiveCluster(name string) Mutation { mutate.go ×1
17 > return mutationFunc(
18 > func(ns *Namespace) {
19 > ns.replicationResolver.SetActiveCluster(name)
20 > })
21 }
22
23 // WithBadBinary adds a bad binary checksum to a Namespace during a Clone
24 // operation.
25 > func WithBadBinary(chksum string) Mutation { mutable_state_impl.go ×5
26 > return mutationFunc(
27 > func(ns *Namespace) {
28 > if ns.config.BadBinaries.Binaries == nil {
29 ns.config.BadBinaries.Binaries = make(map[string]*namespacepb.BadBinaryInfo)
30 }
31 > ns.config.BadBinaries.Binaries[chksum] = mutable_state_impl.go ×5
32 > &namespacepb.BadBinaryInfo{}
33 })
34 }
35
36 // WithID assigns the ID to a Namespace during a Clone operation.
37 > func WithID(id string) Mutation { mutable_state_impl.go ×5
38 > return mutationFunc(
39 > func(ns *Namespace) {
40 > ns.info.Id = id
41 > })
42 }
43
44 // WithGlobalFlag sets whether or not this Namespace is global.
45 > func WithGlobalFlag(b bool) Mutation { mutate.go ×1
46 > return mutationFunc(
47 > func(ns *Namespace) {
48 > ns.replicationResolver.SetGlobalFlag(b)
49 > })
50 }
51
52 // WithNotificationVersion assigns a notification version to the Namespace.
53 > func WithNotificationVersion(v int64) Mutation { registry.go ×21
54 > return mutationFunc(
55 > func(ns *Namespace) {
56 > ns.notificationVersion = v
57 > })
58 }
59
60 // WithRetention assigns the retention duration to a Namespace during a Clone
61 // operation.
62 > func WithRetention(dur *durationpb.Duration) Mutation { mutate.go ×1
63 > return mutationFunc(
64 > func(ns *Namespace) {
65 > ns.config.Retention = dur
66 > })
67 }
68
69 // WithData adds a key-value pair to a Namespace during a Clone operation.
70 > func WithData(key, value string) Mutation { namespace.go ×2
71 > return mutationFunc(
72 > func(ns *Namespace) {
73 > if ns.info.Data == nil {
74 > ns.info.Data = make(map[string]string)
75 > }
76 > ns.info.Data[key] = value
77 })
78 }
79
80 > func WithPretendLocalNamespace(localClusterName string) Mutation { mutate.go ×1
81 > return mutationFunc(
82 > func(ns *Namespace) {
83 > ns.replicationResolver.PretendLocalNamespace(localClusterName)
84 > })
85 }