15 #include "threads/CriticalSection.h"    28     std::string exportPath;
    29     std::chrono::time_point<std::chrono::steady_clock> refreshTime;
    31   typedef std::map<struct nfsfh  *, struct keepAliveStruct> tFileKeepAliveMap;
    35     struct nfs_context *pContext;
    36     std::chrono::time_point<std::chrono::steady_clock> lastAccessedTime;
    39   typedef std::map<std::string, struct contextTimeout> tOpenContextMap;
    43   bool Connect(
const CURL &url, std::string &relativePath);
    44   struct nfs_context *GetNfsContext() {
return m_pNfsContext;}
    45   uint64_t GetMaxReadChunkSize() {
return m_readChunkSize;}
    46   uint64_t GetMaxWriteChunkSize() {
return m_writeChunkSize;}
    47   std::list<std::string> GetExportList(
const CURL &url);
    50   bool splitUrlIntoExportAndPath(
const CURL& url, std::string &exportPath, std::string &relativePath, std::list<std::string> &exportList);
    51   bool splitUrlIntoExportAndPath(
const CURL& url, std::string &exportPath, std::string &relativePath);
    55   int stat(
const CURL& url, nfs_stat_64* statbuff);
    57   void AddActiveConnection();
    58   void AddIdleConnection();
    63   void resetKeepAlive(
const std::string& _exportPath, 
struct nfsfh* _pFileHandle);
    65   void removeFromKeepAliveList(
struct nfsfh  *_pFileHandle);
    67   const std::string& GetConnectedIp()
 const {
return m_resolvedHostName;}
    68   const std::string& GetConnectedExport()
 const {
return m_exportPath;}
    69   const std::string GetContextMapId()
 const {
return m_hostName + m_exportPath;}
    72   enum class ContextStatus
    79   struct nfs_context *m_pNfsContext;
    80   std::string m_exportPath;
    81   std::string m_hostName;
    82   std::string m_resolvedHostName;
    83   uint64_t m_readChunkSize = 0;
    84   uint64_t m_writeChunkSize = 0;
    85   int m_OpenConnections = 0; 
    86   std::chrono::time_point<std::chrono::steady_clock> m_IdleTimeout;
    87   tFileKeepAliveMap m_KeepAliveTimeouts;
    88   tOpenContextMap m_openContextMap;
    89   std::chrono::time_point<std::chrono::steady_clock>
    91   std::list<std::string> m_exportList;
    92   CCriticalSection keepAliveLock;
    93   CCriticalSection openContextLock;
    96   struct nfs_context *getContextFromMap(
const std::string &exportname, 
bool forceCacheHit = 
false);
    99   ContextStatus getContextForExport(
const std::string& exportname);
   100   void destroyOpenContexts();
   101   void destroyContext(
const std::string &exportName);
   102   void resolveHost(
const CURL &url);
   103   void keepAlive(
const std::string& _exportPath, 
struct nfsfh* _pFileHandle);
   104   static void setOptions(
struct nfs_context* context);
   116     void Close() 
override;
   117     int64_t Seek(int64_t iFilePosition, 
int iWhence = SEEK_SET) 
override;
   118     ssize_t Read(
void* lpBuf, 
size_t uiBufSize) 
override;
   119     bool Open(
const CURL& url) 
override;
   120     bool Exists(
const CURL& url) 
override;
   121     int Stat(
const CURL& url, 
struct __stat64* buffer) 
override;
   122     int Stat(
struct __stat64* buffer) 
override;
   123     int64_t GetLength() 
override;
   124     int64_t GetPosition() 
override;
   125     ssize_t Write(
const void* lpBuf, 
size_t uiBufSize) 
override;
   126     int Truncate(int64_t iSize) 
override;
   130     int IoControl(EIoControl request, 
void* param)
 override   132       return request == IOCTRL_SEEK_POSSIBLE ? 1 : -1;
   134     int GetChunkSize()
 override {
return static_cast<int>(gNfsConnection.GetMaxReadChunkSize());}
   136     bool OpenForWrite(
const CURL& url, 
bool bOverWrite = 
false) 
override;
   137     bool Delete(
const CURL& url) 
override;
   138     bool Rename(
const CURL& url, 
const CURL& urlnew) 
override;
   141     bool IsValidFile(
const std::string& strFileName);
   142     int64_t m_fileSize = 0;
   143     struct nfsfh *m_pFileHandle;
   144     struct nfs_context *m_pNfsContext;
   145     std::string m_exportPath;
 
Definition: NFSFile.h:111