• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 0187fdd2-f4a4-4c9a-97b4-6604937bf7be

09 May 2023 12:23AM UTC coverage: 57.253% (-0.002%) from 57.255%
0187fdd2-f4a4-4c9a-97b4-6604937bf7be

Pull #5252

buildkite

David Porter
Merge branch 'master' into feature/zonal-partitioning
Pull Request #5252: Feature/zonal partitioning

1460 of 1460 new or added lines in 51 files covered. (100.0%)

86909 of 151799 relevant lines covered (57.25%)

2482.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/common/persistence/configStoreManager.go
1
// Copyright (c) 2017 Uber Technologies, Inc.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20

21
package persistence
22

23
import (
24
        "context"
25
        "time"
26

27
        "github.com/uber/cadence/common"
28
        "github.com/uber/cadence/common/log"
29
)
30

31
type (
32

33
        // configStoreManagerImpl implements ConfigStoreManager based on ConfigStore and PayloadSerializer
34
        configStoreManagerImpl struct {
35
                serializer  PayloadSerializer
36
                persistence ConfigStore
37
                logger      log.Logger
38
        }
39
)
40

41
var _ ConfigStoreManager = (*configStoreManagerImpl)(nil)
42

43
// NewConfigStoreManagerImpl returns new ConfigStoreManager
44
func NewConfigStoreManagerImpl(persistence ConfigStore, logger log.Logger) ConfigStoreManager {
55✔
45
        return &configStoreManagerImpl{
55✔
46
                serializer:  NewPayloadSerializer(),
55✔
47
                persistence: persistence,
55✔
48
                logger:      logger,
55✔
49
        }
55✔
50
}
55✔
51

52
func (m *configStoreManagerImpl) Close() {
×
53
        m.persistence.Close()
×
54
}
×
55

56
func (m *configStoreManagerImpl) FetchDynamicConfig(ctx context.Context, cfgType ConfigType) (*FetchDynamicConfigResponse, error) {
153✔
57
        values, err := m.persistence.FetchConfig(ctx, cfgType)
153✔
58
        if err != nil || values == nil {
306✔
59
                return nil, err
153✔
60
        }
153✔
61

62
        config, err := m.serializer.DeserializeDynamicConfigBlob(values.Values)
×
63
        if err != nil {
×
64
                return nil, err
×
65
        }
×
66

67
        return &FetchDynamicConfigResponse{Snapshot: &DynamicConfigSnapshot{
×
68
                Version: values.Version,
×
69
                Values:  config,
×
70
        }}, nil
×
71
}
72

73
func (m *configStoreManagerImpl) UpdateDynamicConfig(ctx context.Context, request *UpdateDynamicConfigRequest, cfgType ConfigType) error {
×
74
        blob, err := m.serializer.SerializeDynamicConfigBlob(request.Snapshot.Values, common.EncodingTypeThriftRW)
×
75
        if err != nil {
×
76
                return err
×
77
        }
×
78

79
        entry := &InternalConfigStoreEntry{
×
80
                RowType:   int(cfgType),
×
81
                Version:   request.Snapshot.Version,
×
82
                Timestamp: time.Now(),
×
83
                Values:    blob,
×
84
        }
×
85

×
86
        return m.persistence.UpdateConfig(ctx, entry)
×
87
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc