16 Commits

Author SHA1 Message Date
Jonathan Boulle 9685f37575 *: adjust copyright header
Inspired by a similar change in the Kubernetes project [1], this changes
the copyright header to the more generic "The rkt Authors" rather than
"CoreOS, Inc.", which is only sometimes correct.

https://github.com/GoogleCloudPlatform/kubernetes/commit/6b3a6e6b983f967c88d14d26542ec6e30c49ebd3
2015-05-03 14:29:15 -07:00
Simone Gotti 6530acf8e0 lock: add missing closes in keylock.
* the keylock FileLock wasn't closed on error in createAndLock
* fd for changed file detection wasn't closed.
2015-04-15 12:04:45 +02:00
Simone Gotti c7e19e85f3 lock: add lock functions to lock by specific keys.
This adds a KeyLock struct and related functions trying to keep the same
semantic of DirLock.

KeyLock is a lock for a specific key. The lock file is created inside a
directory using the key name.
This is useful when multiple processes want to take a lock but cannot use
FileLock as they don't have a well defined file on the filesystem.

For example it's needed for image file locking and in future for download locking
2015-03-26 14:09:10 +01:00
Simone Gotti deea994424 lock: convert DirLock to handle also locks on regular files.
This patch renames DirLock to FileLock (where a file can be a regular file or a
directory), adds a new LockType type to specify if the lock must be on a
directory or on a regular file and checks if the file is valid for the
requested type.
2015-03-26 14:09:10 +01:00
Eugene Yakubovich 0b935f467f net: set FD_CLOEXEC on RktLock prior to fork/exec
When launching metadata service and net plugins,
set the close-on-exec flag so the child processes
don't end up holding the lock.
2015-03-19 17:14:31 -07:00
Jonathan Boulle 6d58c1fd17 *: add missing godocs and copyright headers
Also moves pkg/util/aci.go -> pkg/aci/aci.go for simplicity and
consistency with the other pkgs.
2015-01-24 19:03:56 -08:00
Vito Caputo 6cc9661f2d pkg/lock: add DirLock.Unlock()
In creating a more general interface to the container dirs a method for
unlocking a DirLock without closing it became necessary.

This should have been added when lock.NewLock() became public.
2015-01-12 17:12:27 -08:00
Vito Caputo d98608c7e5 pkg/lock: add errors for ENOENT and EACCES for new locks 2015-01-07 15:04:35 -08:00
Vito Caputo 85fab753da Merge pull request #309 from vcaputo/dirlock
pkg/lock: refactor DirLock to facilitate discrete opens
2014-12-30 10:57:54 -08:00
Vito Caputo 3c146d364a pkg/lock: refactor DirLock to facilitate discrete opens
This also restores atomic lock conversions

 * Discard DirLock interface
 * Convert private lock struct into public DirLock
 * Convert private newLock function to public NewLock
 * Introduce receiver-based analogs of all acquisition functions
 * Convert existing open+acquire functions to use the public receiver-based
   acquistion functions.
2014-12-30 10:45:13 -08:00
Jonathan Boulle 6dece1122d *: add license header to all source files
h/t @johndeng for raising this in #305
2014-12-29 17:34:05 -08:00
gprggr 932557f027 Update dir_test.go 2014-12-27 23:24:07 +01:00
Jonathan Boulle 0bbeeaae92 pkg/lock: add DirLock tests 2014-12-24 11:02:26 -08:00
Jonathan Boulle 3539ae82d0 pkg/lock: simplify DirLock interface
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.
2014-12-24 11:02:11 -08:00
Vito Caputo 51f496302c pkg/lock: cleanups, blocking vs. nonblocking calls, FD extraction 2014-12-24 11:02:11 -08:00
Jonathan Boulle 6632bc8050 pkg: add prototype flocking package
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.
2014-12-24 11:02:11 -08:00