CreateSnapshot()
Creates a snapshot of a collection.
pub async fn create_snapshot(&self, request: CreateSnapshotRequest) -> Result<()>
compaction_protection_seconds protects the referenced segments from compaction for the given duration; 0 disables the protection.
Request Syntax
let request = CreateSnapshotRequest::builder()
.collection_name("books")
.snapshot_name("snapshot_1")
.build()?;
REQUEST FIELDS:
database_name: Option<String>Name of the target database; uses the default database when empty.
collection_name: StringName of the collection to snapshot. Required.
snapshot_name: StringName of the snapshot to create. Required.
description: StringDescription of the snapshot.
compaction_protection_seconds: i64Number of seconds the referenced segments are protected from compaction;
0disables the protection. Must not be negative.
RETURN TYPE:
Result<()>
RETURNS:
Returns Ok(()) on success; returns an Error on failure.
Example
let request = CreateSnapshotRequest::builder()
.collection_name("books")
.snapshot_name("snapshot_1")
.compaction_protection_seconds(3600)
.build()?;
client.create_snapshot(request).await?;