Liu Jiang
95e8049398
shim: distinguish between runtime id and container id
...
There's a misuse of runtime id and container id in Shim::new(). Both
runtime id and container id are needed by shim implentions, so add
parameter `container id` to Shim::new().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-14 13:44:45 +08:00
bin liu
c12ac9ee68
shim: update README.md to run shim examples
...
The content of README.md is out of date, update it
with the correct steps to run the examples.
Signed-off-by: bin liu <bin@hyper.sh>
2021-12-14 11:37:00 +08:00
bin liu
e5e0ebbe36
shim: pass the correct ID of containers to shim
...
The ID passed from shim::run::<Service> is the shim name,
the container ID can get from command-line flags.
Signed-off-by: bin liu <bin@hyper.sh>
2021-12-13 18:14:51 +08:00
Liu Jiang
72aebb1b39
shim: trivial documentation enhancements
...
Trivial documentation enhancements:
1) comments for unsafe code
2) list supported platforms
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:13:05 +08:00
Liu Jiang
a2bfeed2ca
shim: introduce Shim::wait()
...
Introduce Shim::wait() to wait for a shim instance to exit, so the
`Shim` implementor could customize the way to manage exit event.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:20 +08:00
Liu Jiang
fdd50661f3
shim: add interface Shim::get_task_service()
...
Currently Containerd shimv2 runtime only provides task service, but it
may provide more service in future. So add interface
Shim::get_task_service() to get the task service object instead of
"Shim: Task".
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:19 +08:00
Liu Jiang
7a8fa4413e
shim: implement ExitSignal with Condvar
...
Implement ExitSignal with Condvar instead of busy looping.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:15 +08:00
Liu Jiang
04af4df73a
shim: pass environment variables to spawned process
...
Enhanace spawn() to pass envrionment variables to child process.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:15 +08:00
Liu Jiang
1b106ee38d
shim: add unit test for start_listener()
...
Add unit test for start_listener().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:14 +08:00
Liu Jiang
0c83d7c04c
shim: be more careful when removing stale socket files
...
The function start_listener() tries to remove stale socket files when
syscall::bind() retune EADDRINUSE, let's be more careful to only remove
existing sockets instead of other types of files.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:13 +08:00
Liu Jiang
63f62b9c9c
shim: avoid raw fd leak in spawn()
...
The RawFd for the listener socket will get leaked in error handling
path in start_listener(). Use UnixListener to replace RawFd for clear
ownership and also simplify the code a bit.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:12 +08:00
Liu Jiang
64d57879ce
shim: add unit tests for remote publisher
...
Add unit tests for remote publisher.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:11 +08:00
Liu Jiang
01e45800dc
shim: release fd when error happens in RemotePublisher::connect()
...
A RawFd won't be automatically released when going out of scope,
so we need to close the just created RawFd when error happens
in RemotePublisher::connect().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:11 +08:00
Liu Jiang
0eff017c40
shim: add unit test case for logger
...
Add unit test case for logger.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:10 +08:00
Liu Jiang
5197e72f4a
shim: do not panic if failed to log to FIFO
...
According to Linux FIFO doc, writing to a FIFO without reader may
return errors:
If all file descriptors referring to the read end of a pipe have been
closed, then a write(2) will cause a SIGPIPE signal to be generated
for the calling process. If the calling process is ignoring this
signal, then write(2) fails with the error EPIPE.
When restarting logger servers, there are small race windows that
FifoLogger::log/flush() may encounter IO error and panic. It's not
a good situation to panic due to errors in logging subsystem.
So just ignore those IO errors.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2021-12-13 10:08:09 +08:00
Maksym Pavlenko
34ab8a1b6f
Bump version to 0.1.1
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:33:15 -08:00
Maksym Pavlenko
064387518e
Update authors and homepage
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:32:26 -08:00
Maksym Pavlenko
87f97f462c
Add copyright headers
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:14:48 -08:00
Maksym Pavlenko
e5fd8c76ae
Update docs
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 15:06:55 -08:00
Maksym Pavlenko
af24c1421c
Add badges
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 11:35:52 -08:00
Maksym Pavlenko
1fc9ce0151
Update repositories
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 11:11:56 -08:00
Maksym Pavlenko
129f4f8608
Fix Cargo.toml for shim crate
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-10 11:08:35 -08:00
Maksym Pavlenko
11ad93017f
Allow custom error types in Shim trait
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-19 16:11:49 -08:00
Maksym Pavlenko
7b0f47b1ba
Pass socket fd to child process
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-17 12:14:57 -08:00
Maksym Pavlenko
70ae5e537a
Rename shim protos crate
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-16 11:07:03 -08:00
Maksym Pavlenko
141ba3bac8
Build on MacOS
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-11-16 10:45:29 -08:00
Maksym Pavlenko
cab9ec91ea
Add keywords
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-28 22:10:42 -07:00
Maksym Pavlenko
9629eac9ec
Add shim exit signal
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-28 11:43:22 -07:00
Maksym Pavlenko
8e6bf687b2
Publisher fixes
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-26 18:16:16 -07:00
Maksym Pavlenko
77bfce3a50
Rename client crate
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-26 17:06:06 -07:00
Maksym Pavlenko
d3852a5fcd
Implement remote publisher
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-26 16:59:21 -07:00
Maksym Pavlenko
3f41003493
Update shim README
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-24 11:04:19 -07:00
Maksym Pavlenko
81a57058b6
Fix shim example
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-22 12:39:08 -07:00
Maksym Pavlenko
bcdb1d950f
Rename crates
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-22 12:29:58 -07:00
Maksym Pavlenko
3fc0396355
Fix CI
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-22 12:20:58 -07:00
Maksym Pavlenko
8e14872cd7
Add license and repository to Cargo.toml
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-07-22 12:03:45 -07:00
Maksym Pavlenko
cce1a7e04c
Update repository README
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-08 18:00:51 -07:00
Maksym Pavlenko
26bfc6cbe7
Add default shim start implementation
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-08 17:50:20 -07:00
Maksym Pavlenko
7624bc7608
Add reaper
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-01 17:14:22 -07:00
Maksym Pavlenko
45c72c34a7
Implement FIFO logger
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-01 16:59:45 -07:00
Maksym Pavlenko
f48d018c32
Add example skeleton
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-01 16:46:52 -07:00
Maksym Pavlenko
e4b51a3b86
Initial shim bootstrapper implementation
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-01 16:40:17 -07:00
Maksym Pavlenko
edf0975ba6
Add shim entry point
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-01 16:02:19 -07:00
Maksym Pavlenko
544b5d26f5
Add empty shim crate
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-06-01 12:07:51 -07:00