コード例 #1
0
ファイル: BPTree.cs プロジェクト: valeriob/BPlusTreeStream
        public BPlusTree(Stream metadataStream, Stream indexStream, Stream dataStream, int order, int alignment, int cluster_data_length, IKey_Serializer <T> serializer)
        {
            Order               = order;
            Alignment           = alignment;
            Cluster_Data_Length = cluster_data_length;

            _key_Serializer = serializer;

            _node_Factory = new Node_Factory <T>(_key_Serializer, Order, Alignment, Cluster_Data_Length);
            _block_Size   = _node_Factory.Size_In_Bytes(Order);

            _data_Serializer = new Data_Serializer <T>(_key_Serializer, Alignment, 2, 1024);
            _pending_Changes = new Pending_Changes <T>(_block_Size, _index_Pointer, _data_Pointer, _node_Factory, _data_Serializer);


            Index_Stream    = indexStream;
            Data_Stream     = dataStream;
            Metadata_Stream = metadataStream;

            Cached_Nodes = new Dictionary <long, Node <T> >();
            _cache       = new Cache_LRU <long, Node <T> >(() => this.Current_Time);
            _metadata    = new Metadata {
                Order = Order
            };

            Init();
        }
コード例 #2
0
ファイル: BPTree.cs プロジェクト: valeriob/BPlusTreeStream
        public BPlusTree(Configuration <T> cfg)
        {
            Order               = cfg.BPTree_Order;
            Alignment           = cfg.Alignment;
            Cluster_Data_Length = cfg.Clustering_Data_Length;

            _key_Serializer = cfg.Key_Serializer;

            _node_Factory = new Node_Factory <T>(_key_Serializer, Order, Alignment, Cluster_Data_Length);
            _block_Size   = _node_Factory.Size_In_Bytes(Order);

            _data_Serializer = new Data_Serializer <T>(_key_Serializer, Alignment, 2, 1024);
            _pending_Changes = new Pending_Changes <T>(_block_Size, _index_Pointer, _data_Pointer, _node_Factory, _data_Serializer);

            _streamFactory = cfg.Stream_Factory;

            Index_Stream    = _streamFactory.Create_ReadWrite_Index_Stream();
            Data_Stream     = _streamFactory.Create_ReadWrite_Data_Stream();
            Metadata_Stream = _streamFactory.Create_ReadWrite_Metadata_Stream();

            Cached_Nodes = new Dictionary <long, Node <T> >();
            _cache       = new Cache_LRU <long, Node <T> >(() => this.Current_Time);
            _metadata    = new Metadata {
                Order = Order
            };

            Init();
        }