(ctx context.Context, find *FindInstanceSetting)
| 85 | } |
| 86 | |
| 87 | func (s *Store) GetInstanceSetting(ctx context.Context, find *FindInstanceSetting) (*storepb.InstanceSetting, error) { |
| 88 | if cache, ok := s.instanceSettingCache.Get(ctx, find.Name); ok { |
| 89 | instanceSetting, ok := cache.(*storepb.InstanceSetting) |
| 90 | if ok { |
| 91 | return instanceSetting, nil |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | list, err := s.ListInstanceSettings(ctx, find) |
| 96 | if err != nil { |
| 97 | return nil, err |
| 98 | } |
| 99 | if len(list) == 0 { |
| 100 | return nil, nil |
| 101 | } |
| 102 | if len(list) > 1 { |
| 103 | return nil, errors.Errorf("found multiple instance settings with key %s", find.Name) |
| 104 | } |
| 105 | return list[0], nil |
| 106 | } |
| 107 | |
| 108 | func (s *Store) GetInstanceBasicSetting(ctx context.Context) (*storepb.InstanceBasicSetting, error) { |
| 109 | instanceSetting, err := s.GetInstanceSetting(ctx, &FindInstanceSetting{ |
no test coverage detected