C# Class DistributedFileSystem.DistributedItemData

Show file Open project: MarcFletcher/NetworkComms.Net

Private Properties

Property Type Description
BuildChunkCheckSums void
DistributedItemData NetworkCommsDotNet
InitialiseChunkPositionLengthDict void

Public Methods

Method Description
CopyTo ( Stream destinationStream ) : void

Copies data specified by start and length properties from internal stream to the provided stream.

Dispose ( bool forceDispose ) : void

Disposes the internal stream. If StreamTools.ThreadSafeStream.DiposeInnerStreamOnDispose is false, forceDispose must be true to dispose of the internal stream.

DistributedItemData ( DataBuildMode dataBuildMode, Stream>.Dictionary itemDataStreams, bool enableChunkChecksum = false ) : NetworkCommsDotNet

Initialise the item data using existing chunk streams. Build mode must be to blocks.

DistributedItemData ( ItemAssemblyConfig assemblyConfig ) : NetworkCommsDotNet

Initialise the item data from an assembly config

DistributedItemData ( string itemIdentifier, DataBuildMode dataBuildMode, Stream itemDataStream, bool enableChunkChecksum = false ) : NetworkCommsDotNet

Initialise the item data using an existing stream. If the build mode is to blocks the itemDataStream is broken into chunks.

GetChunkStream ( int chunkIndex ) : StreamTools.StreamSendWrapper

Return a StreamSendWrapper corresponding with the desired chunk

GetDataAsSingleStream ( ) : StreamTools.ThreadSafeStream

Get a single threadsafe stream containing all item data

MD5 ( ) : string

Return the MD5 of the whole item data

MD5 ( int chunkIndex ) : string

Return the MD5 of the specified chunk

SetData ( string itemIdentifier, Stream itemDataStream ) : void

Sets the item data using the provided data stream. Useful for setting data after deserialisation

ToArray ( ) : byte[]

Returns data for the entire item as byte[]

UpdateBuildTarget ( DataBuildMode newDataBuildMode ) : void

Updates the ItemBuildTarget

Write ( int chunkIndex, byte chunkData ) : void

Writes the provided buffer to the data starting at the provided position within the item data

Private Methods

Method Description
BuildChunkCheckSums ( ) : void

Uses the loaded stream and builds individual chunk checksums

DistributedItemData ( ) : NetworkCommsDotNet

Private constructor for deserialisation

InitialiseChunkPositionLengthDict ( ) : void

Calculates the corresponding chunk positions and lengths when this item is deserialised

Method Details

CopyTo() public method

Copies data specified by start and length properties from internal stream to the provided stream.
public CopyTo ( Stream destinationStream ) : void
destinationStream Stream The destination stream for the item data
return void

Dispose() public method

Disposes the internal stream. If StreamTools.ThreadSafeStream.DiposeInnerStreamOnDispose is false, forceDispose must be true to dispose of the internal stream.
public Dispose ( bool forceDispose ) : void
forceDispose bool If true the internal stream will be disposed regardless of value.
return void

DistributedItemData() public method

Initialise the item data using existing chunk streams. Build mode must be to blocks.
public DistributedItemData ( DataBuildMode dataBuildMode, Stream>.Dictionary itemDataStreams, bool enableChunkChecksum = false ) : NetworkCommsDotNet
dataBuildMode DataBuildMode
itemDataStreams Stream>.Dictionary
enableChunkChecksum bool
return NetworkCommsDotNet

DistributedItemData() public method

Initialise the item data from an assembly config
public DistributedItemData ( ItemAssemblyConfig assemblyConfig ) : NetworkCommsDotNet
assemblyConfig ItemAssemblyConfig
return NetworkCommsDotNet

DistributedItemData() public method

Initialise the item data using an existing stream. If the build mode is to blocks the itemDataStream is broken into chunks.
public DistributedItemData ( string itemIdentifier, DataBuildMode dataBuildMode, Stream itemDataStream, bool enableChunkChecksum = false ) : NetworkCommsDotNet
itemIdentifier string
dataBuildMode DataBuildMode
itemDataStream Stream
enableChunkChecksum bool
return NetworkCommsDotNet

GetChunkStream() public method

Return a StreamSendWrapper corresponding with the desired chunk
public GetChunkStream ( int chunkIndex ) : StreamTools.StreamSendWrapper
chunkIndex int
return NetworkCommsDotNet.Tools.StreamTools.StreamSendWrapper

GetDataAsSingleStream() public method

Get a single threadsafe stream containing all item data
public GetDataAsSingleStream ( ) : StreamTools.ThreadSafeStream
return NetworkCommsDotNet.Tools.StreamTools.ThreadSafeStream

MD5() public method

Return the MD5 of the whole item data
public MD5 ( ) : string
return string

MD5() public method

Return the MD5 of the specified chunk
public MD5 ( int chunkIndex ) : string
chunkIndex int
return string

SetData() public method

Sets the item data using the provided data stream. Useful for setting data after deserialisation
public SetData ( string itemIdentifier, Stream itemDataStream ) : void
itemIdentifier string
itemDataStream Stream
return void

ToArray() public method

Returns data for the entire item as byte[]
public ToArray ( ) : byte[]
return byte[]

UpdateBuildTarget() public method

Updates the ItemBuildTarget
public UpdateBuildTarget ( DataBuildMode newDataBuildMode ) : void
newDataBuildMode DataBuildMode The new DataBuildMode to use
return void

Write() public method

Writes the provided buffer to the data starting at the provided position within the item data
public Write ( int chunkIndex, byte chunkData ) : void
chunkIndex int
chunkData byte
return void