From 0beb57d529c5a5434a6af3453aebf4b53585df70 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 30 May 2024 09:29:57 +0200 Subject: [PATCH] [EDF30057] : WIP --- src/Basics/KernelBasis.cxx | 33 +++++++++++++++++++++++++++++++++ src/Basics/KernelBasis.hxx | 1 + src/Basics/KernelBasis.i | 13 ++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/src/Basics/KernelBasis.cxx b/src/Basics/KernelBasis.cxx index c236f0020..c49036e7f 100644 --- a/src/Basics/KernelBasis.cxx +++ b/src/Basics/KernelBasis.cxx @@ -19,6 +19,8 @@ #include "KernelBasis.hxx" +#include + static bool DEFAULT_SSL_MODE = true; static bool GUI_MODE = false; @@ -153,12 +155,43 @@ void SALOME::SetBigObjOnDiskThreshold(int newThresholdInByte) SALOME_BIG_OBJ_ON_DISK_THRES = newThresholdInByte; } +enum class BigObjTransferProtocol : char +{ + SharedFileSystem = 0, + SSDCopyFileSystem = 1 +}; + +constexpr char SALOME_FILE_BIG_OBJ_DIR_SEP = '@'; + static std::string SALOME_FILE_BIG_OBJ_DIR; constexpr int DFT_SALOME_NB_RETRY = 1; static int SALOME_NB_RETRY = DFT_SALOME_NB_RETRY; +/*! + * This method returns the protocol of proxy transfert and the directory + */ +int SALOME::GetBigObjOnDiskProtocolAndDirectory(std::string& directory) +{ + if(SALOME_FILE_BIG_OBJ_DIR.size() < 3) + { + directory = SALOME_FILE_BIG_OBJ_DIR; + return static_cast( BigObjTransferProtocol::SharedFileSystem ); + } + std::string protocol = SALOME_FILE_BIG_OBJ_DIR.substr(0,3); + directory = SALOME_FILE_BIG_OBJ_DIR.substr(3); + if( protocol[0]!=SALOME_FILE_BIG_OBJ_DIR_SEP || protocol[2]!=SALOME_FILE_BIG_OBJ_DIR_SEP) + { + directory = SALOME_FILE_BIG_OBJ_DIR; + return static_cast( BigObjTransferProtocol::SharedFileSystem ); + } + std::istringstream iss(protocol.substr(1,1)); iss.exceptions(std::istringstream::failbit | std::istringstream::badbit); + char iproxyprot = 0; + iss >> iproxyprot; + return iproxyprot; +} + std::string SALOME::GetBigObjOnDiskDirectory() { return SALOME_FILE_BIG_OBJ_DIR; diff --git a/src/Basics/KernelBasis.hxx b/src/Basics/KernelBasis.hxx index d2a7bb222..d40a422b8 100644 --- a/src/Basics/KernelBasis.hxx +++ b/src/Basics/KernelBasis.hxx @@ -45,6 +45,7 @@ namespace SALOME PyExecutionMode BASICS_EXPORT GetPyExecutionMode(); int BASICS_EXPORT GetBigObjOnDiskThreshold(); void BASICS_EXPORT SetBigObjOnDiskThreshold(int newThresholdInByte); + int BASICS_EXPORT GetBigObjOnDiskProtocolAndDirectory(std::string& directory); std::string BASICS_EXPORT GetBigObjOnDiskDirectory(); void BASICS_EXPORT SetBigObjOnDiskDirectory(const std::string& directory); bool BASICS_EXPORT BigObjOnDiskDirectoryDefined(); diff --git a/src/Basics/KernelBasis.i b/src/Basics/KernelBasis.i index 6c5e8536f..70920c990 100644 --- a/src/Basics/KernelBasis.i +++ b/src/Basics/KernelBasis.i @@ -54,6 +54,7 @@ using namespace SALOME; %rename (GetBigObjOnDiskThreshold) GetBigObjOnDiskThresholdSwig; %rename (SetBigObjOnDiskThreshold) SetBigObjOnDiskThresholdSwig; %rename (GetBigObjOnDiskDirectory) GetBigObjOnDiskDirectorySwig; +%rename (GetBigObjOnDiskProtocolAndDirectory) GetBigObjOnDiskProtocolAndDirectorySwig; %rename (SetBigObjOnDiskDirectory) SetBigObjOnDiskDirectorySwig; %rename (BigObjOnDiskDirectoryDefined) BigObjOnDiskDirectoryDefinedSwig; %rename (SetNumberOfRetry) SetNumberOfRetrySwig; @@ -154,6 +155,16 @@ int GetNumberOfRetrySwig() return SALOME::GetNumberOfRetry( ); } +PyObject *GetBigObjOnDiskProtocolAndDirectorySwig() +{ + std::string directory; + int ret0 = SALOME::GetBigObjOnDiskProtocolAndDirectory(directory); + PyObject *ret(PyTuple_New(2)); + PyTuple_SetItem(ret,0,PyInt_FromLong(ret0)); + PyTuple_SetItem(ret,1,PyUnicode_FromString(directory.c_str())); + return ret; +} + void SetVerbosityLevelSwig(const std::string& level) { SetVerbosityLevelStr(level); @@ -184,4 +195,4 @@ std::vector GetAllPyExecutionModesSwig() def ReadFloatsInFile( fileName ): ret = ReadFloatsInFileSwig( fileName ) return ret -%} \ No newline at end of file +%} -- 2.39.2