Commit Graph

90 Commits

Author SHA1 Message Date
c178af9458 Use int64 instead of int
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
Upstream-commit: 62bfef59f7ae6f9128bfc3e7ef2e6ed5e4441d2e
Component: engine
2014-05-11 06:23:53 -07:00
b701571f37 beam/data: Message.GetOne() returns the last value set at a key
This is a convenience for callers which are only interested in one value
per key. Similar to how HTTP headers allow multiple keys per value, but
are often used to store and retrieve only one value.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 2af030ab57d1d84ac9a1d22552dc9d83b16951c4
Component: engine
2014-05-09 17:01:27 -07:00
c3352a3b6c Fix stdin handling in engine.Sender and engine.Receiver
This introduces a superficial change to the Beam API:

* `beam.SendPipe` is renamed to the more accurate `beam.SendRPipe`
* `beam.SendWPipe` is introduced as a mirror to `SendRPipe`

There is no other change in the beam API.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 0aeff69e5900a15e3872494ac0009600f6c1c372
Component: engine
2014-05-09 15:39:55 -07:00
a4471696ab beam: Add simple framing system for UnixConn
This is needed for Send/Recieve to correctly handle borders between
the messages.

The framing uses a single 32bit uint32 length for each frame, of which
the high bit is used to indicate whether the message contains a file
descriptor or not. This is enough to separate out each message sent
and to decide to which message each file descriptors belongs, even
though multiple Sends may be coalesced into a single read, and/or one
Send can be split into multiple writes.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 24f9187a0467ca66c30e26c3d9e3ee58daeb720f
Component: engine
2014-05-01 11:06:01 -07:00
bde45636d6 Fix various MAINTAINERS format inconsistencies
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: defecac2799ca0c72532b7e6ed6005cc54ee2e25
Component: engine
2014-04-30 11:22:11 -06:00
23a6b19cdc beam: Add more tests to unix_test.go
These are failing, and indicate things that need to be fixed.  The
primarily problem is the lack of framing between beam messages.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
[solomon@docker.com: rebased on master]
Signed-off-by: Solomon Hykes <solomon@docker.com>
Upstream-commit: e802b69146ac7a008d943a3a289fba56150b4f81
Component: engine
2014-04-30 02:10:09 -07:00
fba1cacd59 Fix Go formatting in beam and dockerscript
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: bf51f36d8f07d0c53f7b7b3c21ae372f7ca3be33
Component: engine
2014-04-22 16:16:29 -07:00
bed3b0cf53 beam/examples/beamsh: 'chdir' changes the current directory
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: bc6303f15d9ac4f2f281bbf4e4d76f7517e10117
Component: engine
2014-04-22 15:50:24 -07:00
0d5fc83e93 beam/examples/beamsh: 'exec' can communicate with its child via beam.
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 6ce4d2c8424e029237b4ad0c615a4ff6204a1064
Component: engine
2014-04-22 15:50:24 -07:00
81a0f67a86 beam/examples/beamsh: use beam.Router to simplify 'multiprint' and fix job passthrough
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 271ba1804349217d8cc22cfdd412a1741dbbcfea
Component: engine
2014-04-22 15:50:23 -07:00
b636123fc3 beam: new routing functions Route.KeyEquals, Route.KeyIncludes, Route.NoKey
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 0d08d36bf576babd74f21b83ccde019acde4d9c7
Component: engine
2014-04-22 15:50:23 -07:00
262cbf977c beam/examples/beamsh: use beam.Router to simplify 'trace'
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 30424f4e3a40ec21ac25e5c3f9ef45c3109c9f06
Component: engine
2014-04-22 15:50:23 -07:00
752ad4f822 beam/examples/beamsh: move builtins to a separate file for readability
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: d3df4b5baf0d3707dd8bbf700c5836dfdfac8752
Component: engine
2014-04-22 15:50:23 -07:00
6bbf98f17b beam/examples/beamsh: simplify commands by always creating and sending stdout and stderr for them
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 0822d67b2dc05dc2500e3b898dc3604be47fcd84
Component: engine
2014-04-22 15:50:23 -07:00
d0489babdf beam/examples/beamsh: use beam.Router to simplify 'logger'
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 63fd2ec0f7ec091912435cedc081b132e66ae658
Component: engine
2014-04-22 15:50:23 -07:00
679c521f8a beam/examples/beamsh: use beam.Router to simplify the 'stdio' command
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 9206b18818db988621f60cbf869eb20acd1a49e9
Component: engine
2014-04-22 15:50:23 -07:00
2a384a9a0b beam: Router can route beam messages with a convenient set of rules and handlers
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 8f5435e80c3dbaa27429bbb7cadf2c735caa76de
Component: engine
2014-04-22 15:50:23 -07:00
66816b58ac beam/examples/beamsh: move example scripts to scripts/
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 40b4f86eab7b5bf7ca7d85eb8cc7b715fd03feab
Component: engine
2014-04-22 15:50:22 -07:00
2ef34ed7cf beam: Fix double close of fds in SendUnix
Instead of calling syscall.Close() on the fds in sendUnix() we call
Close() on the *os.File in Send(). Otherwise the fd will be closed, but
the *os.File will continue to live, and when it is finalized the
fd will be closed (which by then may be reused and can be anything).

