Namespace storage

namespace storage

Enums

enum OpenMode

Values:

enumerator CREATE
enumerator DIRECTORY
enumerator EXCL
enumerator TRUNC
enumerator NONE
enum ReadWriteType

Values:

enumerator READ_ONLY
enumerator READ_WRITE
enumerator WRITE_ONLY
enumerator NO_READ_WRITE
enumerator CUSTOM
enum FileState

Values:

enumerator NOT_CHECKED
enumerator NOT_EXISTS
enumerator EXISTS_DIR
enumerator EXISTS

Functions

std::string prependRuntimeRoot(const std::string &originalPath)
uint16_t errnoToWasi(int errnoIn)
OpenMode getOpenMode(uint16_t openFlags)
ReadWriteType getRwType(uint64_t rights)
FileLoader &getFileLoader()
FileLoader &getFileLoaderWithoutLocalCache()
void initFaasmS3()
void shutdownFaasmS3()
int32_t wasiFdFlagsToLinux(int32_t fdFlags)
static int removeAllInside(const std::filesystem::path &dir)
static void createDirectories(const std::filesystem::path &path)
static std::string trimLeadingSlashes(const std::string &pathIn)
static std::string getKey(const faabric::Message &msg, const std::string &filename)
static std::filesystem::path getDir(std::string baseDir, const faabric::Message &msg, bool create)
static const std::string getWamrAotKey(const faabric::Message &msg)
template<typename R>
R reqFactory(const std::string &bucket)
template<typename R>
R reqFactory(const std::string &bucket, const std::string &key)
std::shared_ptr<AWSCredentialsProvider> getCredentialsProvider()
ClientConfiguration getClientConf(long timeout)
int getReturnValueForSharedFileState(const std::string &sharedPath)

Variables

static Aws::SDKOptions options
static std::shared_mutex sharedFileMapMutex
static std::unordered_map<std::string, FileState> sharedFileMap
class DirEnt

Public Members

uint64_t next
uint8_t type
uint64_t ino
std::string path
class FileDescriptor

Public Functions

FileDescriptor() = default
DirEnt iterNext()
bool iterStarted() const
bool iterFinished()
void iterBack()
void iterReset()
size_t copyDirentsToWasiBuffer(uint8_t *buffer, size_t bufferLen)

Note that this function conforms to the standard readdir interface:

  • Copy each dirent struct followed by its path string

  • If the last path string doesn’t fit, return the buffer length

  • If the last dirent doesn’t fit, don’t copy it and return the buffer length

The external libc wrapper should prevent this third point.

If the final dirent or path doesn’t fit, the caller will expect the next result to contain that same dirent/ path, so we have to step back one in the iterator if that’s the case.

The caller knows they’ve reached the end when the buffer is not filled by this call.

Stat stat(const std::string &relativePath = "")
bool unlink(const std::string &relativePath = "")
bool rmdir(const std::string &relativePath = "")
bool rename(const std::string &newPath, const std::string &relativePath = "")
ssize_t readLink(const std::string &relativePath, char *buffer, size_t bufferLen)
bool pathOpen(uint32_t lookupFlags, uint32_t openFlags, int32_t fdFlags)
bool updateFlags(int32_t fdFlags)
ssize_t write(std::vector<::iovec> &nativeIovecs, int iovecCount)
void close() const
bool mkdir(const std::string &dirPath)
uint16_t seek(int64_t offset, int wasiWhence, uint64_t *newOffset) const
uint64_t tell() const
int getLinuxFd() const
int getLinuxFlags() const
int getLinuxErrno() const
uint16_t getWasiErrno() const
uint64_t getActualRightsBase() const
uint64_t getActualRightsInheriting() const
void setActualRights(uint64_t rights, uint64_t inheriting)
std::string absPath(const std::string &relativePath)
void setPath(const std::string &newPath)
std::string getPath()
int duplicate(const FileDescriptor &other)

Public Members

uint8_t wasiPreopenType

Public Static Functions

static FileDescriptor stdinFactory()
static FileDescriptor stdoutFactory()
static FileDescriptor stderrFactory()
class FileLoader

Public Functions

