wrench::Block

class Block

A class that implements a “block” abstraction for memory management.

Public Functions

Block(Block *blk)

Constructor (that does a copy)

Parameters

blk – a block

Block(std::string fid, std::shared_ptr<FileLocation> location, double sz, double last_access, bool is_dirty, double dirty_time)

Constructor.

Parameters
  • fid – file id

  • location – file location

  • sz – file size in bytes

  • last_access – time of last access

  • is_dirty – dirty status

  • dirty_time – dirty time

double getDirtyTime() const

Get the block’s dirty time.

Returns

a date

std::string getFileId()

Get the file id.

Returns

the file id

double getLastAccess() const

Get the block’s last access time.

Returns

a date

const std::shared_ptr<FileLocation> &getLocation() const

Get the block’s location.

Returns

the block’s location

double getSize() const

Get the block’s size.

Returns

a size in bytes

bool isDirty() const

Get the block’s dirty status.

Returns

true or false

void setDirty(bool is_dirty)

Set the block’s dirty status.

Parameters

is_dirty – true or false

void setDirtyTime(double dirty_time)

Set the block’s dirty time.

Parameters

dirty_time – a date

void setFileId(std::string &fid)

Set the block’s file id.

Parameters

fid – a file id

void setLastAccess(double last_access)

Set the block’s last access time.

Parameters

last_access – a date

void setSize(double size)

Set the block’s size.

Parameters

size – a size in bytes

Block *split(double remaining)

Split a block.

Parameters

remaining – a number of bytes

Returns

: a pointer to a new block