Exemplo n.º 1
0
        private void InitializeStorage()
        {
            lock (_syncRoot)
            {
                if (!_isStorageInitialized)
                {
                    _columnStorage = new ColumnStorage(_metadata, DirectoryPath,
                                                       _access, PartitionID, _memeorymMappedFileFactory);

                    _columns = _metadata.GetPartitionColumns(PartitionID, _columnStorage, _config).ToArray();

                    if (_metadata.TimestampColumnID.HasValue)
                    {
                        _timestampColumn =
                            (IFixedWidthColumn)_columns[_metadata.TimestampColumnID.Value].Column;
                    }

                    _fieldSerializer = _metadata.GetSerializer(_columns);
                    _txSupport       = new FileTxSupport(PartitionID, _columnStorage, _metadata, StartDate, EndDate);

                    Thread.MemoryBarrier();
                    _isStorageInitialized = true;
                }
            }
        }
Exemplo n.º 2
0
        public static long LongBinarySerach(IFixedWidthColumn column, long value, long index, long count)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Must be non negative");
            }
            if (count <= 0)
            {
                throw new ArgumentOutOfRangeException("count", "Must be non negative");
            }
            var lo = index;
            var hi = count - 1;

            while (lo <= hi)
            {
                long i = (hi - lo) / 2 + lo;
                long c = column.GetInt64(i) - value;
                if (c == 0)
                {
                    return(i);
                }

                if (c < 0)
                {
                    lo = i + 1;
                }
                else
                {
                    hi = i - 1;
                }
            }
            return(~lo);
        }
Exemplo n.º 3
0
 public FixedColumnNullableWrapper(IFixedWidthColumn column, int bitsetIndex)
 {
     _column      = column;
     _bitsetIndex = bitsetIndex;
 }