00001 // Copyright (C) 2004, Kenneth C. Schalk 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 // ReposStatsSRPC.H - client API for getting statistics from the 00020 // repository 00021 00022 // Last modified on Sun Jan 9 13:53:13 EST 2005 by ken@xorian.net 00023 00024 #ifndef _REPOSSTATSSRPC_H 00025 #define _REPOSSTATSSRPC_H 1 00026 00027 #include <Sequence.H> 00028 #include <Table.H> 00029 #include <SRPC.H> 00030 #include "AccessControl.H" 00031 #include "ReposStats.H" 00032 00033 namespace ReposStats 00034 { 00035 // A key type for Table, used below 00036 struct StatKey 00037 { 00038 StatKind kind; 00039 StatKey() throw() : kind(invalid) { } 00040 StatKey(StatKind k) throw() : kind(k) { } 00041 00042 // methods required by "Table.H" 00043 Word Hash() const throw () { return (Word)kind; } 00044 StatKind& operator = (const StatKind& val) { return (kind = val); } 00045 bool operator == (const StatKey& other) throw () 00046 { return kind == other.kind; } 00047 }; 00048 00049 // Clients request statistics with a sequence of statistic types 00050 typedef Sequence<StatKind> StatsRequest; 00051 00052 // Clients receive results as a table of statistics 00053 typedef Table<StatKey, Stat*>::Default StatsResult; 00054 typedef Table<StatKey, Stat*>::Iterator StatsResultIter; 00055 00056 // Call to get statistics 00057 void getStats(/*OUT*/ StatsResult &result, 00058 const StatsRequest &request, 00059 AccessControl::Identity who =NULL, 00060 Text reposHost ="", 00061 Text reposPort ="") 00062 throw (SRPC::failure); 00063 00064 // Basic information about the server 00065 struct ServerInfo 00066 { 00067 // The software version of the server 00068 Text version; 00069 // The time that the server was started 00070 Basics::uint64 start_time; 00071 // The number of seconds the server has been running 00072 Basics::uint32 uptime; 00073 }; 00074 00075 // Call to get basic information about the server 00076 void getServerInfo(/*OUT*/ ServerInfo &result, 00077 AccessControl::Identity who =NULL, 00078 Text reposHost ="", 00079 Text reposPort ="") 00080 throw (SRPC::failure); 00081 } 00082 00083 #endif