Skip to content

Commit 5244c98

Browse files
committed
Modernize README.
1 parent c45df68 commit 5244c98

File tree

1 file changed

+16
-95
lines changed

1 file changed

+16
-95
lines changed

README.md

Lines changed: 16 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,34 @@
11
# Async::Container
22

3-
Provides containers which implement concurrency policy for high-level servers (and potentially clients).
3+
Provides containers which implement parallelism for clients and servers.
44

55
[![Development Status](https://github.com/socketry/async-container/workflows/Development/badge.svg)](https://github.com/socketry/async-container/actions?workflow=Development)
66

7-
## Installation
7+
## Features
88

9-
``` bash
10-
$ bundle add async-container
11-
```
9+
- Supports multi-process, multi-thread and hybrid containers.
10+
- Automatic scalability based on physical hardware.
11+
- Direct integration with [systemd](https://www.freedesktop.org/software/systemd/man/sd_notify.html) using `$NOTIFY_SOCKET`.
12+
- Internal process readiness protocol for handling state changes.
13+
- Automatic restart of failed processes.
1214

1315
## Usage
1416

15-
### Container
16-
17-
A container represents a set of child processes (or threads) which are doing work for you.
18-
19-
``` ruby
20-
require 'async/container'
21-
22-
Async.logger.debug!
23-
24-
container = Async::Container.new
25-
26-
container.async do |task|
27-
task.logger.debug "Sleeping..."
28-
task.sleep(1)
29-
task.logger.debug "Waking up!"
30-
end
31-
32-
Async.logger.debug "Waiting for container..."
33-
container.wait
34-
Async.logger.debug "Finished."
35-
```
36-
37-
### Controller
38-
39-
The controller provides the life-cycle management for one or more containers of processes. It provides behaviour like starting, restarting, reloading and stopping. You can see some [example implementations in Falcon](https://github.com/socketry/falcon/blob/master/lib/falcon/controller/). If the process running the controller receives `SIGHUP` it will recreate the container gracefully.
40-
41-
``` ruby
42-
require 'async/container'
43-
44-
Async.logger.debug!
45-
46-
class Controller < Async::Container::Controller
47-
def setup(container)
48-
container.async do |task|
49-
while true
50-
Async.logger.debug("Sleeping...")
51-
task.sleep(1)
52-
end
53-
end
54-
end
55-
end
56-
57-
controller = Controller.new
58-
59-
controller.run
60-
61-
# If you send SIGHUP to this process, it will recreate the container.
62-
```
63-
64-
### Signal Handling
65-
66-
`SIGINT` is the interrupt signal. The terminal sends it to the foreground process when the user presses **ctrl-c**. The default behavior is to terminate the process, but it can be caught or ignored. The intention is to provide a mechanism for an orderly, graceful shutdown.
67-
68-
`SIGQUIT` is the dump core signal. The terminal sends it to the foreground process when the user presses **ctrl-\\**. The default behavior is to terminate the process and dump core, but it can be caught or ignored. The intention is to provide a mechanism for the user to abort the process. You can look at `SIGINT` as "user-initiated happy termination" and `SIGQUIT` as "user-initiated unhappy termination."
69-
70-
`SIGTERM` is the termination signal. The default behavior is to terminate the process, but it also can be caught or ignored. The intention is to kill the process, gracefully or not, but to first allow it a chance to cleanup.
71-
72-
`SIGKILL` is the kill signal. The only behavior is to kill the process, immediately. As the process cannot catch the signal, it cannot cleanup, and thus this is a signal of last resort.
73-
74-
`SIGSTOP` is the pause signal. The only behavior is to pause the process; the signal cannot be caught or ignored. The shell uses pausing (and its counterpart, resuming via `SIGCONT`) to implement job control.
75-
76-
### Integration
77-
78-
#### systemd
79-
80-
Install a template file into `/etc/systemd/system/`:
81-
82-
```
83-
# my-daemon.service
84-
[Unit]
85-
Description=My Daemon
86-
AssertPathExists=/srv/
87-
88-
[Service]
89-
Type=notify
90-
WorkingDirectory=/srv/my-daemon
91-
ExecStart=bundle exec my-daemon
92-
Nice=5
93-
94-
[Install]
95-
WantedBy=multi-user.target
96-
```
17+
Please see the [project documentation](https://socketry.github.io/async-container/).
9718

9819
## Contributing
9920

100-
1. Fork it
101-
2. Create your feature branch (`git checkout -b my-new-feature`)
102-
3. Commit your changes (`git commit -am 'Add some feature'`)
103-
4. Push to the branch (`git push origin my-new-feature`)
104-
5. Create new Pull Request
21+
We welcome contributions to this project.
10522

106-
## License
23+
1. Fork it.
24+
2. Create your feature branch (`git checkout -b my-new-feature`).
25+
3. Commit your changes (`git commit -am 'Add some feature'`).
26+
4. Push to the branch (`git push origin my-new-feature`).
27+
5. Create new Pull Request.
10728

108-
Released under the MIT license.
29+
## License
10930

110-
Copyright, 2017, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
31+
Copyright, 2017, by [Samuel G. D. Williams](https://www.codeotaku.com).
11132

11233
Permission is hereby granted, free of charge, to any person obtaining a copy
11334
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)