LeaseRepository

io.github.jchapuis.leases4s.LeaseRepository
See theLeaseRepository companion object
trait LeaseRepository[F[_]]

Defines a distributed lease repository, with the ability to acquire leases with automatic renewal, check for other existing leases and watch for related events.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def acquire(id: LeaseID, holderID: HolderID, annotations: List[Annotation])(implicit parameters: LeaseParameters): Resource[F, HeldLease[F]]

Returns a resource representing acquisition of the lease and release upon finalization. The resource acquire action is semantically blocking until the lease is acquired. Once acquired, the lease is automatically renewed by a fiber supervised by the resource, according to passed parameters.

Returns a resource representing acquisition of the lease and release upon finalization. The resource acquire action is semantically blocking until the lease is acquired. Once acquired, the lease is automatically renewed by a fiber supervised by the resource, according to passed parameters.

Value parameters

annotations

optional annotations for this lease

holderID

holder ID

id

lease ID

Attributes

Returns

resource representing the held lease

def get(id: LeaseID): F[Option[Lease[F]]]

Returns a lease with the corresponding ID, if any

Returns a lease with the corresponding ID, if any

Value parameters

id

lease ID

Attributes

Returns

handle on the lease, allowing to check for expiry

def labels: List[Label]

Labels of leases tracked by this repository (labels act as a filter)

Labels of leases tracked by this repository (labels act as a filter)

Attributes

def list: F[List[Lease[F]]]

Lists all leases

Lists all leases

Attributes

Returns

list of handles on leases (allowing e.g. to check for expiry)

def watcher: Stream[F, LeaseEvent[F]]

Returns a stream indicating changes in the repository

Returns a stream indicating changes in the repository

Attributes

Returns

stream of lease events