A class that encodes a file location. More...

#include <FileLocation.h>

Public Member Functions

std::string getAbsolutePathAtMountPoint ()
 Get the location's path at mount point. More...
 
std::string getFullAbsolutePath ()
 Get the location's full absolute path. More...
 
std::string getMountPoint ()
 Get the location's mount point. More...
 
std::shared_ptr< StorageServicegetServerStorageService ()
 Get the location's server storage service. More...
 
std::shared_ptr< StorageServicegetStorageService ()
 Get the location's storage service. More...
 
std::string toString ()
 Give a <ss name>:<mount point>:<dir>" string for the location. More...
 

Static Public Member Functions

static bool equal (const std::shared_ptr< FileLocation > &lhs, const std::shared_ptr< FileLocation > &rhs)
 Method to compare two file locations. More...
 
static std::shared_ptr< FileLocationLOCATION (std::shared_ptr< StorageService > ss)
 File location specifier for a storage service's (single) mount point root. More...
 
static std::shared_ptr< FileLocationLOCATION (std::shared_ptr< StorageService > ss, std::shared_ptr< StorageService > server_ss)
 File location specifier for a storage service's (single) mount point root Used in case of NFS with page cache. More...
 
static std::shared_ptr< FileLocationLOCATION (std::shared_ptr< StorageService > ss, std::string absolute_path)
 File location specifier given an absolute path at a storage service. More...
 
static bool properPathPrefix (std::string path1, std::string path2)
 Helper method to find if a path is a proper prefix of another path. More...
 
static std::string sanitizePath (std::string path)
 Method to sanitize an absolute path (and make it absolute if it's not) More...
 

Static Public Attributes

static std::shared_ptr< FileLocationSCRATCH = std::shared_ptr<FileLocation>(new FileLocation(nullptr, "", ""))
 Static location that denotes a compute service's scratch space.
 

Detailed Description

A class that encodes a file location.

Member Function Documentation

◆ equal()

static bool wrench::FileLocation::equal ( const std::shared_ptr< FileLocation > &  lhs,
const std::shared_ptr< FileLocation > &  rhs 
)
inlinestatic

Method to compare two file locations.

Parameters
lhsa file location
rhsa file location
Returns
true if both locations are equivalent

◆ getAbsolutePathAtMountPoint()

std::string wrench::FileLocation::getAbsolutePathAtMountPoint ( )

Get the location's path at mount point.

Returns

◆ getFullAbsolutePath()

std::string wrench::FileLocation::getFullAbsolutePath ( )

Get the location's full absolute path.

Returns

◆ getMountPoint()

std::string wrench::FileLocation::getMountPoint ( )

Get the location's mount point.

Returns
a mount point

◆ getServerStorageService()

std::shared_ptr< StorageService > wrench::FileLocation::getServerStorageService ( )

Get the location's server storage service.

Returns
a storage service

◆ getStorageService()

std::shared_ptr< StorageService > wrench::FileLocation::getStorageService ( )

Get the location's storage service.

Returns
a storage service

◆ LOCATION() [1/3]

std::shared_ptr< FileLocation > wrench::FileLocation::LOCATION ( std::shared_ptr< StorageService ss)
static

File location specifier for a storage service's (single) mount point root.

Parameters
ssa storage service (that has a single mount point)
Returns
a file location specification
Exceptions
std::invalid_argument

◆ LOCATION() [2/3]

std::shared_ptr< FileLocation > wrench::FileLocation::LOCATION ( std::shared_ptr< StorageService ss,
std::shared_ptr< StorageService server_ss 
)
static

File location specifier for a storage service's (single) mount point root Used in case of NFS with page cache.

Parameters
ssstorage service on the client (whose the page cache that data is written to)
server_ssa server storage service in NFS that stores the file on disk
Returns
a file location specification
Exceptions
std::invalid_argument

◆ LOCATION() [3/3]

std::shared_ptr< FileLocation > wrench::FileLocation::LOCATION ( std::shared_ptr< StorageService ss,
std::string  absolute_path 
)
static

File location specifier given an absolute path at a storage service.

Parameters
ssa storage service or ComputeService::SCRATCH
absolute_pathan absolute path at the storage service to a directory (that may contain files)
Returns
a file location specification
Exceptions
std::invalid_argument

◆ properPathPrefix()

bool wrench::FileLocation::properPathPrefix ( std::string  path1,
std::string  path2 
)
static

Helper method to find if a path is a proper prefix of another path.

Parameters
path1a path
path2another path
Returns
true if one of the two paths is a proper prefix of the other

◆ sanitizePath()

std::string wrench::FileLocation::sanitizePath ( std::string  path)
static

Method to sanitize an absolute path (and make it absolute if it's not)

Parameters
pathan absolute path
Returns

◆ toString()

std::string wrench::FileLocation::toString ( )

Give a <ss name>:<mount point>:<dir>" string for the location.

Returns
A string

The documentation for this class was generated from the following files: