8.6 Commpool Interface

ORIGIN 'binarysocket';
LIB_DEF 'processpool' '../lib';

(*
 * COPYRIGHT
 *       Copyright (C) Mjolner Informatics 1995-97
 *       All rights reserved.
 *)

BODY 'private/commpoolbody';
INCLUDE 'commaddress';
INCLUDE '~beta/containers/list';

--- systemlib:attributes ---


BinaryConnectionPool:
  (#
     <<SLOT binaryconnectionpoollib:attributes>>;

     
     (* TYPES
      * =====
      *)
     
     socketType:< BinarySocket;

     
     (* OPERATIONS
      * ==========
      *)
     
     init:< (# ... #);
     
     communication:
       (#
          (* OPERATIONS
           * ==========
           *)
          
          (* remove sock from this pool *)
          removeSock:
            (#
            ...
            #);

          (* NB: always wrap leave/restart out of
           * this(communication) in a specialization
           * of 'leaving' *)
          leaving: (# ... #);
          
          
          (* CALLBACKS
           * =========
           *)
          
          onNewConnection:<
            (* executed when a new connection has been created *)
            (# sock: ^socketType; (* The new connection *)
               context: ^object; (* NB: Should`ve been private *)
               actor: ^|system; (* process to associate with sock *)
            enter (sock[],context[])
            do INNER
            exit actor[]
            #);

          error:< hiErrCB (* operation level error callback *)
            (#
            do INNER;
               (if errCB_initialValue=value then
                   (value,cleanup[])->
                   this(BinaryConnectionPool).error->value;
               if);
            #);
          
          concrErrCB: hiErrCB (* superpattern for 
                               * concrete error callbacks *)
            (#
            do INNER;
               (if errCB_initialValue=value then
                   (value,cleanup[])->error->value;
               if);
            #);
          
          addrHasUnknownType:< exception; (* Considered fatal, 
                                           * for now *)
          internalError:< concrErrCB(# do INNER #);
          unknownError:< concrErrCB(# do INNER #);
          accessError:< concrErrCB(# do INNER #);
          resourceError:< concrErrCB(# do INNER #);
          addressError:< concrErrCB(# do INNER #);
          refusedError:< concrErrCB(# do INNER #);
          intrError:< concrErrCB(# do INNER #);
          getHostError:< concrErrCB(# do INNER #);


          (* ATTRIBUTES
           * ==========
           *)
          
          addr: ^portableCommAddress;
          sock: ^socketType; 


          (* PRIVATE
           * =======
           *)
          
          priv: @...;

       enter addr[]
       ...
       #);
     
     markAsDead:
       (# sock: ^socketType;
       enter sock[]
       ...
       #);
     
     removeSomeConnection:
       (* Removes least recently used currently unused connection *)
       (# noConnectionsRemovable:< object;
       ...
       #);
     
     close:< (# ... #);

     
     (* CALLBACKS
      * =========
      *)
     
     error:< hiErrCB(# do INNER #);

     
     (* PRIVATE
      * =======
      *)
     
     private: @...;
  #)


8.6 Commpool Interface
© 1994-2004 Mjølner Informatics
[Modified: Thursday August 6th 1998 at 13:55]