FileLoader()
FileLoader(bool useLocalFsCacheIn)
void clearLocalCache()
std::string getHashFilePath(const std::string &path)
std::string getFunctionFile(const faabric::Message &msg)
std::vector<uint8_t> loadFunctionWasm(const faabric::Message &msg)
void uploadFunction(faabric::Message &msg)
std::string getFunctionObjectFile(const faabric::Message &msg)
std::vector<uint8_t> loadFunctionObjectFile(const faabric::Message &msg)
std::vector<uint8_t> loadFunctionObjectHash(const faabric::Message &msg)
void uploadFunctionObjectFile(const faabric::Message &msg, const std::vector<uint8_t> &objBytes)
void uploadFunctionObjectHash(const faabric::Message &msg, const std::vector<uint8_t> &hash)
std::string getFunctionAotFile(const faabric::Message &msg)
std::vector<uint8_t> loadFunctionWamrAotFile(const faabric::Message &msg)
std::vector<uint8_t> loadFunctionWamrAotHash(const faabric::Message &msg)
void uploadFunctionWamrAotFile(const faabric::Message &msg, const std::vector<uint8_t> &objBytes)
void uploadFunctionWamrAotHash(const faabric::Message &msg, const std::vector<uint8_t> &hash)
std::string getEncryptedFunctionFile(const faabric::Message &msg)
std::string getFunctionSymbolsFile(const faabric::Message &msg)
std::vector<uint8_t> loadSharedObjectWasm(const std::string &path)
std::string getSharedObjectObjectFile(const std::string &realPath)
std::vector<uint8_t> loadSharedObjectObjectFile(const std::string &path)
std::vector<uint8_t> loadSharedObjectObjectHash(const std::string &path)
void uploadSharedObjectObjectFile(const std::string &path, const std::vector<uint8_t> &objBytes)
void uploadSharedObjectObjectHash(const std::string &path, const std::vector<uint8_t> &hash)
std::string getSharedFileFile(const std::string &path)
std::vector<uint8_t> loadSharedFile(const std::string &path)
void deleteSharedFile(const std::string &path)
void uploadSharedFile(const std::string &path, const std::vector<uint8_t> &fileBytes)
std::string getPythonFunctionSharedFilePath(const faabric::Message &msg)
std::string getPythonFunctionRelativePath(const faabric::Message &msg)
std::string getPythonFunctionFile(const faabric::Message &msg)
void uploadPythonFunction(faabric::Message &msg)
class FileSystem

Public Functions

void prepareFilesystem()
bool fileDescriptorExists(int fd)
storage::FileDescriptor &getFileDescriptor(int fd)
int openFileDescriptor(int rootFd, const std::string &path, uint64_t rightsBase, uint64_t rightsInheriting, uint32_t lookupFlags, uint32_t openFlags, int32_t fdFlags)
void createPreopenedFileDescriptor(int fd, const std::string &path)
int dup(int fd)
void tearDown()
std::string getPathForFd(int fd)
void printDebugInfo()
class S3Wrapper

Public Functions

S3Wrapper()
void createBucket(const std::string &bucketName)
void deleteBucket(const std::string &bucketName)
std::vector<std::string> listBuckets()
std::vector<std::string> listKeys(const std::string &bucketName)
void deleteKey(const std::string &bucketName, const std::string &keyName)
void addKeyBytes(const std::string &bucketName, const std::string &keyName, const std::vector<uint8_t> &data)
void addKeyStr(const std::string &bucketName, const std::string &keyName, const std::string &data)
std::vector<uint8_t> getKeyBytes(const std::string &bucketName, const std::string &keyName, bool tolerateMissing = false)
std::string getKeyStr(const std::string &bucketName, const std::string &keyName)
class SharedFileIsDirectoryException : public FaabricException

Public Functions

inline explicit SharedFileIsDirectoryException(const std::string &filePath)
class SharedFileNotExistsException : public FaabricException

Public Functions

inline explicit SharedFileNotExistsException(const std::string &filePath)
class SharedFiles

Public Static Functions

static int syncSharedFile(const std::string &sharedPath, const std::string &localPath = "")
static void clearCacheForSharedFile(const std::string &sharedPath)
static std::string realPathForSharedFile(const std::string &sharedPath)
static std::string stripSharedPrefix(const std::string &sharedPath)
static bool isPathShared(const std::string &p)
static void deleteSharedFile(const std::string &p)
static void updateSharedFile(const std::string &p)
static void syncPythonFunctionFile(const faabric::Message &msg)
static void clear()
class Stat

Public Members

bool failed
uint16_t wasiErrno
uint8_t wasiFiletype
uint64_t st_dev
uint64_t st_ino
uint64_t st_nlink
uint64_t st_size
uint32_t st_mode
uint64_t st_atim
uint64_t st_mtim
uint64_t st_ctim