Expand description
Defines the read resume policies for Google Cloud Storage.
Even if a read request starts successfully, it may be fail after it starts. For example, the read may be interrupted or become too slow and “stall”. The client library can automatically recover from such errors. The application may want to control what errors are treated as recoverable, and how many failures are tolerated before abandoning the read request.
The traits and types defined in this module allow for such customization.
§Example
let policy = Recommended.with_attempt_limit(3);
assert!(matches!(policy.on_error(&ResumeQuery::new(0), io_error()), ResumeResult::Continue(_)));
assert!(matches!(policy.on_error(&ResumeQuery::new(1), io_error()), ResumeResult::Continue(_)));
assert!(matches!(policy.on_error(&ResumeQuery::new(2), io_error()), ResumeResult::Continue(_)));
assert!(matches!(policy.on_error(&ResumeQuery::new(3), io_error()), ResumeResult::Exhausted(_)));
use google_cloud_gax::error::{Error, rpc::Code, rpc::Status};
fn io_error() -> Error {
// ... details omitted ...
}Structs§
- Always
Resume - A resume policy that resumes regardless of the error type.
- Limited
Attempt Count - Decorates a resume policy to stop resuming after a certain number of attempts.
- Never
Resume - A resume policy that never resumes, regardless of the error type.
- Recommended
- The recommended policy when reading objects from Cloud Storage.
- Resume
Query - The inputs into a resume policy query.
Enums§
- Resume
Result - The result of a loop control decision.
Traits§
- Read
Resume Policy - Defines the interface to resume policies.
- Read
Resume Policy Ext - Extension trait for ReadResumePolicy.