Package me.ahoo.cosid.proxy.api
Interface MachineLeaseApi
- All Known Subinterfaces:
MachineLeaseClient
@HttpExchange("machines/v2")
public interface MachineLeaseApi
Machine id leases, version 2: the
MachineLeaseStore primitives of the server's backend, passed through.
Clients run the allocation algorithm themselves (MachineLeaseManager) on a ProxyMachineLeaseStore.
Every now and expiredBefore must come from serverTime(), the backend store's clock.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionclaim(String namespace, String kind, ClaimRequest request) booleanrelease(String namespace, ReleaseRequest request) Release a lease.renew(String namespace, RenewRequest request) longThe backend store's clock, in milliseconds.
-
Field Details
-
SELF
The claim kinds, as path segments.- See Also:
-
RELEASED
- See Also:
-
NEW
- See Also:
-
EXPIRED
- See Also:
-
-
Method Details
-
serverTime
@GetExchange("time") long serverTime()The backend store's clock, in milliseconds. -
claim
@PostExchange("{namespace}/claims/{kind}") LeaseResponse claim(@PathVariable String namespace, @PathVariable String kind, @RequestBody ClaimRequest request) -
renew
@PostExchange("{namespace}/renewals") LeaseResponse renew(@PathVariable String namespace, @RequestBody RenewRequest request) -
release
@PostExchange("{namespace}/releases") boolean release(@PathVariable String namespace, @RequestBody ReleaseRequest request) Release a lease.- Returns:
falseif the lease was taken over or changed since
-