indexing description: "Represents a peer group" license: "MIT license (see ../license.txt)" author: "Beat Strasser " date: "$Date$" revision: "$Revision$" deferred class P2P_PEERGROUP inherit P2P_MODULE rename start as start_with_arguments end feature -- Access id: P2P_PEERGROUP_ID -- Peer group id, casted version of `module_id' name: STRING -- Peer group name (not unique) description: STRING -- Peer group description parent_group: P2P_PEERGROUP -- Parent peer group group_advertisement: P2P_PEERGROUP_ADVERTISEMENT -- Peer group advertisement configuration: P2P_CONFIGURATION -- Group configuration cache_manager: P2P_CACHE_MANAGER job_queue: JOB_QUEUE -- General job queue for managing threads feature -- Local peer peer_id: P2P_PEER_ID -- Local peer id peer_name: STRING -- Local peer name peer_advertisement: P2P_PEER_ADVERTISEMENT -- Local peer advertisement within this group feature -- Services lookup_module (a_name: STRING): P2P_MODULE is -- Look up a registered module under given `a_name' require Name_valid: a_name /= Void deferred end modules: DS_LINKED_LIST [TUPLE [STRING, P2P_ID, P2P_MODULE_SPECIFICATION_ID, BOOLEAN]] is -- Current list of modules: registered name, assigned id, specification id deferred ensure Result_set: Result /= Void end endpoint_service: P2P_ENDPOINT_SERVICE -- Endpoint service discovery_service: P2P_DISCOVERY_SERVICE -- Discovery service rendezvous_service: P2P_RENDEZVOUS_SERVICE -- Rendezvous service resolver_service: P2P_RESOLVER_SERVICE -- Resolver service feature -- Basic operations load_module_by_specification (an_id: P2P_ID; specification_id: P2P_MODULE_SPECIFICATION_ID; a_name: STRING): P2P_MODULE is -- Find module with given `specification_id' and initialize it with current group and `id' and when successful, register it with `a_name' require Id_valid: an_id /= Void and an_id.is_valid Spec_valid: specification_id /= Void and specification_id.is_valid Name_valid: a_name /= Void and not a_name.is_empty deferred end start is -- Start peer group module without arguments do start_with_arguments (Void) end when_fully_started: BOOLEAN is -- Is entire peer group successfully started? Wait until entire peer group is started or a startup failure occurred. require Status_initializing_or_ok: module_status = initializing or module_status = suspended deferred ensure Result_set: Result = (module_status = start_ok) end feature {NONE} -- Implementation check_dependencies (a_parent: P2P_PEERGROUP): BOOLEAN is -- Are all needed dependencies met? do Result := a_parent.configuration /= Void and a_parent.cache_manager /= Void and a_parent.job_queue /= Void end end