MCPcopy Create free account
hub / github.com/apache/arrow / Break

Method Break

cpp/src/arrow/filesystem/azurefs.cc:1631–1659  ·  view source on GitHub ↗

\brief Break the lease. The lease will stay in the "Breaking" state for break_period seconds or less if the lease is expiring before that. https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container#outcomes-of-use-attempts-on-containers-by-lease-state https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob#outcomes-of-use-attempts-on-blobs-by-lease-state

Source from the content-addressed store, hash-verified

1629 /// https://learn.microsoft.com/en-us/rest/api/storageservices/lease-container#outcomes-of-use-attempts-on-containers-by-lease-state
1630 /// https://learn.microsoft.com/en-us/rest/api/storageservices/lease-blob#outcomes-of-use-attempts-on-blobs-by-lease-state
1631 Status Break(Azure::Nullable<std::chrono::seconds> break_period = {}) {
1632 auto remaining_time_ms = [this]() {
1633 const auto remaining_time = break_or_expires_at_ - SteadyClock::now();
1634 return std::chrono::duration_cast<std::chrono::milliseconds>(remaining_time);
1635 };
1636#ifndef NDEBUG
1637 if (break_period.HasValue() && !StillValidFor(*break_period)) {
1638 ARROW_LOG(WARNING)
1639 << "Azure Storage: requested break_period ("
1640 << break_period.ValueOr(std::chrono::seconds{0}).count()
1641 << "s) is too long or lease duration is too short for all the operations "
1642 "performed so far (lease expires in "
1643 << remaining_time_ms().count() << "ms)";
1644 }
1645#endif
1646 Blobs::BreakLeaseOptions options;
1647 options.BreakPeriod = break_period;
1648 try {
1649 lease_client_->Break(options);
1650 break_or_expires_at_ =
1651 std::min(break_or_expires_at_,
1652 SteadyClock::now() + break_period.ValueOr(std::chrono::seconds{0}));
1653 } catch (const Core::RequestFailedException& exception) {
1654 return ExceptionToStatus(exception, "Failed to break the ",
1655 lease_client_->GetLeaseId(), " lease expiring in ",
1656 remaining_time_ms().count(), "ms");
1657 }
1658 return Status::OK();
1659 }
1660
1661 /// \brief Break the lease before deleting or renaming the resource via the
1662 /// DataLakeFileSystemClient API.

Callers

nothing calls this directly

Calls 5

ExceptionToStatusFunction · 0.85
ValueOrMethod · 0.80
OKFunction · 0.50
HasValueMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected