C# Class DistributedFileSystem.ChunkFlags

Show file Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Public Methods

Method Description
AllFlagsSet ( byte uptoChunkIndexInclusive ) : bool

Returns true if all bit flags up to the provided uptoChunkIndexInclusive are set to true

ChunkFlags ( byte intialState ) : System

Initialises the ChunkFlags. The initial state is typically 0 or totalNumChunks

ClearAllFlags ( ) : void

Sets all chunk flags to unset.

FlagSet ( byte chunkIndex ) : bool

Returns true if the provided chunk is available. Zero indexed from least significant bit.

NumCompletedChunks ( ) : byte

Returns the number of completed chunk

SetFlag ( byte chunkIndex, bool state = true ) : void

Sets the bit flag to 1 which corresponds with the provided chunk index. Zero indexed from least significant bit.

UpdateFlags ( ChunkFlags latestChunkFlags ) : void

Updates local chunk flags with those provided.

Private Methods

Method Description
ChunkFlags ( ) : System

Method Details

AllFlagsSet() public method

Returns true if all bit flags up to the provided uptoChunkIndexInclusive are set to true
public AllFlagsSet ( byte uptoChunkIndexInclusive ) : bool
uptoChunkIndexInclusive byte The chunk index up to which the flags should be checked
return bool

ChunkFlags() public method

Initialises the ChunkFlags. The initial state is typically 0 or totalNumChunks
public ChunkFlags ( byte intialState ) : System
intialState byte The initial state of the ChunkFlags
return System

ClearAllFlags() public method

Sets all chunk flags to unset.
public ClearAllFlags ( ) : void
return void

FlagSet() public method

Returns true if the provided chunk is available. Zero indexed from least significant bit.
public FlagSet ( byte chunkIndex ) : bool
chunkIndex byte The chunk index flag to check
return bool

NumCompletedChunks() public method

Returns the number of completed chunk
public NumCompletedChunks ( ) : byte
return byte

SetFlag() public method

Sets the bit flag to 1 which corresponds with the provided chunk index. Zero indexed from least significant bit.
public SetFlag ( byte chunkIndex, bool state = true ) : void
chunkIndex byte The chunk index to set
state bool The state of the flag
return void

UpdateFlags() public method

Updates local chunk flags with those provided.
public UpdateFlags ( ChunkFlags latestChunkFlags ) : void
latestChunkFlags ChunkFlags The new chunk flags
return void