Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

rkt: gc command #302

Merged
merged 6 commits into from
Dec 24, 2014
Merged

rkt: gc command #302

merged 6 commits into from
Dec 24, 2014

Conversation

jonboulle
Copy link
Contributor

Follow on from #266

@jonboulle
Copy link
Contributor Author

/cc @vcaputo any thoughts on the interface changes?

jonboulle and others added 6 commits December 24, 2014 11:02
Add a simple package to facilitate placing an flock on directories. This
will be use to coordinate state between running containers and rkt
status/gc tools.
Container directories deemed inactive by exclusive lock acquisition are
atomically renamed to /var/lib/rkt/garbage, the directory's ctime gets
updated as part of the rename.

The /var/lib/rkt/garbage directory is then scanned for directories having a
ctime older than --grace-period (defaults to 30m).  Qualifying directories
are deleted under another exclusive lock.

All lock acquisitions are non-blocking with failures being ignored.

Functions like gc status will have the grace period window for retrieving
statuses from inactive containers in either the containers or garbage
dirs, and should access the status files under the protection of a shared
lock.

Examples:

 Container "a983198b-79e3-432e-ad31-f105e96aa003" has recently exited:
   $ bin/rkt gc
   Moving container "a983198b-79e3-432e-ad31-f105e96aa003" to garbage
   $

 Immediate subsequent gc finds nothing to do:
   $ bin/rkt gc
   $

 Immediate subsequent gc force-discard by setting grace period to 0:
   $ bin/rkt gc --grace-period=0
   Garbage collecting container "a983198b-79e3-432e-ad31-f105e96aa003"
   $
This moves to a very basic DirLock interface (which represents only an
active lock), and functions to create the respective lock types
(TryExclusiveLock, TrySharedLock, ...) instead of methods.
@jonboulle
Copy link
Contributor Author

I'm going to merge this, we can revisit the lock interface and atomic conversions as the need arises (it might fall out of the keystore work)

jonboulle added a commit that referenced this pull request Dec 24, 2014
@jonboulle jonboulle merged commit df21b50 into rkt:master Dec 24, 2014
@jonboulle jonboulle deleted the jon-gc branch December 24, 2014 19:03
@jonboulle jonboulle mentioned this pull request Dec 24, 2014
@vcaputo
Copy link
Contributor

vcaputo commented Dec 29, 2014

yay

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants