Skip to content

Commit

Permalink
api: add encryption configuration to file cache
Browse files Browse the repository at this point in the history
Add encryption configuration to file cache, so we can encrypt data
written to the local cache file.

Signed-off-by: Jiang Liu <[email protected]>
  • Loading branch information
jiangliu committed Apr 14, 2023
1 parent 266cde0 commit 21870b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,15 @@ pub struct FileCacheConfig {
/// Deprecated: disable index mapping, keep it as false when possible.
#[serde(default)]
pub disable_indexed_map: bool,
/// Enable encryption data written to the cache file.
#[serde(default)]
pub enable_encryption: bool,
/// Enable convergent encryption for chunk deduplication.
#[serde(default)]
pub enable_convergent_encryption: bool,
/// Key for data encryption, a heximal representation of [u8; 32].
#[serde(default)]
pub encryption_key: String,
}

impl FileCacheConfig {
Expand Down
3 changes: 3 additions & 0 deletions docs/samples/blob_cache_entry_configuration_v2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ validate = true

[cache.filecache]
work_dir = "."
enable_encryption = true
enable_convergent_encryption = true
encryption_key = "fc4a7db5614afc2f400e9478bebed1aefdbc9d7cd03210b84f144683a7a6fd1a"

[cache.fscache]
work_dir = "."
Expand Down
6 changes: 6 additions & 0 deletions docs/samples/configuration_v2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ type = "filecache"
compressed = true
# Whether to validate data read from the cache.
validate = true
# Enable encryption data written to the cache file.
enable_encryption = true
# Enable convergent encryption for chunk deduplication.
enable_convergent_encryption = true
# Key for data encryption, a heximal representation of [u8; 32].
encryption_key = "fc4a7db5614afc2f400e9478bebed1aefdbc9d7cd03210b84f144683a7a6fd1a"

[cache.filecache]
work_dir = "."
Expand Down

0 comments on commit 21870b6

Please sign in to comment.