Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Segment Class Reference

This class contains information about a storage segment on disk. More...

#include <segment.h>

Collaboration diagram for Segment:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void init (unsigned first_block, unsigned index)
void alloc_buffers (Size segment_size_without_header)
void free_buffers ()
void print ()

Public Attributes

Segment_headerheader
void * buffer
unsigned first_block
unsigned curr_page_block
Size pages_count
unsigned index

Detailed Description

This class contains information about a storage segment on disk.

The disk is divided up into a series of fixed-size segments, and each segment contains several data pages. A Segment object in memory provides information about a single storage segment on disk. It contains a copy of the segment's header and a buffer containing its page data.


Member Function Documentation

void Segment::alloc_buffers Size  segment_size_without_header  ) 
 

Allocate the header and data buffers in memory for this segment.

void Segment::free_buffers  ) 
 

Free any buffers used by this segment.

void Segment::init unsigned  first_block,
unsigned  index
 

Initialize this segment in memory.

void Segment::print  ) 
 

Print basic information about this segment.


Member Data Documentation

void* Segment::buffer
 

contains the segment's page data

unsigned Segment::curr_page_block
 

disk block of current page

unsigned Segment::first_block
 

block number of segment on disk

Segment_header* Segment::header
 

copy of segment's metadata

unsigned Segment::index
 

0th segment is 0, 1st segment is 1

Size Segment::pages_count
 

number of pages stored in segment


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

Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman