EcBroadcastProxy class documentation

Authors

Nicola Pero (nicola.pero@meta-innovation.com)

Copyright: (C) 2012 Free Software Foundation, Inc.


Contents -

  1. Software documentation for the EcBroadcastProxy class
  2. Software documentation for the NSObject(BCPdelegate) informal protocol
  3. EcBroadcastProxy variables

Software documentation for the EcBroadcastProxy class

EcBroadcastProxy : NSObject

Declared in:
EcBroadcastProxy.h
An EcBroadcastProxy instance forwards messages to multiple servers via distributed objects. This is great if you want to send a task to be repeated by multiple servers in order to make a system more scalable.
You may also design your servers so that you pass some sort of identifier to let them know that one of them (which recognises the identifier) should do one thing while the others ignore it.
Finally, remote servers are always listed in the same order, so you can access them by their index; to get the host/name, you can get it by asking the receiverNames and receiverHosts and then looking up the one at the index you want. This allows you to send specific messages to specific servers.

Instance Variables

Method summary

BCPdelegate 

- (id) BCPdelegate;
Returns the delegate set using the -BCPsetDelegate: method.

BCPproxy: 

- (id) BCPproxy: (int)index;
The following one gives you back the proxy to talk to. It automatically calls -BCPraiseConnection: to that server before sending you back a proxy. It returns nil upon failure.

BCPraiseConnection: 

- (void) BCPraiseConnection: (int)index;
Raise connection to server at index

BCPraiseConnections 

- (void) BCPraiseConnections;
Create connections to the receivers if needed. It is called internally when a message to broadcast comes in; but you may want to call this method in advance to raise the connections so that when a message to broadcast comes in, the connections are already up and ready.

BCPreceiverCount 

- (int) BCPreceiverCount;
Get the number of receivers

BCPreceiverHosts 

- (NSArray*) BCPreceiverHosts;
Get the list of server hosts

BCPreceiverNames 

- (NSArray*) BCPreceiverNames;
Get the list of server names

BCPsetDelegate: 

- (void) BCPsetDelegate: (id)object;
Set a delegate.
The delegate object gets the messages from the BCPdelegate informal protocol upon connection loss and when a connection is made.

BCPstatus 

- (NSString*) BCPstatus;
Get a string describing the status of the broadcast object

initWithReceiverNames: receiverHosts: 

- (id) initWithReceiverNames: (NSArray*)names receiverHosts: (NSArray*)hosts;
This is a designated initialiser for the class.
Initializes the receiver creating connections to the specified distributed objects servers. The names are the DO ports (server-names) and hosts are the names of the machines those servers are running on (may be '*' to find the server on any machine on the LAN, or an empty string to find the server on the local host).

initWithReceivers: 

- (id) initWithReceivers: (NSArray*)receivers;
Configuration array contains a list of dictionaries (one for each receiver) - each dictionary has two keys: `Name' and `Host', with the corresponding values set.



Instance Variables for EcBroadcastProxy Class

delegate

@protected id delegate;
The delegate (if any)

idFailed

@protected int idFailed;
Count of failed messages returning id

idFullySent

@protected int idFullySent;
Count of completed messages returning id

idPartiallySent

@protected int idPartiallySent;
Count of partial messages returning id

onewayFailed

@protected int onewayFailed;
Count of failed messages returning void

onewayFullySent

@protected int onewayFullySent;
Count of completed messages returning void

onewayPartiallySent

@protected int onewayPartiallySent;
Count of partial messages returning void

receiverHosts

@protected NSArray* receiverHosts;
The hosts the receiver objects are on

receiverNames

@protected NSArray* receiverNames;
The names of the receiver object

receiverObjects

@protected NSMutableArray* receiverObjects;
The [proxies to the] individual remote objects




Software documentation for the NSObject(BCPdelegate) informal protocol

NSObject(BCPdelegate)

Declared in:
EcBroadcastProxy.h
The informal protocol listing messages which will be sent to the EcBroadcastProxy's delegate if it responds to them.
Method summary

BCP: lostConnectionToServer: host: 

- (void) BCP: (EcBroadcastProxy*)proxy lostConnectionToServer: (NSString*)name host: (NSString*)host;
The method to notify the delegate that a connection to an individual server process has been lost.

BCP: madeConnectionToServer: host: 

- (void) BCP: (EcBroadcastProxy*)proxy madeConnectionToServer: (NSString*)name host: (NSString*)host;
The method to notify the delegate that a connection to an individual server process has been made.

EcBroadcastProxy variables

enum EcBroadcastProxyError

enum EcBroadcastProxyError enum EcBroadcastProxyError;
This type enumerates the possible error conditions occurring when sending a message to the proxy.
BCP_NO_ERROR
A success
BCP_COULD_NOT_CONNECT
Unable to connect to the server
BCP_CONNECTION_WENT_DOWN
Lost connection while sending
BCP_MESSAGING_TIMEOUT
Timeout while waiting for response