PersistentLeaseManager

A marker interface for LeaseManager implementations that use persistent storage to manage leases across service restarts and failures.

Persistent lease managers store lease state in durable storage (such as databases), ensuring that leases survive process restarts and can be coordinated across multiple instances even in the presence of network partitions or instance failures. This is useful for scenarios requiring strong consistency guarantees and lease durability.

Implementations should ensure that:

  • Lease state persists across service restarts

  • Multiple instances can safely compete for leases using the storage backend

  • Stale leases are properly expired based on storage-level timestamps

  • The system handles storage failures gracefully

Functions

Link copied to clipboard

Attempts to acquire an AutoCloseableLease.

Attempts to acquire an AutoCloseableLease with options.

Link copied to clipboard
open fun releaseAll()
Link copied to clipboard
abstract fun requestLease(name: String): Lease

Registers interest in the lease with the given name. Service instances should register their interest in leases as soon as they know about them; this gives the process an opportunity to notify the underlying cluster system that it is interested in the lease, or to setup other background tasks to acquire the lease if necessary. Note that registering interest in a lease doesn't necessarily mean that this service instance will attempt to acquire the lease; many clustering systems will only try to acquire leases for resources that they think they should own based on some consistent hashing system