Package krati.core.segment

Examples of krati.core.segment.SegmentManager


    addrArray = addressArrayFactory.createDynamicAddressArray(homeDirectory, batchSize, numSyncBatches);
    addrArray.expandCapacity(length - 1);

    // Create segment manager
    String segmentHome = this.homePath + File.separator + "segs";
    SegmentManager segmentManager = SegmentManager.getInstance(segmentHome,
                                                               segmentFactory,
                                                               segmentFileSizeMB);

    // Create data array
    this.dataArray = new SimpleDataArray(addrArray, segmentManager, segmentCompactFactor);
View Full Code Here


            _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
View Full Code Here

       
        _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
View Full Code Here

   
    /**
     * Flushes accumulated segment index buffers to disk.
     */
    private void flushSegmentIndexBuffers() {
        SegmentManager segManager = _dataArray.getSegmentManager();
        if(segManager != null) {
            segManager.flushSegmentIndexBuffers();
        }
    }
View Full Code Here

   
    /**
     * Frees segments that were compacted successfully.
     */
    private void freeCompactedSegments() {
        SegmentManager segManager = _dataArray.getSegmentManager();
        if(segManager == null) return;
       
        while(!_freeQueue.isEmpty()) {
            Segment seg = _freeQueue.remove();
            try {
                segManager.freeSegment(seg);
            } catch(Exception e) {
                _log.error("failed to free Segment " + seg.getSegmentId() + ": " + seg.getStatus(), e);
            }
        }
    }
View Full Code Here

     * </p>
     *
     * @return <code>true</code> is at least one Segment is found to be eligible for compaction.
     */
    private boolean inspect() {
        SegmentManager segManager = _dataArray.getSegmentManager();
        if(segManager == null) return false;
       
        synchronized(segManager) {
            Segment segCurrent = _dataArray.getCurrentSegment();
           
            /*
             * Find source segments that are least loaded.
             * The source segments must be in the READ_ONLY mode.
             */
            ArrayList<Segment> recycleList = new ArrayList<Segment>();
            int cnt = segManager.getSegmentCount();
            for(int i = 0; i < cnt; i++) {
                Segment seg = segManager.getSegment(i);
                if(seg != null && seg.getMode() == Segment.Mode.READ_ONLY && seg != segCurrent) {
                    if (seg.getLoadFactor() < _compactLoadFactor && !_ignoredSegs.contains(seg)) {
                        recycleList.add(seg);
                    }
                }
View Full Code Here

            throw new IOException("Capacity expected: " + addressArray.length() + " not " + _config.getInitialCapacity());
        }
       
        // Create segment manager
        String segmentHome = _homeDir.getCanonicalPath() + File.separator + "segs";
        SegmentManager segmentManager = SegmentManager.getInstance(
                segmentHome,
                _config.getSegmentFactory(),
                _config.getSegmentFileSizeMB());
       
        this._scn = addressArray.getHWMark();
View Full Code Here

            throw new IOException("Capacity expected: " + addressArray.length() + " not " + capacity);
        }
       
        // Create segment manager
        String segmentHome = _homeDir.getCanonicalPath() + File.separator + "segs";
        SegmentManager segmentManager = SegmentManager.getInstance(
                segmentHome,
                _config.getSegmentFactory(),
                _config.getSegmentFileSizeMB());
       
        this._scn = addressArray.getHWMark();
View Full Code Here

            throw new IOException("Capacity expected: " + addressArray.length() + " not " + _config.getInitialCapacity());
        }
       
        // Create segment manager
        String segmentHome = _homeDir.getCanonicalPath() + File.separator + "segs";
        SegmentManager segmentManager = SegmentManager.getInstance(
                segmentHome,
                _config.getSegmentFactory(),
                _config.getSegmentFileSizeMB());
       
        this._scn = addressArray.getHWMark();
View Full Code Here

            throw new IOException("Capacity expected: " + addressArray.length() + " not " + capacity);
        }
       
        // Create segment manager
        String segmentHome = _homeDir.getCanonicalPath() + File.separator + "segs";
        SegmentManager segmentManager = SegmentManager.getInstance(
                segmentHome,
                _config.getSegmentFactory(),
                _config.getSegmentFileSizeMB());
       
        this._scn = addressArray.getHWMark();
View Full Code Here

TOP

Related Classes of krati.core.segment.SegmentManager

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.