-
Notifications
You must be signed in to change notification settings - Fork 918
GODRIVER-3289 Add option to configure DEK cache lifetime. #1922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
32e7246
c7a6219
9add837
1eb7c89
573812e
c71e2c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ import ( | |
|
|
||
| var ( | ||
| supportedSchemaVersions = map[int]string{ | ||
| 1: "1.21", | ||
| 1: "1.22", | ||
| } | ||
| ) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ package options | |
| import ( | ||
| "crypto/tls" | ||
| "net/http" | ||
| "time" | ||
|
|
||
| "go.mongodb.org/mongo-driver/v2/internal/httputil" | ||
| ) | ||
|
|
@@ -40,6 +41,7 @@ type AutoEncryptionOptions struct { | |
| HTTPClient *http.Client | ||
| EncryptedFieldsMap map[string]interface{} | ||
| BypassQueryAnalysis *bool | ||
| KeyExpiration *time.Duration | ||
| } | ||
|
|
||
| // AutoEncryption creates a new AutoEncryptionOptions configured with default values. | ||
|
|
@@ -164,3 +166,11 @@ func (a *AutoEncryptionOptions) SetBypassQueryAnalysis(bypass bool) *AutoEncrypt | |
|
|
||
| return a | ||
| } | ||
|
|
||
| // SetKeyExpiration specifies duration for the key expiration. 0 or negative value means "never expire". | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are negative values interpreted by libmongocrypt as "never expire" or are we enforcing that behavior in the Go Driver? I can't find documentation on the negative case. The C and Rust implementations use uint64. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Negative values are handled in x/mongo/driver/mongocrypt/mongocrypt.go by passing 0 to libmongocrypt. I'm open to using uint64 to align the API with other drivers. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we should use |
||
| // The granularity is in milliseconds. Any sub-millisecond fraction will be rounded up. | ||
| func (a *AutoEncryptionOptions) SetKeyExpiration(expiration time.Duration) *AutoEncryptionOptions { | ||
| a.KeyExpiration = &expiration | ||
|
|
||
| return a | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Since we don't need dynamic formatting, suggest using errors.New