IPWorks Cloud 2020 C++ Builder Edition

Questions / Feedback?

Lease Method

Creates or manages a lease on a blob or container.

Syntax

void __fastcall Lease(String Blob, int LeaseAction, String NewLeaseId, int Duration);

Remarks

This method creates or manages a lease on the container currently selected by Container (if Blob is empty), or on the specified Blob in that container.

LeaseAction specifies what action should occur. Possible values, and their effects, are:

  • Acquire (0): Requests a new lease.
    • If no active lease currently exists, a new one is created and LeaseId is populated with the new lease's Id. If a non-empty value is passed for NewLeaseId, it is used; otherwise the server generates an Id.
    • If an active lease currently exists, its Id must be passed for NewLeaseId.
    • In either case, Duration is used to specify the length of time that the lease is valid for (see below).
  • Renew (1): Renews the lease specified by LeaseId.
    • Leases can only be renewed while active or expired (and in the latter case, only if a different lease has not been acquired in the meantime).
    • Renewing an active lease will reset its expiration clock.
  • Change (2): Changes the Id of the active lease specified by LeaseId to the one specified by NewLeaseId.
    • If this action is successful, the component will automatically set LeaseId to the value passed for NewLeaseId.
  • Release (3): Releases the lease specified by LeaseId.
    • If this action is successful, the component will automatically clear LeaseId.
  • Break (4): Breaks the current lease, either immediately or after a certain period of time (the "break period") according to the value passed for Duration.
    • The lease's Id is not required to break the lease.
    • If Duration is -1, fixed-length leases are broken after their remaining time elapses, and infinite-length leases are broken immediately.
    • Otherwise, Duration specified how many seconds (see below) the lease should continue before being broken. (For fixed-length leases, the lesser of this value and the lease's remaining time is used.)
    • If this action is successful, the LeaseBreakPeriod configuration setting is populated to indicate how long the lease's break period is.

If NewLeaseId is non-empty, if must be a GUID string formatted in one of the styles described by Microsoft's .NET Guid(string) constructor documentation. For example: dddddddd-dddd-dddd-dddd-dddddddddddd, where each d is a single case-insensitive hex digit.

The value passed for Duration is only used in the cases listed below; it is ignored otherwise.

  • When LeaseAction is Acquire (0): Valid values for Duration are -1 (infinite), or a number of seconds between 15 and 60 (inclusive).
  • When LeaseAction is Break (4): Valid values for Duration are -1 (unspecified), or a number of seconds between 0 and 60 (inclusive). 0 indicates the lease should be broken immediately, regardless of whether it is fixed- or infinite-length.

For more information about how leases work, refer to Azure's Lease Blob and Lease Container API documentation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 C++ Builder Edition - Version 20.0 [Build 8265]