C# Class DBreeze.DataStructures.DataAsTree

Ierarchical DataStructure. Any node can have subnodes and own binary content
Show file Open project: hhblaze/DBreeze Class Usage Examples

Public Properties

Property Type Description
NodeContent byte[]
NodeId long
NodeName string
ParentNodeId long

Protected Properties

Property Type Description
ContentRef byte[]
DBreezeTableName string
RootNode DataAsTree
Transaction DBreeze.Transactions.Transaction
maximalInsertSpeed bool
nt2Read DBreeze.DataTypes.NestedTable
nt2Write DBreeze.DataTypes.NestedTable
nt3Read DBreeze.DataTypes.NestedTable
nt3Write DBreeze.DataTypes.NestedTable

Public Methods

Method Description
AddNode ( DataAsTree node ) : DataAsTree

Adding children to the node

Table, storing data structure, must be in tran.SynchronizeTables list. Then transaction must be Committed in the end by the programmer.

AddNodes ( IEnumerable nodes ) : void

Adding children to the node

Table, storing data structure, must be in tran.SynchronizeTables list. Then transaction must be Committed in the end by the programmer.

CheckTransaction ( ) : void

Internal

CopyInternals ( DataAsTree node ) : void

Internal

DataAsTree ( string DBreezeTableName, DBreeze tran, bool maximalInsertSpeed = false ) : System

Initializing Root Node

DataAsTree ( string name, byte content = null ) : System

Init nodes for insert under another node

GetChildren ( ) : IEnumerable

Reading all children nodes

GetContent ( ) : byte[]

GetContent of a node,

GetFirstLevelChildrenNodesByParentId ( long parentId ) : IEnumerable

Returns first level nodes by their parent. To go depper, for every returned node can be used ReadOutAllChildrenNodesFromCurrentRecursively

GetNodeByParentIdAndNodeId ( long parentNodeId, long nodeId ) : DataAsTree

Returns node by ParentIdAndNodeId

GetNodesByName ( string nameStartsWithPart ) : IEnumerable

Returns nodes with suppled StartsWith name or complete name

ReadOutAllChildrenNodesFromCurrentRecursively ( ) : IEnumerable

Recursively reads out all children nodes starting from this recursiverly

RemoveNode ( DataAsTree node ) : void

Removes node

RemoveNode ( long parentNodeId, long nodeId ) : void

Removes node

RemoveOldNodeFromNameIndex ( string oldNodeName, byte keyToRemove ) : void

Internal

SetupReadTables ( ) : void

Internal

SetupWriteTables ( ) : void

Internal

Protected Methods

Method Description
DataAsTree ( ) : System

Internal

Private Methods

Method Description
ReadOutNodes ( DataAsTree node ) : IEnumerable
SetupNodeFromRow ( byte[]>.DBreeze row ) : DataAsTree

Internal

SetupValueRowFromNode ( DataAsTree node, byte protocolVersion ) : byte[]

Internal

Method Details

AddNode() public method

Adding children to the node

Table, storing data structure, must be in tran.SynchronizeTables list. Then transaction must be Committed in the end by the programmer.
public AddNode ( DataAsTree node ) : DataAsTree
node DataAsTree
return DataAsTree

AddNodes() public method

Adding children to the node

Table, storing data structure, must be in tran.SynchronizeTables list. Then transaction must be Committed in the end by the programmer.
public AddNodes ( IEnumerable nodes ) : void
nodes IEnumerable Nodes to add to current node
return void

CheckTransaction() public method

Internal
public CheckTransaction ( ) : void
return void

CopyInternals() public method

Internal
public CopyInternals ( DataAsTree node ) : void
node DataAsTree
return void

DataAsTree() protected method

Internal
protected DataAsTree ( ) : System
return System

DataAsTree() public method

Initializing Root Node
public DataAsTree ( string DBreezeTableName, DBreeze tran, bool maximalInsertSpeed = false ) : System
DBreezeTableName string Real table name in DBreeze, that will hold the structure, must be synchronized with other tables in transaction
tran DBreeze
maximalInsertSpeed bool will use DBreeze Technical_SetTable_OverwriteIsNotAllowed among transaction for DBreezeTableName
return System

DataAsTree() public method

Init nodes for insert under another node
public DataAsTree ( string name, byte content = null ) : System
name string
content byte optionaly can supply NodeContent
return System

GetChildren() public method

Reading all children nodes
public GetChildren ( ) : IEnumerable
return IEnumerable

GetContent() public method

GetContent of a node,
public GetContent ( ) : byte[]
return byte[]

GetFirstLevelChildrenNodesByParentId() public method

Returns first level nodes by their parent. To go depper, for every returned node can be used ReadOutAllChildrenNodesFromCurrentRecursively
public GetFirstLevelChildrenNodesByParentId ( long parentId ) : IEnumerable
parentId long
return IEnumerable

GetNodeByParentIdAndNodeId() public method

Returns node by ParentIdAndNodeId
public GetNodeByParentIdAndNodeId ( long parentNodeId, long nodeId ) : DataAsTree
parentNodeId long
nodeId long
return DataAsTree

GetNodesByName() public method

Returns nodes with suppled StartsWith name or complete name
public GetNodesByName ( string nameStartsWithPart ) : IEnumerable
nameStartsWithPart string
return IEnumerable

ReadOutAllChildrenNodesFromCurrentRecursively() public method

Recursively reads out all children nodes starting from this recursiverly
public ReadOutAllChildrenNodesFromCurrentRecursively ( ) : IEnumerable
return IEnumerable

RemoveNode() public method

Removes node
public RemoveNode ( DataAsTree node ) : void
node DataAsTree
return void

RemoveNode() public method

Removes node
public RemoveNode ( long parentNodeId, long nodeId ) : void
parentNodeId long
nodeId long
return void

RemoveOldNodeFromNameIndex() public method

Internal
public RemoveOldNodeFromNameIndex ( string oldNodeName, byte keyToRemove ) : void
oldNodeName string
keyToRemove byte
return void

SetupReadTables() public method

Internal
public SetupReadTables ( ) : void
return void

SetupWriteTables() public method

Internal
public SetupWriteTables ( ) : void
return void

Property Details

ContentRef protected property

Internal. Holds reference to DataBlock representing Content. node.GetContent must be used to read out content.
protected byte[] ContentRef
return byte[]

DBreezeTableName protected property

Real table name in DBreeze, that will hold the structure
protected string DBreezeTableName
return string

NodeContent public property

This can be filled via constructor or extra when we insert a node
public byte[] NodeContent
return byte[]

NodeId public property

public long NodeId
return long

NodeName public property

Node name
public string NodeName
return string

ParentNodeId public property

public long ParentNodeId
return long

RootNode protected property

protected DataAsTree,DBreeze.DataStructures RootNode
return DataAsTree

Transaction protected property

protected DBreeze.Transactions.Transaction Transaction
return DBreeze.Transactions.Transaction

maximalInsertSpeed protected property

protected bool maximalInsertSpeed
return bool

nt2Read protected property

protected DBreeze.DataTypes.NestedTable nt2Read
return DBreeze.DataTypes.NestedTable

nt2Write protected property

protected DBreeze.DataTypes.NestedTable nt2Write
return DBreeze.DataTypes.NestedTable

nt3Read protected property

protected DBreeze.DataTypes.NestedTable nt3Read
return DBreeze.DataTypes.NestedTable

nt3Write protected property

protected DBreeze.DataTypes.NestedTable nt3Write
return DBreeze.DataTypes.NestedTable