NCBI C++ ToolKit
rmtfilestatus.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef __APP_SVIEWER___RMTFILESTATUS___HPP
2 #define __APP_SVIEWER___RMTFILESTATUS___HPP
3 
4 /* $Id: rmtfilestatus.hpp 41935 2018-11-15 18:19:14Z rudnev $
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  * Authors: Dmitry Rudnev
30  *
31  * File Description:
32  *
33  */
34 
35 #include <time.h>
37 
38 #include <gui/gui.hpp>
39 
41 
42 // this class is a black box that instructs the caller whether to try to access a remote file
43 // if access is done, it wants to know whether the access was successful or not
45 public:
47  ESuggestedAction_Access, ///< try to access the remote file
48  ESuggestedAction_Skip ///< do not access the file
49  };
50 
51  // gives suggested course of action for a given file
52  static ESuggestedAction Check(const string& sKey);
53 
54  // this must be called when accessibility of the file is known
55  static void Set(const string& sKey, ESuggestedAction KnownAccessibility);
56 
57 private:
58  typedef size_t TCounter;
59 
60  typedef time_t TTimeStamp; ///< in seconds
61  static unique_ptr<CNetICacheClient> m_pCacheClient;
62  static CNetICacheClient* x_Init();
63  static bool x_Read(CNetICacheClient* cache, const string& sNCKey, int version, const string& sSubKey, void* data, size_t data_size);
64  static void x_ResetSkipLimits(const string& sNCKey);
65 
66  // convert any string to a key that can be an NC blob key
67  static string x_KeyToNCKey(const string& sKey);
68  // going over this count will force an "Access"
70 
71  // max time intervals for checks
73 
74  // it was identified that cache is not available or not configured so it should not be used
75  // in this case, ESuggestedAction_Access will always be returned
77 };
78 
79 // get the timeout in seconds to run the remote pipleine scripts (rmt_*.sh)
81 public:
82  static time_t Get();
83 
84 private:
85  static time_t m_Timeout;
86 };
87 
88 
90 
91 #endif
Client to NetCache server (implements ICache interface)
time_t TTimeStamp
in seconds
static TTimeStamp m_MaxCheckInterval
@ ESuggestedAction_Access
try to access the remote file
static unique_ptr< CNetICacheClient > m_pCacheClient
static bool m_isStatusNotAvailable
static TCounter m_MaxCount
static time_t m_Timeout
char data[12]
Definition: iconv.c:80
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIUTILS_EXPORT
Definition: gui_export.h:518
static int version
Definition: mdb_load.c:29
const TYPE & Get(const CNamedParameterList *param)
void Check(const string &value)
NetCache ICache client specs.
Modified on Sun Apr 14 05:29:26 2024 by modify_doxy.py rev. 669887