This also adds a note to Send() the the file is closed.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 1fb0bf1b3b7ba2f5188bb58ef8d6991173e6b0f2
Component: engine
2014-04-22 15:50:22 -07:00
7ceb7e67ea beam: more unit tests
This adds testing to SendConn.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: a88d8d678b4f168885a65f8bb13720f282725355
Component: engine
2014-04-22 15:50:22 -07:00
2b6efd6fe0 beam/examples/beamsh: add scripts to reproduce various bugs
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 06df94d55b6a1ec10faf4672ebe7fcaf7fb62ab7
Component: engine
2014-04-22 15:50:22 -07:00
a7e559b7d2 beam/examples/beamsh: fix 'print' to be pass-through
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: d0ca66dded29c3e5e2f78d99e9cc9205484c3b5f
Component: engine
2014-04-22 15:50:22 -07:00
df4d4ec486 beam/examples/beamsh: rename 'log' to 'logger' to avoid conflict with stdout/stderr
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: b97375fc29a88f896e14f45a34c263a4948c9ad9
Component: engine
2014-04-22 15:50:22 -07:00
05ff9d4c14 beam/examples/beamsh: 'prompt' asks the user for a value and sends it.
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: a2b88b4915acf7b1c1a165dd9193f416e5b99e3c
Component: engine
2014-04-22 15:50:22 -07:00
efaa77908b beam/examples/beamsh: commands are messages.
Commands in the pipeline should either implement or pass-through command messages.

