Expand description
Asynchronous task tracking and management
This module provides functionality for tracking long-running operations in Redis Cloud. Many API operations are asynchronous and return a task ID that can be used to monitor progress and completion status.
§Overview
Redis Cloud uses tasks for operations that may take time to complete, such as:
- Creating or deleting subscriptions
- Database creation, updates, and deletion
- Backup and restore operations
- Import/export operations
- Network configuration changes
§Task Lifecycle
- Initiated: Task is created and queued
- Processing: Task is being executed
- Completed: Task finished successfully
- Failed: Task encountered an error
§Key Features
- Task Status: Check current status of any task
- Progress Tracking: Monitor completion percentage for long operations
- Result Retrieval: Get operation results once completed
- Error Information: Access detailed error messages for failed tasks
- Task History: Query historical task information
§Example Usage
use redis_cloud::{CloudClient, TaskHandler};
let client = CloudClient::builder()
.api_key("your-api-key")
.api_secret("your-api-secret")
.build()?;
let handler = TaskHandler::new(client);
// Get task status
let task = handler.get_task_by_id("task-123".to_string()).await?;
// Check if task is complete
if task.status == Some("completed".to_string()) {
println!("Task completed successfully");
if let Some(response) = task.response {
println!("Result: {:?}", response);
}
}
Structs§
- Processor
Response - ProcessorResponse
- Task
State Update - TaskStateUpdate
- Tasks
Handler - Handler for asynchronous task operations