Add lease expiration to garbage collection

Allow setting an expiration label to have the garbage
collector remove an item after the specified time.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2018-07-09 13:28:19 -07:00
parent 02579c8c3f
commit c77c89b3d1
4 changed files with 100 additions and 3 deletions

17
leases/lease.go Normal file
View File

@@ -0,0 +1,17 @@
package leases
import "time"
type LeaseOpt func(*Lease)
type LeaseManager interface {
Create(...LeaseOpt) (Lease, error)
Delete(Lease) error
List(...string) ([]Lease, error)
}
type Lease struct {
ID string
CreatedAt time.Time
Labels map[string]string
}