Class AVLTreeRecordStore
- Namespace
- BelNytheraSeiche.TrieDictionary
- Assembly
- BelNytheraSeiche.TrieDictionary.dll
A concrete implementation of BinaryTreeRecordStore that uses a self-balancing AVL tree.
public sealed class AVLTreeRecordStore : BinaryTreeRecordStore, ICloneable
- Inheritance
-
AVLTreeRecordStore
- Implements
- Inherited Members
Remarks
This class provides efficient key-based record lookups, insertions, and deletions by maintaining the balance of the tree according to AVL rules, ensuring logarithmic time complexity for these operations.
Serialization Limits: The binary serialization format for this class imposes certain constraints on the data. Exceeding these limits will result in an InvalidDataException during serialization.
- Max Records per List: A single identifier can have a maximum of 16,777,215 records in its linked list.
- Max Record Content Size: The
Contentbyte array of any single record cannot exceed 65,535 bytes.
Methods
Clone()
Creates a deep copy of the AVLTreeRecordStore.
public object Clone()
Returns
- object
A new AVLTreeRecordStore instance with the same structure and record data as the original.
Remarks
The method creates a new tree and copies all records, ensuring that the new store is independent of the original.
Deserialize(Stream)
Deserializes an AVLTreeRecordStore from a stream.
public static AVLTreeRecordStore Deserialize(Stream stream)
Parameters
streamStreamThe stream to read the serialized data from.
Returns
- AVLTreeRecordStore
A new instance of AVLTreeRecordStore reconstructed from the stream.
Exceptions
- ArgumentNullException
streamis null.- InvalidDataException
The stream data is corrupted, in an unsupported format, or contains invalid values.
Remove(int)
Removes the node with the specified identifier from the tree, performing rebalancing rotations as necessary to maintain the tree's balance.
public override void Remove(int identifier)
Parameters
identifierintThe identifier of the node to remove.
Exceptions
- ArgumentOutOfRangeException
identifieris MinValue.
Serialize(AVLTreeRecordStore, Stream, SerializationOptions?)
Serializes the entire state of the tree store into a stream.
public static void Serialize(AVLTreeRecordStore store, Stream stream, BasicRecordStore.SerializationOptions? options = null)
Parameters
storeAVLTreeRecordStoreThe AVLTreeRecordStore instance to serialize.
streamStreamThe stream to write the serialized data to.
optionsBasicRecordStore.SerializationOptionsOptions to control the serialization process. If null, the settings from Default will be used.
Remarks
The serialization format is specific to this tree implementation, using Brotli compression and an XxHash32 checksum for data integrity.
Exceptions
- ArgumentNullException
storeorstreamis null.