Class: Cybertrain::Background::Service
- Inherits:
-
Object
- Object
- Cybertrain::Background::Service
- Defined in:
- cybertrain/background.rb
Overview
A background service: the default does nothing. Subclasses override
all three methods. Distinctive names (service_start, not start):
NOTES rules 10/34/62.
Instance Method Summary collapse
-
#service_name ⇒ String
For the log and for register’s uniqueness check; non-empty in a subclass.
-
#service_problem ⇒ String
What would make service_start refuse to start, found before the server binds its port (boot_problem), so serve reports it as a boot failure rather than raising after the banner.
-
#service_start(config) ⇒ Boolean
Starts the service (its thread, usually).
-
#service_stop ⇒ nil
Asks the service to end.
Instance Method Details
#service_name ⇒ String
Returns for the log and for Cybertrain::Background.register’s uniqueness check; non-empty in a subclass.
36 37 38 |
# File 'cybertrain/background.rb', line 36 def service_name "" end |
#service_problem ⇒ String
What would make service_start refuse to start, found before the server binds its port (Cybertrain::Background.boot_problem), so serve reports it as a boot failure rather than raising after the banner.
62 63 64 |
# File 'cybertrain/background.rb', line 62 def service_problem "" end |
#service_start(config) ⇒ Boolean
Starts the service (its thread, usually). Called once per serve; it must not block and should not raise.
45 46 47 |
# File 'cybertrain/background.rb', line 45 def service_start(config) false end |
#service_stop ⇒ nil
Asks the service to end. Called once at shutdown, also for a service whose service_start returned false: then it does nothing.
53 54 55 |
# File 'cybertrain/background.rb', line 53 def service_stop nil end |