Distributed File System 1
Distributed file system in C
Loading...
Searching...
No Matches
block.h File Reference
#include "uuid.h"

Go to the source code of this file.

Classes

struct  Block
 Associates a DNode's connection data with an INode's data and the data on disk at cid. More...

Macros

#define BLOCK_TABLE   "data/block.bin"

Functions

 DefList (Block) Buffer Block_serialize(Block block)
 Serialize a Block into a Buffer.
Block Block_deserialize (Buffer buffer)
 Deserialize a Buffer into a block.
Buffer ListBlock_serialize (ListBlock list)
 Serialize a List of Block's into a Buffer.
ListBlock ListBlock_deserialize (Buffer buf)
 Deserialize a Buffer into a List of Block's.
void insert_into_block (UUID *fid, UUID *nid, UUID *cid, size_t *seq)
 INSERT into the Block table.
ListBlock select_from_block (UUID *bid, UUID *fid, UUID *nid, UUID *cid, size_t *seq)
 SELECT from the Block table.
ListBlock Block_get_db (void)
 Get the Block table from the database.
void Block_set_db (ListBlock blocks)
 Write the database with the List of Block's.
void print_block (Block block)
 Print a Block's data as a tuple.

Macro Definition Documentation

◆ BLOCK_TABLE

#define BLOCK_TABLE   "data/block.bin"

Function Documentation

◆ Block_deserialize()

Block Block_deserialize ( Buffer buffer)

Deserialize a Buffer into a block.

Caller must free memory in Block.cid.

Parameters
bufferThe Buffer you want to deserialize
Returns
The Block that the Buffer represents

◆ Block_get_db()

ListBlock Block_get_db ( void )

Get the Block table from the database.

Returns
a List of Block's

◆ Block_set_db()

void Block_set_db ( ListBlock blocks)

Write the database with the List of Block's.

Parameters
blocksthe List of Block's that you want to overwrite the database with

◆ DefList()

DefList ( Block )

Serialize a Block into a Buffer.

Caller must free memory in Buffer.buf.

Parameters
blockthe Block you want to serialize
Returns
the Buffer that the Block represents

◆ insert_into_block()

void insert_into_block ( UUID * fid,
UUID * nid,
UUID * cid,
size_t * seq )

INSERT into the Block table.

Parameters
fidUUID of file's INode or NULL
nidUUID of DNode or NULL
cidstring representing Block's chunk ID or NULL

◆ ListBlock_deserialize()

ListBlock ListBlock_deserialize ( Buffer buf)

Deserialize a Buffer into a List of Block's.

Caller must free memory in Block.cid.

Parameters
bufferThe Buffer you want to deserialize
Returns
The List of Block's that the Buffer represents

◆ ListBlock_serialize()

Buffer ListBlock_serialize ( ListBlock list)

Serialize a List of Block's into a Buffer.

Caller must free memory in Buffer.buf.

Parameters
listthe List of Block's that you want to serialize
Returns
the Buffer that the ListBlock represents

◆ print_block()

void print_block ( Block block)

Print a Block's data as a tuple.

Parameters
blockthe Block to be printed

◆ select_from_block()

ListBlock select_from_block ( UUID * bid,
UUID * fid,
UUID * nid,
UUID * cid,
size_t * seq )

SELECT from the Block table.

Parameters
bidthe Block's UUID or NULL
fidthe Block's INode's file's UUID or NULL
nidthe Block's DNode's UUID or NULL
cidthe Block's chunk ID or NULL
Returns
a ListBlock of the possible matches