Add leases manager interface
Add leases manager to the leases package and use the interface on the client and service. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -29,8 +29,8 @@ func WithLease(ctx context.Context, lid string) context.Context {
|
||||
return withGRPCLeaseHeader(ctx, lid)
|
||||
}
|
||||
|
||||
// Lease returns the lease from the context.
|
||||
func Lease(ctx context.Context) (string, bool) {
|
||||
// FromContext returns the lease from the context.
|
||||
func FromContext(ctx context.Context) (string, bool) {
|
||||
lid, ok := ctx.Value(leaseKey{}).(string)
|
||||
if !ok {
|
||||
return fromGRPCHeader(ctx)
|
||||
|
||||
Reference in New Issue
Block a user