wrench::FileLocation

class wrench::FileLocation

A class that encodes a file location.

Public Functions

std::string getAbsolutePathAtMountPoint()

Get the location’s path at mount point.

Returns

std::string getFullAbsolutePath()

Get the location’s full absolute path.

Returns

std::string getMountPoint()

Get the location’s mount point.

Returns

a mount point

std::shared_ptr<StorageService> getServerStorageService()

Get the location’s server storage service.

Returns

a storage service

std::shared_ptr<StorageService> getStorageService()

Get the location’s storage service.

Returns

a storage service

std::string toString()

Give a <ss1 name>:<mount point>:<dir>” string for the location.

Returns

A string

Public Static Functions

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

Method to compare two file locations.

Parameters
  • lhs – a file location

  • rhs – a file location

Returns

true if both locations are equivalent

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

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

Parameters

ss – a storage service (that has a single mount point)

Throws

std::invalid_argument

Returns

a file location specification

static std::shared_ptr<FileLocation> LOCATION(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.

Parameters
  • ss – storage service on the client (whose the page cache that data is written to)

  • server_ss – a server storage service in NFS that stores the file on disk

Throws

std::invalid_argument

Returns

a file location specification

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

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

Parameters
  • ss – a storage service or ComputeService::SCRATCH

  • absolute_path – an absolute path at the storage service to a directory (that may contain files)

Throws

std::invalid_argument

Returns

a file location specification

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

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

Parameters
  • path1 – a path

  • path2 – another path

Returns

true if one of the two paths is a proper prefix of the other

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

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

Parameters

path – an absolute path

Returns

Public Static Attributes

static std::shared_ptr<FileLocation> SCRATCH = std::shared_ptr<FileLocation>(new FileLocation(nullptr, "", ""))

Static location that denotes a compute service’s scratch space.