Package org.apache.jackrabbit.oak.plugins.segment

Examples of org.apache.jackrabbit.oak.plugins.segment.SegmentId


        byte[] segment = new byte[len - 25];
        frame.getBytes(29, segment);
        Hasher hasher = Hashing.murmur3_32().newHasher();
        long check = hasher.putBytes(segment).hash().padToLong();
        if (hash == check) {
            SegmentId id = new SegmentId(store.getTracker(), msb, lsb);
            Segment s = new Segment(store.getTracker(), id,
                    ByteBuffer.wrap(segment));
            log.debug("received type {} with id {} and size {}", type, id,
                    s.size());
            return s;
View Full Code Here


    private int EXTRA_HEADERS_WO_SIZE = EXTRA_HEADERS_LEN - 4;

    @Override
    protected void encode(ChannelHandlerContext ctx, Segment s, ByteBuf out)
            throws Exception {
        SegmentId id = s.getSegmentId();
        ByteArrayOutputStream baos = new ByteArrayOutputStream(s.size());
        s.writeTo(baos);
        byte[] segment = baos.toByteArray();

        Hasher hasher = Hashing.murmur3_32().newHasher();
        long hash = hasher.putBytes(segment).hash().padToLong();

        int len = segment.length + EXTRA_HEADERS_WO_SIZE;
        out.writeInt(len);
        out.writeByte(Messages.HEADER_SEGMENT);
        out.writeLong(id.getMostSignificantBits());
        out.writeLong(id.getLeastSignificantBits());
        out.writeLong(hash);
        out.writeBytes(segment);
    }
View Full Code Here

        ids.offer(sid);
        int err = 0;
        Set<SegmentId> seen = new HashSet<SegmentId>();

        while (!ids.isEmpty()) {
            SegmentId id = ids.remove();
            if (!seen.contains(id) && !delegate.containsSegment(id)) {
                log.debug("trying to read segment " + id);
                Segment s = loader.readSegment(id.toString());
                if (s != null) {
                    log.debug("got segment " + id + " with size " + s.size());
                    ByteArrayOutputStream bout = new ByteArrayOutputStream(
                            s.size());
                    if (id.isDataSegmentId()) {
                        ids.addAll(s.getReferencedIds());
                    }
                    try {
                        s.writeTo(bout);
                        writeSegment(id, bout.toByteArray(), 0, s.size());
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.plugins.segment.SegmentId

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.