[BACK]Return to MxClient.h CVS log [TXT][DIR] Up to [Development] / fam / fam

Annotation of fam/fam/MxClient.h, Revision 1.1.1.1

1.1       trev        1: //  Copyright (C) 1999 Silicon Graphics, Inc.  All Rights Reserved.
                      2: //
                      3: //  This program is free software; you can redistribute it and/or modify it
                      4: //  under the terms of version 2 of the GNU General Public License as
                      5: //  published by the Free Software Foundation.
                      6: //
                      7: //  This program is distributed in the hope that it would be useful, but
                      8: //  WITHOUT ANY WARRANTY; without even the implied warranty of
                      9: //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  Further, any
                     10: //  license provided herein, whether implied or otherwise, is limited to
                     11: //  this program in accordance with the express provisions of the GNU
                     12: //  General Public License.  Patent licenses, if any, provided herein do not
                     13: //  apply to combinations of this program with other product or programs, or
                     14: //  any other product whatsoever.  This program is distributed without any
                     15: //  warranty that the program is delivered free of the rightful claim of any
                     16: //  third person by way of infringement or the like.  See the GNU General
                     17: //  Public License for more details.
                     18: //
                     19: //  You should have received a copy of the GNU General Public License along
                     20: //  with this program; if not, write the Free Software Foundation, Inc., 59
                     21: //  Temple Place - Suite 330, Boston MA 02111-1307, USA.
                     22:
                     23: #ifndef MxClient_included
                     24: #define MxClient_included
                     25:
                     26: #include "Client.h"
                     27: #include "RequestMap.h"
                     28:
                     29: class ClientInterest;
                     30:
                     31: //  MxClient is a multiplexed client (one with more than one request
                     32: //  outstanding).  It an an abstract base type whose most famous
                     33: //  derived class is TCP_Client.
                     34: //
                     35: //  An MxClient maps Requests to ClientInterests.  It also implements
                     36: //  (part of) the suspend/resume protocol.
                     37: //
                     38: //  In a glorious spasm of overengineering, I implemented the table of
                     39: //  requests as an in-core B-Tree.  Why?  Because a B-Tree scales
                     40: //  really well and because it has good locality of reference.
                     41:
                     42: class MxClient : public Client {
                     43:
                     44: protected:
                     45:
                     46:     MxClient(in_addr host);
                     47:     ~MxClient();
                     48:
                     49:     void monitor_file(Request, const char *path, const Cred&);
                     50:     void monitor_dir(Request, const char *path, const Cred&);
                     51:     void cancel(Request);
                     52:     void suspend(Request);
                     53:     void resume(Request);
                     54:
                     55: private:
                     56:
                     57:     RequestMap requests;
                     58:
                     59:     ClientInterest *interest(Request);
                     60:     bool check_new(Request, const char *path);
                     61:
                     62: };
                     63:
                     64: #endif /* !MxClient_included */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>