Naanou.ResourceExchange
Class Block

A segment of a resource that has been downloaded or is currently being downloaded

Field Summary
int accesses
Naanou.ResourceExchange.DownloaderQueue downloaders
         Queue of string addresses
long End
         End byte (0-based)
bool expired
string Filename
         Absolute filename for block
string Hash
         Content hash for file block belongs too
bool incomplete
long Length
         File length of original file if known (less than 0 if not)
bool requiredLocally
long Start
         Start byte number (0-based)

Constructor Summary
Block(long start, long end, long length, string hash, string filename)
         Constructor

Property Summary
int Accesses
         Gets the number of accesses this block has had
string Downloaders
         Gets a space-delimited list of recent downloaders
bool Incomplete
         Gets or sets whether block is still being written to
bool IsExpired
         Has block been expired by block storage system?
bool OnDisk
         Checks block is on disk
bool RequiredLocally
         Gets or sets whether block is still required locally, and should not be deleted

Method Summary
void AddDownloader(string address)
         Adds a downloader in id|url form
long GetLength()
         Gets the number of bytes represented by this block (does not check file size)
void IncrementAccesses()
         Increments the accesses counter
void Retire()
         Retires block from 'in use' queue, and puts them in the general block pool
void SetExpired(bool expired)
void SetIncomplete(bool val)
void SetRequiredLocally(bool required)
         Sets whether this block is required locally. This manual override is used by the GC cleaning up incomplete blocks.

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

accesses

private int accesses


downloaders

private Naanou.ResourceExchange.DownloaderQueue downloaders

Queue of string addresses


End

internal long End

End byte (0-based)


expired

private bool expired


Filename

internal string Filename

Absolute filename for block


Hash

internal string Hash

Content hash for file block belongs too


incomplete

private bool incomplete


Length

internal long Length

File length of original file if known (less than 0 if not)


requiredLocally

private bool requiredLocally


Start

internal long Start

Start byte number (0-based)

Constructor Detail

Block

internal Block(long start,
               long end,
               long length,
               string hash,
               string filename)

Constructor

Parameters:
start - Start range
end - End range
hash - Parent file hash
filename - Absolute filename to store block at
length - File length (or -1 if unknown)
Property Detail

Accesses

internal int Accesses

Gets the number of accesses this block has had


Downloaders

internal string Downloaders

Gets a space-delimited list of recent downloaders


Incomplete

internal bool Incomplete

Gets or sets whether block is still being written to


IsExpired

internal bool IsExpired

Has block been expired by block storage system?


OnDisk

internal bool OnDisk

Checks block is on disk


RequiredLocally

internal bool RequiredLocally

Gets or sets whether block is still required locally, and should not be deleted

Method Detail

AddDownloader

internal void AddDownloader(string address)

Adds a downloader in id|url form

Parameters:
address -

GetLength

internal long GetLength()

Gets the number of bytes represented by this block (does not check file size)

Returns:

IncrementAccesses

internal void IncrementAccesses()

Increments the accesses counter


Retire

internal void Retire()

Retires block from 'in use' queue, and puts them in the general block pool


SetExpired

internal void SetExpired(bool expired)


SetIncomplete

internal void SetIncomplete(bool val)


SetRequiredLocally

internal void SetRequiredLocally(bool required)

Sets whether this block is required locally. This manual override is used by the GC cleaning up incomplete blocks.

Parameters:
required -