feat: add persist flag to LifecycleRules

For #1083.
pull/24376/head
Marco Neumann 2021-04-12 14:30:32 +02:00
parent 9834c845db
commit ef7de0aa05
3 changed files with 14 additions and 0 deletions

View File

@ -199,6 +199,9 @@ pub struct LifecycleRules {
/// Allow dropping data that has not been persisted to object storage
pub drop_non_persisted: bool,
/// Persists chunks to object storage.
pub persist: bool,
/// Do not allow writing new data to this database
pub immutable: bool,
}
@ -228,6 +231,7 @@ impl From<LifecycleRules> for management::LifecycleRules {
.unwrap_or_default(),
sort_order: Some(config.sort_order.into()),
drop_non_persisted: config.drop_non_persisted,
persist: config.persist,
immutable: config.immutable,
}
}
@ -245,6 +249,7 @@ impl TryFrom<management::LifecycleRules> for LifecycleRules {
buffer_size_hard: (proto.buffer_size_hard as usize).try_into().ok(),
sort_order: proto.sort_order.optional("sort_order")?.unwrap_or_default(),
drop_non_persisted: proto.drop_non_persisted,
persist: proto.persist,
immutable: proto.immutable,
})
}
@ -1288,6 +1293,7 @@ mod tests {
buffer_size_hard: 232,
sort_order: None,
drop_non_persisted: true,
persist: true,
immutable: true,
};

View File

@ -151,6 +151,9 @@ message LifecycleRules {
// Allow dropping data that has not been persisted to object storage
bool drop_non_persisted = 7;
// Persists chunks to object storage.
bool persist = 9;
// Do not allow writing new data to this database
bool immutable = 8;
}

View File

@ -105,6 +105,10 @@ struct Create {
#[structopt(long)]
drop_non_persisted: bool,
/// Persists chunks to object storage.
#[structopt(long)]
persist: bool,
/// Do not allow writing new data to this database
#[structopt(long)]
immutable: bool,
@ -173,6 +177,7 @@ pub async fn command(url: String, config: Config) -> Result<()> {
buffer_size_hard: command.buffer_size_hard as _,
sort_order: None, // Server-side default
drop_non_persisted: command.drop_non_persisted,
persist: command.persist,
immutable: command.immutable,
}),