This amounts to a proof-of-concept implementation of the "pipeline"
design of Docker plugins.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: ed62ca5b2f673fde54c2ffc5edaf0e5bcbd1b721
Component: engine
2014-04-22 15:50:22 -07:00
4c6e97a76f beam/examples/beamsh: cosmetic fix in Fatalf
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 2f4b8b7e8dbdc1861ee83b63d92ab0921045861f
Component: engine
2014-04-22 15:50:22 -07:00
dd8f545bb2 beam: replace SendPair() with the simpler SendConn()
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 4f92ffb50036f313a51020e1bfdcad7b10db65fb
Component: engine
2014-04-22 15:50:21 -07:00
d1f6c39cc9 beam/examples/beamsh: miniserver.ds demo
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 5833e7888725dcb7d0bfd3f23087deed73a75328
Component: engine
2014-04-22 15:50:21 -07:00
4b5530e072 beam: improve the API with Sender/Receiver interfaces and utilities: Copy/SendPipe/SendPair
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 70d32621615506b6622380ed6021f63be67e6e23
Component: engine
2014-04-22 15:50:21 -07:00
3822f04f53 beam: Make extracted Fds CloseOnExec
Grab forklock to make sure no forks accidentally inherit the new fds
before they are made CLOEXEC There is a slight race condition between
ReadMsgUnix returns and when we grap the lock, so this is not
perfect. Unfortunately There is no way to pass MSG_CMSG_CLOEXEC to
recvmsg() nor any way to implement non-blocking i/o in go, so this is
hard to fix.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: b0228d94beeeb331f6ac58b289eba4982a42c5d4
Component: engine
2014-04-22 15:50:21 -07:00
1695eb64ac beam/examples/beamsh: add a few example dockerscripts
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 207e604bad1bf5d69c139cb17568cfc473a391ba
Component: engine
2014-04-22 15:50:21 -07:00
dd65dea1c6 beam/examples/beamsh: simplify code by using sendWPipe utility
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 29ddf2be1e9b9349865e3d0f34b1d4fc0b960ee3
Component: engine
2014-04-22 15:50:21 -07:00
aed648b82b beam/examples/beamsh: move code around for readability
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 1dc449e11dfaf9b376b953322b4bab19e88f7d94
Component: engine
2014-04-22 15:50:21 -07:00
609fa308ff beam/examples/beamsh: 'exec' adds 'fromcmd' field to its output
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 3a2b31a30b49f02f6043be5790fd2a123c2c5eae
Component: engine
2014-04-22 15:50:21 -07:00
ab1a9fa4e1 beam/examples/beamsh: simple 'log' command tees streams to a local directory
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 7534f7a34b2f0d5eac5e59c1a686adc6f4410d26
Component: engine
2014-04-22 15:50:21 -07:00
0fd013996b beam/examples/beamsh: 'render' and 'beamsh -x'
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 4f5b94d3690e3ccdcc23b68d9635dfa37b6dd0e4
Component: engine
2014-04-22 15:50:20 -07:00
75bca8866b beam/examples/beamsh: run commands in an implicit context of pre-loaded 'plugins'
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 4ebe7aab91b67048ea0d2bbec13bfb1d79787f11
Component: engine
2014-04-22 15:50:20 -07:00
1875fe5b4e beam/examples/beamsh: convenience commands 'devnull', 'echo' and 'stdio'
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: cd85af06fe693d849766348e505607f3bd4ff3fc
Component: engine
2014-04-22 15:50:20 -07:00
6679196850 beam/examples/beamsh: 'emit' supports key=value syntax to compose arbitrary objects
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 6d9cdbf24f1f99dd42788afcadc300128175f42f
Component: engine
2014-04-22 15:50:20 -07:00
e69a2729d2 beam/examples/beamsh: support for background commands with '&' terminator
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 6e0a156d9086300a34b0e1f441dd5150dde57be1
Component: engine
2014-04-22 15:50:20 -07:00
e8bf776d4f beam/data: Message.Parse creates a message from shell-style 'key=value' arguments
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 08686f1d2108bbe93d02e870abe8b944b1fe022b
Component: engine
2014-04-22 15:50:20 -07:00
9b009b457a beam/examples/beamsh: scripts can be passed as filenames
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: e1c8dbba97212381874c297ba07270436ea595cc
Component: engine
2014-04-22 15:50:20 -07:00
f1d3513c36 beam/examples/beamsh: remote communication over beam (experimental).
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 222fc87ade3ed83623a3dae867f50d193b48b2a9
Component: engine
2014-04-22 15:50:20 -07:00
ea79e30c93 beam/examples/beamsh: 'in' chdirs to a directory. 'pass' does simple passthrough
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 371f6fc63d864711ee546220116f31ddb151fcce
Component: engine
2014-04-22 15:50:19 -07:00
70bbf6d2b3 beam/examples/beamsh: 'beamsend' command serializes all messages and sends them over a network connection
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 6d5c75a2242d14fda250759371fdedbcd519654a
Component: engine
2014-04-22 15:50:19 -07:00
85628de2fe beam/examples/beamsh: 'exec' command correctly closes stdout and stderr when the process exists
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 5ddf67385164f76a2dbe1ed30442dd99c7911827
Component: engine
2014-04-22 15:50:19 -07:00
45c6418e21 beam/examples/beamsh: don't print discarded messages in Devnull
This avoids false alarms when process exits without printing. Devnull
doesn't require synchronization.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: e512fef42505b3d276936a563a3ea4a44a52b19c
Component: engine
2014-04-22 15:50:19 -07:00
90f7f3b975 beam/examples/beamsh: more useful debugging
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: 34c5724b899ad8ceca4963ad527f246f06cb65b9
Component: engine
2014-04-22 15:50:19 -07:00
8a297e956b beam/data: expose EncodeString for convenience access to the underlying netstring primitive
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: a5bc75d4060b3537661e02a8406ab9a270727efc
Component: engine
2014-04-22 15:50:19 -07:00
bbc54cabb7 beam/examples/beamsh: utility function 'fileToConn'
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Upstream-commit: fb1af1f0bc87712a41a47829e12a2f273b2c8a55
Component: engine
2014-04-22 15:50:19 -07:00