A leasing function to perform a lease for a given amount of time. This is a client defined operation. It should accept a duration in seconds and return a channel that returns true or false whether the lease was acquired for the given time or not.
A lease releasing function. This is a client defined operation that should release a previously acquired lease. It could be called even if no lease was reserved, to ensure release.
Optional
options: Partial<{ leaseTimeoutSecs: Represents the lease time in seconds. - leaseMarginSecs: Represents a margin time in seconds to subtract from leaseTimeoutSecs to consider that the client will not issue a ping in time. - logToConsole: Indicates whether the process steps should be logged to the console.
Generated using TypeDoc
Starts a leasing process that works like so: - A leaseFn is used to borrow a lease for a given duration in seconds. Upon failure to get the lease the process stops. - Every timeout seconds, a ping is expected from outside the leasing process, through the channel pingCh. If at least one ping arrives by that time, the lease is tried to be renewed, otherwise the lease is released and the process stops.