RDFS
The Rice Comp413 2017 class' continuation on the work of the 2016 RDFS.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
nativefs::NativeFS Class Reference

Public Member Functions

 NativeFS (std::string)
 
 ~NativeFS ()
 
bool writeBlock (uint64_t, const std::string &)
 
bool getBlock (uint64_t, std::string &)
 
bool hasBlock (uint64_t)
 
bool rmBlock (uint64_t)
 
uint64_t getTotalSpace ()
 
uint64_t getFreeSpace ()
 
std::vector< std::uint64_t > getKnownBlocks ()
 
bool fetchBlock (uint64_t, block_info &info)
 
bool extendBlock (uint64_t block_id, std::string block_data)
 

Constructor & Destructor Documentation

nativefs::NativeFS::NativeFS ( std::string  fname)
explicit

Construct a NativeFS backed by the given filename.

nativefs::NativeFS::~NativeFS ( )

Destroy NativeFS, free block array.

Member Function Documentation

bool nativefs::NativeFS::extendBlock ( uint64_t  block_id,
std::string  block_data 
)

Extends the current block and append the block data.

bool nativefs::NativeFS::fetchBlock ( uint64_t  id,
block_info info 
)

Attempt to fetch block info for block of given id, write to info reference. Return whether it exists.

Fetch block_info for an id. Assumes it has a lock on the block list.

bool nativefs::NativeFS::getBlock ( uint64_t  id,
std::string &  blk 
)

Get the contents of the block with given id. If successful, return true and set string reference to retreived contents. Otherwise return false.

Read the contents of given block id.

uint64_t nativefs::NativeFS::getFreeSpace ( )

Return an estimate of the remaining free space on this datanode.

std::vector< std::uint64_t > nativefs::NativeFS::getKnownBlocks ( )

For debugging, print the free block lists.

uint64_t nativefs::NativeFS::getTotalSpace ( )

Return the total capacity of this datanode.

bool nativefs::NativeFS::hasBlock ( uint64_t  id)

Return whether this instance of NativeFS knows about a block with given id.

Check existence of block with given id.

bool nativefs::NativeFS::rmBlock ( uint64_t  id)

Delete contents of provided block id from this datanode. Return true if delete successful, false otherwise (block id not found).

Given an ID, deletes a block. Returns false on id not found, true otherwise

bool nativefs::NativeFS::writeBlock ( uint64_t  id,
const std::string &  blk 
)

Write provided block contents to a block with given id. On success, return true. Otherwise false (e.g. no free space).

Given an ID, write the given block to the native filesystem. Returns true/false on success/failure.


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