NCBI C Toolkit Cross Reference

C/connect/ncbi_lbsmd.h


  1 #ifndef CONNECT___NCBI_LBSMD__H
  2 #define CONNECT___NCBI_LBSMD__H
  3 
  4 /* $Id: ncbi_lbsmd.h,v 6.21 2009/02/03 16:39:35 kazimird Exp $
  5  * ===========================================================================
  6  *
  7  *                            PUBLIC DOMAIN NOTICE
  8  *               National Center for Biotechnology Information
  9  *
 10  *  This software/database is a "United States Government Work" under the
 11  *  terms of the United States Copyright Act.  It was written as part of
 12  *  the author's official duties as a United States Government employee and
 13  *  thus cannot be copyrighted.  This software/database is freely available
 14  *  to the public for use. The National Library of Medicine and the U.S.
 15  *  Government have not placed any restriction on its use or reproduction.
 16  *
 17  *  Although all reasonable efforts have been taken to ensure the accuracy
 18  *  and reliability of the software and data, the NLM and the U.S.
 19  *  Government do not and cannot warrant the performance or results that
 20  *  may be obtained by using this software or data. The NLM and the U.S.
 21  *  Government disclaim all warranties, express or implied, including
 22  *  warranties of performance, merchantability or fitness for any particular
 23  *  purpose.
 24  *
 25  *  Please cite the author in any work or product based on this material.
 26  *
 27  * ===========================================================================
 28  *
 29  * Author:  Anton Lavrentiev
 30  *
 31  * File Description:
 32  *   Low-level API to resolve NCBI service name to server meta-address
 33  *   with the use of NCBI Load-Balancing Service Mapper (LBSMD).
 34  *
 35  */
 36 
 37 #include "ncbi_servicep.h"
 38 #include <connect/ncbi_heapmgr.h>
 39 
 40 
 41 #ifdef __cplusplus
 42 extern "C" {
 43 #endif
 44 
 45 
 46 const SSERV_VTable* SERV_LBSMD_Open(SERV_ITER    iter,
 47                                     SSERV_Info** info,
 48                                     HOST_INFO*   host_info,
 49                                     int/*bool*/  no_dispd);
 50 
 51 
 52 /* Get configuration file name. Returned '\0'-terminated string
 53  * is to be free()'d by a caller when no longer needed.
 54  * Return NULL if no configuration file name is available.
 55  * LBSMD_FastHeapAccess() was set to "eOff" and there is a cached copy
 56  * of LBSM heap kept in-core, it will be released by this call.
 57  */
 58 extern NCBI_XCONNECT_EXPORT const char* LBSMD_GetConfig(void);
 59 
 60 
 61 /* Get (perhaps cached) copy of LBSM heap, which is guaranteed to be
 62  * current for given the time "time".  If "time" passed as 0, the heap
 63  * (if present as shmem) will be returned regardless of its freshness.
 64  * Return NULL if the copy operation cannot be performed (due to various
 65  * reasons, including the original LBSM shmem to be stale).
 66  * Returned heap (if non-NULL) has a serial number reflecting which
 67  * shmem segment has been used to get the snapshot.  The serial number
 68  * is negated for newer heap structure, which has dedicated version
 69  * entry format.  Older heap structure uses SLBSM_OldEntry instead,
 70  * and has TTLs for entries instead of expiration times.  The returned
 71  * copy must be passed to (MT-locked by the caller) HEAP_Destroy() when
 72  * no longer needed.
 73  * The copy may be cached in-core, the only way to release it is to
 74  * call LBSMD_GetConfig() provided that LBSM_FastHeapAccess() has
 75  * been set to "eOff" (which is the default setting).
 76  */
 77 extern NCBI_XCONNECT_EXPORT HEAP LBSMD_GetHeapCopy(TNCBI_Time time);
 78 
 79 
 80 /* Get a value of a host parameter from the LBSMD host environment.
 81  * Return 0 if none found;  return heap-allocated string otherwise
 82  * (the caller is responsible for calling free() when no longer needing it).
 83  * Argument "host" can be either an IP address of the host to inquire about,
 84  * or SERV_LOCALHOST(or 0) to get the information as defined for the current
 85  * (local) host.
 86  */
 87 extern NCBI_XCONNECT_EXPORT const char* LBSMD_GetHostParameter
 88 (unsigned int addr,
 89  const char*  name);
 90 
 91 
 92 extern NCBI_XCONNECT_EXPORT ESwitch LBSMD_FastHeapAccess(ESwitch onoff);
 93 
 94 
 95 int LBSM_HINFO_CpuCount(const HOST_INFO hinfo);
 96 
 97 
 98 int LBSM_HINFO_CpuUnits(const HOST_INFO hinfo);
 99 
100 
101 double LBSM_HINFO_CpuClock(const HOST_INFO hinfo);
102 
103 
104 int LBSM_HINFO_TaskCount(const HOST_INFO hinfo);
105 
106 
107 int/*bool*/ LBSM_HINFO_Memusage(const HOST_INFO hinfo, double memusage[5]);
108 
109 
110 int/*bool*/ LBSM_HINFO_MachineParams(const HOST_INFO hinfo, SHINFO_Params* p);
111 
112 
113 int/*bool*/ LBSM_HINFO_LoadAverage(const HOST_INFO hinfo, double lavg[2]);
114 
115 
116 int/*bool*/ LBSM_HINFO_Status(const HOST_INFO hinfo, double status[2]);
117 
118 
119 #ifdef __cplusplus
120 }  /* extern "C" */
121 #endif
122 
123 #endif /* CONNECT___NCBI_LBSMD__H */
124 

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.