Skip to content

Commit 0d2b580

Browse files
Revert back to Async::Service::Generic.
1 parent 38f08c5 commit 0d2b580

21 files changed

Lines changed: 146 additions & 138 deletions

File tree

context/best-practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ end
201201

202202
### Use `Managed::Service` as Base Class
203203

204-
Prefer `Async::Service::ManagedService` over `GenericService` for most services:
204+
Prefer `Async::Service::ManagedService` over `Generic` for most services:
205205

206206
```ruby
207207
class WebService < Async::Service::ManagedService

context/getting-started.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ $ bundle add async-service
1414

1515
`async-service` has several core concepts:
1616

17-
- A {ruby Async::Service::GenericService} which represents the base class for implementing services.
17+
- A {ruby Async::Service::Generic} which represents the base class for implementing services.
1818
- A {ruby Async::Service::Configuration} which manages service configurations and environments.
1919
- A {ruby Async::Service::Controller} which handles starting, stopping, and managing services.
2020

2121
## Usage
2222

23-
Services are long-running processes that can be managed as a group. Each service extends `Async::Service::GenericService` and implements a `setup` method that defines how the service runs.
23+
Services are long-running processes that can be managed as a group. Each service extends `Async::Service::Generic` and implements a `setup` method that defines how the service runs.
2424

2525
### Basic Service
2626

@@ -31,7 +31,7 @@ Create a simple service that runs continuously:
3131

3232
require "async/service"
3333

34-
class HelloService < Async::Service::GenericService
34+
class HelloService < Async::Service::Generic
3535
def setup(container)
3636
super
3737

@@ -73,7 +73,7 @@ end
7373
In your service implementation, you can access these values through the environment and evaluator:
7474

7575
```ruby
76-
class WebServerService < Async::Service::GenericService
76+
class WebServerService < Async::Service::Generic
7777
def setup(container)
7878
super
7979

@@ -103,7 +103,7 @@ You can define multiple services in a single configuration file:
103103

104104
require "async/service"
105105

106-
class WebService < Async::Service::GenericService
106+
class WebService < Async::Service::Generic
107107
def setup(container)
108108
super
109109

@@ -115,7 +115,7 @@ class WebService < Async::Service::GenericService
115115
end
116116
end
117117

118-
class WorkerService < Async::Service::GenericService
118+
class WorkerService < Async::Service::Generic
119119
def setup(container)
120120
super
121121

context/service-architecture.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ end
8282

8383
## Service
8484

85-
The {ruby Async::Service::GenericService} represents the service implementation layer. It handles the actual business logic of your services, provides access to configuration through environment evaluators, and manages the service lifecycle including startup, execution, and shutdown phases.
85+
The {ruby Async::Service::Generic} represents the service implementation layer. It handles the actual business logic of your services, provides access to configuration through environment evaluators, and manages the service lifecycle including startup, execution, and shutdown phases.
8686

8787
### Business Logic
8888

8989
Services contain the actual implementation of what your service does:
9090

9191
```ruby
92-
class WebService < Async::Service::GenericService
92+
class WebService < Async::Service::Generic
9393
def setup(container)
9494
super
9595

@@ -148,7 +148,7 @@ By evaluating the log_path in the child process, you ensure that each instance h
148148
Services define their startup, running, and shutdown behavior:
149149

150150
```ruby
151-
class MyService < Async::Service::GenericService
151+
class MyService < Async::Service::Generic
152152
def start
153153
super
154154
# Service-specific startup logic including pre-loading libraries and binding to network interfaces before forking.
@@ -264,7 +264,7 @@ end
264264

265265
For services using `Async::Service::ManagedService`, health checking is handled automatically. The service sends `status!` messages during startup to prevent premature health check timeouts, then transitions to sending `ready!` messages once the service is actually ready.
266266

267-
For services extending `GenericService`, you can set up health checking manually:
267+
For services extending `Generic`, you can set up health checking manually:
268268

269269
```ruby
270270
def setup(container)
@@ -334,7 +334,7 @@ end
334334

335335
```ruby
336336
# Services are defined using environments:
337-
class WebService < Async::Service::GenericService
337+
class WebService < Async::Service::Generic
338338
def setup(container)
339339
super
340340

@@ -493,7 +493,7 @@ end
493493
Build service hierarchies:
494494

