Skip to content

Commit 6928e8d

Browse files
committed
fixing lint issues and amending comments
1 parent 3edba1d commit 6928e8d

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

lib/auth/recordingencryption/manager.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type KeyStore interface {
4646
GetDecrypter(ctx context.Context, keyPair *types.EncryptionKeyPair) (crypto.Decrypter, error)
4747
}
4848

49-
// A Cache fetches a cached *recordingencryptionv1.RecordingEncryption
49+
// A Cache fetches a cached [*recordingencryptionv1.RecordingEncryption]
5050
type Cache interface {
5151
GetRecordingEncryption(context.Context) (*recordingencryptionv1.RecordingEncryption, error)
5252
}
@@ -61,26 +61,23 @@ type ManagerConfig struct {
6161
LockConfig backend.RunWhileLockedConfig
6262
}
6363

64-
// NewManager returns a new Manager using the given ManagerConfig.
64+
// NewManager returns a new Manager using the given [ManagerConfig].
6565
func NewManager(cfg ManagerConfig) (*Manager, error) {
66-
6766
switch {
6867
case cfg.Backend == nil:
6968
return nil, trace.BadParameter("backend is required")
7069
case cfg.ClusterConfig == nil:
7170
return nil, trace.BadParameter("cluster config is required")
7271
case cfg.KeyStore == nil:
7372
return nil, trace.BadParameter("key store is required")
73+
case cfg.Cache == nil:
74+
return nil, trace.BadParameter("cache is required")
7475
}
7576

7677
if cfg.Logger == nil {
7778
cfg.Logger = slog.With(teleport.ComponentKey, "recording-encryption-manager")
7879
}
7980

80-
if cfg.Cache == nil {
81-
cfg.Cache = cfg.Backend
82-
}
83-
8481
return &Manager{
8582
RecordingEncryption: cfg.Backend,
8683
ClusterConfigurationInternal: cfg.ClusterConfig,
@@ -177,7 +174,7 @@ func (m *Manager) UpsertSessionRecordingConfig(ctx context.Context, cfg types.Se
177174
return sessionRecordingConfig, trace.Wrap(err)
178175
}
179176

180-
// SetCache overwrites the configured Cache implementation
177+
// SetCache overwrites the configured Cache implementation. It should only be called if the `Manager` is not in use.
181178
func (m *Manager) SetCache(cache Cache) {
182179
m.cache = cache
183180
}

lib/cache/recording_encryption.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// You should have received a copy of the GNU Affero General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
//nolint:unused // Because the executors generate a large amount of false positives.
1817
package cache
1918

2019
import (
@@ -65,10 +64,6 @@ func newRecordingEncryptionCollection(upstream services.RecordingEncryption, w t
6564
}, nil
6665
}
6766

68-
type recordingEncryptionCacheKey struct {
69-
kind string
70-
}
71-
7267
// GetRecordingEncryption returns the cached RecordingEncryption for the cluster
7368
func (c *Cache) GetRecordingEncryption(ctx context.Context) (*recordingencryptionv1.RecordingEncryption, error) {
7469
ctx, span := c.Tracer.Start(ctx, "cache/GetRecordingEncryption")

0 commit comments

Comments
 (0)