Class: Higgs::RemoteServices
- Inherits:
-
Object
- Object
- Higgs::RemoteServices
- Defined in:
- lib/higgs/services.rb
Overview
remote services
Constant Summary collapse
- CVS_ID =
for ident(1)
'$Id: services.rb 841 2008-12-24 09:23:20Z toki $'
Instance Attribute Summary collapse
-
#remote_services_uri ⇒ Object
readonly
Returns the value of attribute remote_services_uri.
Instance Method Summary collapse
-
#initialize(options) ⇒ RemoteServices
constructor
theses options are defined.
- #shutdown ⇒ Object
Constructor Details
#initialize(options) ⇒ RemoteServices
theses options are defined.
:remote_services_uri-
URI for DRb remote call to provide services.
:storage-
an instance of Higgs::Storage as remote service provider.
:transaction_manager-
an instance of Higgs::TransactionManager as remote service provider.
these methods are exported as remote services.
-
Higgs::Storage#alive?
-
Higgs::Storage#localhost_check
-
Higgs::Storage#rotate_journal_log
-
Higgs::TransactionManager#apply_journal_log
-
Higgs::TransactionManager#switch_to_write
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/higgs/services.rb', line 32 def initialize() @remote_services_uri = [:remote_services_uri] @storage = [:storage] @tman = [:transaction_manager] @service_map = {} if (@storage) then @service_map[:alive_service_v1] = @storage.method(:alive?) @service_map[:localhost_check_service_v1] = @storage.method(:localhost_check) @service_map[:jlog_rotate_service_v1] = @storage.method(:rotate_journal_log) end if (@tman) then @service_map[:jlog_apply_service_v1] = @tman.method(:apply_journal_log) @service_map[:switch_to_write_service_v1] = @tman.method(:switch_to_write) end @service_map.extend(DRb::DRbUndumped) @service_map.freeze @server = DRb::DRbServer.new(@remote_services_uri, @service_map) if @remote_services_uri end |
Instance Attribute Details
#remote_services_uri ⇒ Object (readonly)
Returns the value of attribute remote_services_uri.
53 54 55 |
# File 'lib/higgs/services.rb', line 53 def remote_services_uri @remote_services_uri end |
Instance Method Details
#shutdown ⇒ Object
55 56 57 58 |
# File 'lib/higgs/services.rb', line 55 def shutdown @server.stop_service if @remote_services_uri nil end |