Package krati.core.array

Examples of krati.core.array.AddressArray


                                              int length,
                                              int batchSize,
                                              int numSyncBatches,
                                              boolean indexesCached) throws Exception {
        AddressArrayFactory factory = new AddressArrayFactory(indexesCached);
        AddressArray addrArray = factory.createStaticAddressArray(homeDir, length, batchSize, numSyncBatches);
        return addrArray;
    }
View Full Code Here


       
        // Check if the address array file can be found on disk
        boolean found = isAddressArrayFound(_config.getHomeDir());
       
        // Create dynamic address array
        AddressArray addrArray = createAddressArray(
                _config.getHomeDir(),
                _config.getBatchSize(),
                _config.getNumSyncBatches(),
                _config.getIndexesCached());
        _unitCapacity = DynamicConstants.SUB_ARRAY_SIZE;
       
        // Compute maxLevel
        LinearHashing h = new LinearHashing(_unitCapacity);
        h.reinit(Integer.MAX_VALUE);
        _maxLevel = h.getLevel();
       
        int initLevel = StoreParams.getDynamicStoreInitialLevel(_config.getInitialCapacity());
        if(initLevel > _maxLevel) {
            _log.warn("initLevel reset from " + initLevel + " to " + _maxLevel);
            initLevel = _maxLevel;
        }
       
        // Expand address array length upon first-time creation
        if(!found) {
            addrArray.expandCapacity((_unitCapacity << initLevel) - 1);
            _log.info("capacity initialized to " + addrArray.length());
        }
       
        // Create underlying segment manager
        String segmentHome = _homeDir.getCanonicalPath() + File.separator + "segs";
        SegmentManager segmentManager = SegmentManager.getInstance(
                segmentHome,
                _config.getSegmentFactory(),
                _config.getSegmentFileSizeMB());
       
        // Create underlying simple data array
        this._scn = addrArray.getHWMark();
        this._dataArray = new SimpleDataArray(addrArray, segmentManager, _config.getSegmentCompactFactor());
        this._hashFunction = _config.getHashFunction();
        this._loadThreshold = _config.getHashLoadFactor();
        this._loadCount = scan();
        this.initLinearHashing();
View Full Code Here

       
        // Check if the address array file can be found on disk
        boolean found = isAddressArrayFound(_config.getHomeDir());
       
        // Create dynamic address array
        AddressArray addrArray = createAddressArray(
                _config.getHomeDir(),
                _config.getBatchSize(),
                _config.getNumSyncBatches(),
                _config.getIndexesCached());
       
        // Expand address array length upon first-time creation
        if(!found) {
            addrArray.expandCapacity(initialCapacity - 1);
            _log.info("capacity initialized to " + addrArray.length());
        }
        _unitCapacity = DynamicConstants.SUB_ARRAY_SIZE;
       
        // Create underlying segment manager
        String segmentHome = _homeDir.getCanonicalPath() + File.separator + "segs";
        SegmentManager segmentManager = SegmentManager.getInstance(
                segmentHome,
                _config.getSegmentFactory(),
                _config.getSegmentFileSizeMB());
       
        // Create underlying simple data array
        this._scn = addrArray.getHWMark();
        this._dataArray = new SimpleDataArray(addrArray, segmentManager, _config.getSegmentCompactFactor());
        this._hashFunction = hashFunction;
        this._loadThreshold = hashLoadFactor;
        this._loadCount = scan();
        this.initLinearHashing();
View Full Code Here

    protected AddressArray createAddressArray(File homeDir,
                                              int batchSize,
                                              int numSyncBatches,
                                              boolean indexesCached) throws Exception {
        AddressArrayFactory factory = new AddressArrayFactory(indexesCached);
        AddressArray addrArray = factory.createDynamicAddressArray(homeDir, batchSize, numSyncBatches);
        return addrArray;
    }
View Full Code Here

        this._config = config;
        this._idCount = config.getPartitionCount();
        this._idStart = config.getPartitionStart();
        this._idEnd = config.getPartitionEnd();
       
        AddressArray addressArray = createAddressArray(
                _config.getHomeDir(),
                _idCount,
                _config.getBatchSize(),
                _config.getNumSyncBatches(),
                _config.isIndexesCached());
View Full Code Here

       
        this._idStart = _config.getPartitionStart();
        this._idCount = _config.getPartitionCount();
        this._idEnd = _config.getPartitionEnd();
       
        AddressArray addressArray = createAddressArray(
                _config.getHomeDir(),
                _idCount,
                _config.getBatchSize(),
                _config.getNumSyncBatches(),
                _config.isIndexesCached());
View Full Code Here

                                              int length,
                                              int batchSize,
                                              int numSyncBatches,
                                              boolean indexesCached) throws Exception {
        AddressArrayFactory factory = new AddressArrayFactory(indexesCached);
        AddressArray addrArray = factory.createStaticAddressArray(homeDir, length, batchSize, numSyncBatches);
       
        if(addrArray.length() != length) {
            throw new IOException("Capacity expected: " + addrArray.length() + " not " + length);
        }
       
        return addrArray;
    }
View Full Code Here

    private AddressArray createAddressArray(int length,
                                            int batchSize,
                                            int numSyncBatches,
                                            boolean indexesCached) throws Exception {
        AddressArrayFactory factory = new AddressArrayFactory(indexesCached);
        AddressArray addrArray = factory.createDynamicAddressArray(getHomeDir(), batchSize, numSyncBatches);
        addrArray.expandCapacity(length - 1);
        return addrArray;
    }
View Full Code Here

        for(Map.Entry<Integer, Long> e : map.entrySet()) {
            assertEquals(e.getValue().longValue(), _array.get(e.getKey()));
        }
       
        File homeDir = FileUtils.getTestDir(getClass().getSimpleName());
        AddressArray array2 = createAddressArray(homeDir);
       
        assertEquals(hwmMark, array2.getLWMark());
        assertEquals(hwmMark, array2.getHWMark());
       
        // Check newly opened array
        for(Map.Entry<Integer, Long> e : map.entrySet()) {
            assertEquals(e.getValue().longValue(), array2.get(e.getKey()));
        }
    }
View Full Code Here

        _array.open();

        assertEquals(endOfPeriod, _array.getLWMark());
        assertEquals(endOfPeriod, _array.getHWMark());
       
        AddressArray array2 = createAddressArray(getHomeDir());
        assertEquals(_array.getLWMark(), array2.getLWMark());
        assertEquals(_array.getHWMark(), array2.getHWMark());
    }
View Full Code Here

TOP

Related Classes of krati.core.array.AddressArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.