WWW::SearchBroker::Broker - Service functions for broker component of SearchBroker


WWW-SearchBroker documentation  | view source Contained in the WWW-SearchBroker distribution.

Index


NAME

Top

WWW::SearchBroker::Broker - Service functions for broker component of SearchBroker

SYNOPSIS

Top

	use WWW::SearchBroker::Broker;

	# Create a Broker
	my $broker = new WWW::SearchBroker::Broker(...);

	# Listen for requests and response
	while ($broker->event_loop())
		{ }

	# Service functions (internal only)
	my $sid = $broker->get_sid();
	my $success = agent_request($sid,$agent,$query);
	my $response = $self->sock_agent_request($s,$what);
	my $response = get_response($file_handle);
	my $is_complete = check_for_completion(@a_request);
	my $success = $broker->aggregate_and_return($var,$val,$req);

DESCRIPTION

Top

Service functions for the broker component of the search broker (WWW::SearchBroker).

new(port => $server_port)

Creates a WWW::SearchBroker::Broker broker listening for requests on $server_port.

event_loop()

The main deal -- wait for search requestions, farm them out to required agents. Returns true unless a 'QUIT' request has been received, in which case it returns false (and the script running the broker should finish).

get_sid()

Generate a unique key for this search (search id = sid)

agent_request($sid,$agent,$query)

Run (fork) a query using the specified agent.

sock_agent_request($s,$what)

Run (through socket 's') a query using the specified agent. [ Now somewhat stale, will need to be rewritten. ]

get_response($file_handle)

Read an agent response from the specified file handle. Return it in deserialized state (i.e. as a perl object).

check_for_completion(@a_request)

Review a request object to find out if it has either finished or run out of time. A request object currently consists of a simple(?!) list consisting of filehandle, filehandle number, host, starttime and child filehandles).

aggregate_and_return($var,$val,$req)

Consolidate the data generated by agent sub-queries and return it to the original requestor.

fork_and_loop()

For tests (e.g. t/base/search.t).

BUGS

Top

This module has only been tested on the Monash network using Monash Internet services. Since it builds off other CPAN modules, it is expected that the module will work across a variety of standards-based environments but this has not been demonstrated. The author welcomes feedback (especially patches!) for any assumptions made that don't comply with different environments.

SEE ALSO

Top

WWW::SearchBroker, WWW::SearchBroker::Search, WWW::SearchBroker::Common, WWW::SearchBroker::Aggregator_Scorer, tests/www_searchbroker.pl.

AUTHOR

Top

Nathan Bailey, <nate@cpan.org>

COPYRIGHT

Top


WWW-SearchBroker documentation  | view source Contained in the WWW-SearchBroker distribution.