Exemple #1
0
        private TCINFO GetTableContextInfo(NID[] nodePath)
        {
            var hnHeader = heapOnNodeReader.GetHeapOnNodeHeader(nodePath);

            var heapItem = heapOnNodeReader.GetHeapItem(nodePath, hnHeader.UserRoot);

            return(TCINFO.OfValue(heapItem));
        }
Exemple #2
0
        public Maybe <TableRow> GetRow(NID[] nodePath, int rowIndex)
        {
            var hnHeader = heapOnNodeReader.GetHeapOnNodeHeader(nodePath);

            var userRootHeapItem = heapOnNodeReader.GetHeapItem(nodePath, hnHeader.UserRoot);

            var tcInfo = TCINFO.OfValue(userRootHeapItem);

            var cebStartingOffset = tcInfo.GroupsOffsets[2];

            var rowLength = tcInfo.GroupsOffsets[3];

            var rowMatrixHnid = HNID.OfValue(tcInfo.RowMatrix);

            if (rowMatrixHnid.IsZero)
            {
                return(Maybe <TableRow> .NoValue());
            }

            if (rowMatrixHnid.IsHID)
            {
                var heapItem = heapOnNodeReader.GetHeapItem(nodePath, rowMatrixHnid.HID);

                var encodedRows = heapItem.Slice(rowLength);

                var rowValues = rowValuesExtractor.Extract(encodedRows[rowIndex], tcInfo.ColumnDescriptors, cebStartingOffset);

                return(Maybe <TableRow> .OfValue(new TableRow(rowValues)));
            }
            else
            {
                var numberOfRowsPerBlock = (8 * 1024 - 16) / rowLength;

                var blockIndex = rowIndex / numberOfRowsPerBlock;

                var childNodePath = new List <NID>(nodePath)
                {
                    rowMatrixHnid.NID
                };

                var dataBlock = dataTreeReader.Read(childNodePath.ToArray(), blockIndex)[0];

                var encodedRows = dataBlock.Slice(rowLength);

                var rowValues = rowValuesExtractor.Extract(encodedRows[rowIndex], tcInfo.ColumnDescriptors, cebStartingOffset);

                return(Maybe <TableRow> .OfValue(new TableRow(rowValues)));
            }
        }
Exemple #3
0
        public Maybe <DataRecord> ReadDataRecord(NID[] nodePath, TKey key)
        {
            var hnHeader = heapOnNodeReader.GetHeapOnNodeHeader(nodePath);

            return(ReadDataRecord(nodePath, hnHeader.UserRoot, key));
        }