Feel++ 0.111.0-preview.14
Finite Element Embedded Library in C++
Feel::RemoteData::Girder Class Reference
+ Collaboration diagram for Feel::RemoteData::Girder:

Public Member Functions

bool canDownload () const
 Return true if enough information is available to download a file.
 
bool canUpload () const
 Return true if enough information is available to upload data.
 
std::tuple< std::vector< std::shared_ptr< FolderInfo > >, std::vector< std::shared_ptr< ItemInfo > >, std::vector< std::shared_ptr< FileInfo > > > contents () const
 Get contents of remote data (folder, item, file) More...
 
std::tuple< std::vector< std::shared_ptr< FolderInfo > >, std::vector< std::shared_ptr< ItemInfo > >, std::vector< std::shared_ptr< FileInfo > > > contents (RemoteDataProgress &progress) const
 Get contents of remote data (folder, item, file) with progress reporting. More...
 
std::vector< std::pair< std::string, std::string > > createFolder (std::string const &folderPath, std::string const &parentId="", bool sync=true) const
 Create folders hierarchy on Girder. More...
 
std::vector< std::pair< std::string, std::string > > createItem (std::string const &itemPath, std::string const &parentId, bool sync=true) const
 Create item on remote storage. More...
 
bool deleteResource (const nl::json &resourceId, const std::string &token="") const
 Delete a resource by id. More...
 
std::vector< std::string > download (const std::string &dir, const std::string &path) const
 Download file/folder/item from the Girder desc. More...
 
std::vector< std::string > download (const std::string &dir, const std::string &path, int timeout) const
 Download file/folder/item from the Girder desc with timeout. More...
 
std::vector< std::string > download (std::string const &dir, int timeout) const
 Download file/folder from the Girder desc with timeout. More...
 
