Release the lease so a standby replica can acquire immediately without waiting for TTL expiry.
(&self, guard: LeaseGuard)
| 199 | /// Release the lease so a standby replica can acquire immediately |
| 200 | /// without waiting for TTL expiry. |
| 201 | pub async fn release(&self, guard: LeaseGuard) -> Result<(), LeaseError> { |
| 202 | match self |
| 203 | .store |
| 204 | .delete_if( |
| 205 | LEASE_OBJECT_TYPE, |
| 206 | LEASE_SINGLETON_ID, |
| 207 | guard.resource_version, |
| 208 | ) |
| 209 | .await |
| 210 | { |
| 211 | Ok(_) => Ok(()), |
| 212 | Err(PersistenceError::Conflict { .. }) => Err(LeaseError::Conflict), |
| 213 | Err(e) => Err(LeaseError::Store(e)), |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /// Read the current lease record, if any. |
| 218 | pub async fn read(&self) -> Result<Option<LeaseRecord>, LeaseError> { |
no test coverage detected