495495
```ruby
496-
class BaseWebService < Async::Service::GenericService
496+
class BaseWebService < Async::Service::Generic
497497
def setup(container)
498498
super
499499
# Common web service setup

examples/hello/hello.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Released under the MIT License.
55
# Copyright, 2024-2025, by Samuel Williams.
66

7-
class SleepService < Async::Service::GenericService
7+
class SleepService < Async::Service::Generic
88
def setup(container)
99
super
1010

examples/hello/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Press `Ctrl+C` to stop the service.
2727
The example defines a simple service class:
2828

2929
~~~ ruby
30-
class SleepService < Async::Service::GenericService
30+
class SleepService < Async::Service::Generic
3131
def setup(container)
3232
super
3333

@@ -45,7 +45,7 @@ end
4545

4646
Key points:
4747

48-
- **Inherits from `Async::Service::GenericService`**: Provides the basic service interface
48+
- **Inherits from `Async::Service::Generic`**: Provides the basic service interface
4949
- **Implements `setup(container)`**: Defines how the service runs
5050
- **Uses `container.run`**: Creates one instance with automatic restart
5151
- **Calls `instance.ready!`**: Signals the service is ready

examples/ipc/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ipc_socket_path File.expand_path("service.ipc", Dir.pwd)
1717
end
1818

19-
class IPCClient < Async::Service::GenericService
19+
class IPCClient < Async::Service::Generic
2020
def setup(container)
2121
super
2222

examples/ipc/server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
ipc_socket_path File.expand_path("service.ipc", Dir.pwd)
1616
end
1717

18-
class IPCServer < Async::Service::GenericService
18+
class IPCServer < Async::Service::Generic
1919
def setup(container)
2020
super
2121

fixtures/async/service/sleep_service.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
# Released under the MIT License.
44
# Copyright, 2025, by Samuel Williams.
55

6-
require "async/service/generic_service"
6+
require "async/service/generic"
77

88
module Async
99
module Service
10-
class SleepService < Async::Service::GenericService
10+
class SleepService < Async::Service::Generic
1111
def setup(container)
1212
super
1313

guides/best-practices/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ end
201201

202202
### Use `Managed::Service` as Base Class
203203

204-
Prefer `Async::Service::ManagedService` over `GenericService` for most services:
204+
Prefer `Async::Service::ManagedService` over `Generic` for most services:
205205

206206
```ruby
207207
class WebService < Async::Service::ManagedService

guides/getting-started/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Create a file called `hello_service.rb`:
3737

3838
require 'async/service'
3939

40-
class HelloService < Async::Service::GenericService
40+
class HelloService < Async::Service::Generic
4141
def setup(container)
4242
super
4343

@@ -82,7 +82,7 @@ Let's break down the example:
8282
### Service Class
8383

8484
~~~ ruby
85-
class HelloService < Async::Service::GenericService
85+
class HelloService < Async::Service::Generic
8686
def setup(container)
8787
super
8888

@@ -95,7 +95,7 @@ class HelloService < Async::Service::GenericService
9595
end
9696
~~~
9797

98-
- **Inherit from `Async::Service::GenericService`**: This provides the basic service interface
98+
- **Inherit from `Async::Service::Generic`**: This provides the basic service interface
9999
- **Implement `setup(container)`**: This method configures how your service runs
100100
- **Call `super`**: Always call the parent's setup method
101101
- **Use `container.run`**: Define how many instances to run and restart behavior
@@ -146,7 +146,7 @@ You can define multiple services in a single configuration file:
146146

147147
require 'async/service'
148148

149-
class WebService < Async::Service::GenericService
149+
class WebService < Async::Service::Generic
150150
def setup(container)
151151
super
152152

@@ -160,7 +160,7 @@ class WebService < Async::Service::GenericService
160160
end
161161
end
162162

163-
class WorkerService < Async::Service::GenericService
163+
class WorkerService < Async::Service::Generic
164164
def setup(container)
165165
super
166166

@@ -224,7 +224,7 @@ Async::Service::Controller.run(configuration)
224224
Services automatically handle errors and provide logging:
225225

226226
~~~ ruby
227-
class RobustService < Async::Service::GenericService
227+
class RobustService < Async::Service::Generic
228228
def setup(container)
229229
super
230230

@@ -269,7 +269,7 @@ Check out the [examples](../../examples/) directory for more complex service imp
269269
require 'async/http/server'
270270
require 'async/http/endpoint'
271271

272-
class HTTPService < Async::Service::GenericService
272+
class HTTPService < Async::Service::Generic
273273
def setup(container)
274274
super
275275

@@ -290,7 +290,7 @@ end
290290
### Periodic Task Service
291291

292292
~~~ ruby
293-
class PeriodicService < Async::Service::GenericService
293+
class PeriodicService < Async::Service::Generic
294294
def setup(container)
295295
super
296296

0 commit comments

Comments
 (0)