std::vector< std::string > download (std::string const &dir=Environment::downloadsRepository()) const
 Download file/folder from the Girder desc. More...
 
 Girder (Girder &&)=default
 
 Girder (Girder const &)=default
 
 Girder (std::string const &desc, WorldComm &worldComm=Environment::worldComm())
 Initialize from a description: girder:{url:https://girder.math.unistra.fr,file:5ac722e9b0e9574027047886,token:xxxxx} girder:{url:https://girder.math.unistra.fr,file:[5ac7253ab0e957402704788d,5ac722e9b0e9574027047886],token:xxxxx}.
 
bool isInit () const
 Return true if the Girder remote server is defined from a desc.
 
void replaceFile (std::string const &filePath, std::string const &fileId) const
 Replace contents of a file. More...
 
void replaceFile (std::vector< std::pair< std::string, std::string > > const &filesToReplace) const
 Replace contents of files. More...
 
nl::json resourceLookup (const std::string &path, const std::string &token, const RemoteDataProgress &progress) const
 Lookup a resource by path with progress reporting. More...
 
nl::json resourceLookup (const std::string &path, const std::string &token="") const
 Lookup a resource by path Lookup a resource by path with progress reporting. More...
 
void setFolderIds (std::string const &folderId)
 Set folder ids to only one folder id.
 
std::vector< std::string > upload (std::string const &dataPath, std::string const &parentId, bool sync, int timeout) const
 Upload data on Girder with timeout. More...
 
std::vector< std::string > upload (std::string const &dataPath, std::string const &parentId="", bool sync=true) const
 Upload data on Girder. More...
 
std::vector< std::vector< std::string > > upload (std::vector< std::pair< std::string, std::string > > const &dataToUpload, bool sync=true) const
 Upload data on Girder. More...
 

Member Function Documentation

◆ contents() [1/2]

std::tuple< std::vector< std::shared_ptr< Feel::RemoteData::FolderInfo > >, std::vector< std::shared_ptr< Feel::RemoteData::ItemInfo > >, std::vector< std::shared_ptr< Feel::RemoteData::FileInfo > > > Feel::RemoteData::Girder::contents ( ) const

Get contents of remote data (folder, item, file)

Returns
: (Folders info, Items info, Files info)

References Feel::RemoteData::contents(), and Feel::Environment::vm().

◆ contents() [2/2]

std::tuple< std::vector< std::shared_ptr< Feel::RemoteData::FolderInfo > >, std::vector< std::shared_ptr< Feel::RemoteData::ItemInfo > >, std::vector< std::shared_ptr< Feel::RemoteData::FileInfo > > > Feel::RemoteData::Girder::contents ( RemoteDataProgress &  progress) const

Get contents of remote data (folder, item, file) with progress reporting.

Parameters
progress: progress reporter for debug output
Returns
: (Folders info, Items info, Files info)

◆ createFolder()

std::vector< std::pair< std::string, std::string > > Feel::RemoteData::Girder::createFolder ( std::string const &  folderPath,
std::string const &  parentId = "",
bool  sync = true 
) const

Create folders hierarchy on Girder.

Parameters
folderPath: the folder hierarchy
parentId: id where folder is created, empty means to use folder id in the desc
sync: apply MPI synchronization with returned infos (else only master rank has these infos)
Returns
: vector of (subdir name, subdir id)

◆ createItem()

std::vector< std::pair< std::string, std::string > > Feel::RemoteData::Girder::createItem ( std::string const &  itemPath,
std::string const &  parentId,
bool  sync = true 
) const

Create item on remote storage.

Parameters
itemPath: the item
parentId: id where item is created, empty means to use folder id in the desc
sync: apply MPI synchronization with returned infos (else only master rank has these infos)

◆ deleteResource()

bool Feel::RemoteData::Girder::deleteResource ( const nl::json &  resourceId,
const std::string &  token = "" 
) const

◆ download() [1/4]

std::vector< std::string > Feel::RemoteData::Girder::download ( const std::string &  dir,
const std::string &  path 
) const

Download file/folder/item from the Girder desc.

Parameters
dir: the directory where the file is downloaded
path: the path of the file/folder/item
Returns
: vector of paths of the downloaded files or the path of downloaded folder

◆ download() [2/4]

std::vector< std::string > Feel::RemoteData::Girder::download ( const std::string &  dir,
const std::string &  path,
int  timeout 
) const

Download file/folder/item from the Girder desc with timeout.

Parameters
dir: the directory where the file is downloaded
path: the path of the file/folder/item
timeout: timeout in milliseconds for HTTP requests
Returns
: vector of paths of the downloaded files or the path of downloaded folder

◆ download() [3/4]

std::vector< std::string > Feel::RemoteData::Girder::download ( std::string const &  dir,
int  timeout 
) const

Download file/folder from the Girder desc with timeout.

Parameters
dir: the directory where the file is downloaded
timeout: timeout in milliseconds for HTTP requests
Returns
: vector of paths of the downloaded files or the path of downloaded folder

References Feel::RemoteData::download().

◆ download() [4/4]

std::vector< std::string > Feel::RemoteData::Girder::download ( std::string const &  dir = Environment::downloadsRepository()) const

Download file/folder from the Girder desc.

Parameters
dir: the directory where the file is downloaded
Returns
: vector of paths of the downloaded files or the path of downloaded folder

References download(), and Feel::Environment::vm().

Referenced by download().

◆ replaceFile() [1/2]

void Feel::RemoteData::Girder::replaceFile ( std::string const &  filePath,
std::string const &  fileId 
) const

Replace contents of a file.

Parameters
filePath: path of new file
fileId: id of the file to replace

References Feel::RemoteData::replaceFile().

◆ replaceFile() [2/2]

void Feel::RemoteData::Girder::replaceFile ( std::vector< std::pair< std::string, std::string > > const &  filesToReplace) const

Replace contents of files.

Parameters
filesToReplace: vector of (path of new file, file id to replace)

◆ resourceLookup() [1/2]

Feel::nl::json Feel::RemoteData::Girder::resourceLookup ( const std::string &  path,
const std::string &  token,
const RemoteDataProgress &  progress 
) const

Lookup a resource by path with progress reporting.

Parameters
path: the path to the resource in Girder
token: authentication token
progress: progress reporter for debug/verbose output
Returns
: JSON object containing resource information

◆ resourceLookup() [2/2]

Feel::nl::json Feel::RemoteData::Girder::resourceLookup ( const std::string &  path,
const std::string &  token = "" 
) const

Lookup a resource by path Lookup a resource by path with progress reporting.

Parameters
path: the path to the resource in Girder
token: authentication token
Returns
: JSON object containing resource information

◆ upload() [1/3]

std::vector< std::string > Feel::RemoteData::Girder::upload ( std::string const &  dataPath,
std::string const &  parentId,
bool  sync,
int  timeout 
) const

Upload data on Girder with timeout.

Parameters
dataPath: a path of a file or a folder
parentId: id where folder is created, empty means to use folder id in the desc
sync: apply MPI synchronization with returned infos (else only master rank has these infos)
timeout: timeout in milliseconds for HTTP requests
Returns
: vector of file ids uploaded

References Feel::RemoteData::upload().

◆ upload() [2/3]

std::vector< std::string > Feel::RemoteData::Girder::upload ( std::string const &  dataPath,
std::string const &  parentId = "",
bool  sync = true 
) const

Upload data on Girder.

Parameters
dataPath: a path of a file or a folder
parentId: id where folder is created, empty means to use folder id in the desc
sync: apply MPI synchronization with returned infos (else only master rank has these infos)
Returns
: vector of file ids uploaded

References Feel::RemoteData::upload().

◆ upload() [3/3]

std::vector< std::vector< std::string > > Feel::RemoteData::Girder::upload ( std::vector< std::pair< std::string, std::string > > const &  dataToUpload,
bool  sync = true 
) const

Upload data on Girder.

Parameters
dataToUpload: vector of (paths of a file or a folder, ids where folder is created, empty means to use folder id in the desc)
sync: apply MPI synchronization with returned infos (else only master rank has these infos)
Returns
: vector of vectors of file ids uploaded