Examples of PureJavaCrc32


Examples of com.alimama.mdrill.editlog.util.PureJavaCrc32

    private final DataOutputBuffer buf;
    private final Checksum checksum;

    public Writer(DataOutputBuffer out) {
      this.buf = out;
      this.checksum = new PureJavaCrc32();
    }
View Full Code Here

Examples of com.alimama.mdrill.editlog.util.PureJavaCrc32

    private final OpInstanceCache cache;
    private int maxOpSize;

    public Reader(DataInputStream in,int logVersion,int maxOpSize) {
      this.logVersion = logVersion;
      this.checksum = new PureJavaCrc32();
      this.in = new DataInputStream(new CheckedInputStream(in, this.checksum));
      this.cache = new OpInstanceCache();
      this.maxOpSize = maxOpSize;
    }
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

        this.futures = new ArrayList<Future<?>>();
        this.buffer = new byte[4096];
        this.invalidMutations = new HashMap<UUID, AtomicInteger>();
        // count the number of replayed mutation. We don't really care about atomicity, but we need it to be a reference.
        this.replayedCount = new AtomicInteger();
        this.checksum = new PureJavaCrc32();

        // compute per-CF and global replay positions
        cfPositions = new HashMap<UUID, ReplayPosition>();
        Ordering<ReplayPosition> replayPositionOrdering = Ordering.from(ReplayPosition.comparator);
        Map<UUID, ReplayPosition> truncationPositions = SystemTable.getTruncationPositions();
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

    {
        assert !closed;
        ReplayPosition repPos = getContext();
        markDirty(rowMutation, repPos);

        Checksum checksum = new PureJavaCrc32();
        byte[] serializedRow = rowMutation.getSerializedBuffer(MessagingService.current_version);

        checksum.update(serializedRow.length);
        buffer.putInt(serializedRow.length);
        buffer.putLong(checksum.getValue());

        buffer.put(serializedRow);
        checksum.update(serializedRow, 0, serializedRow.length);
        buffer.putLong(checksum.getValue());

        if (buffer.remaining() >= 4)
        {
            // writes end of segment marker and rewinds back to position where it starts
            buffer.putInt(CommitLog.END_OF_SEGMENT_MARKER);
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

    {
        assert !closed;
        ReplayPosition repPos = getContext();
        markDirty(rowMutation, repPos);

        Checksum checksum = new PureJavaCrc32();
        byte[] serializedRow = rowMutation.getSerializedBuffer(MessagingService.version_);

        checksum.update(serializedRow.length);
        buffer.putInt(serializedRow.length);
        buffer.putLong(checksum.getValue());

        buffer.put(serializedRow);
        checksum.update(serializedRow, 0, serializedRow.length);
        buffer.putLong(checksum.getValue());

        if (buffer.remaining() >= 4)
        {
            // writes end of segment marker and rewinds back to position where it starts
            buffer.putInt(CommitLog.END_OF_SEGMENT_MARKER);
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

    {
        assert !closed;
        ReplayPosition repPos = getContext();
        markDirty(rowMutation, repPos);

        Checksum checksum = new PureJavaCrc32();
        byte[] serializedRow = rowMutation.getSerializedBuffer(MessagingService.version_);

        checksum.update(serializedRow.length);
        buffer.putInt(serializedRow.length);
        buffer.putLong(checksum.getValue());

        buffer.put(serializedRow);
        checksum.update(serializedRow, 0, serializedRow.length);
        buffer.putLong(checksum.getValue());

        if (buffer.remaining() >= 4)
        {
            // writes end of segment marker and rewinds back to position where it starts
            buffer.putInt(CommitLog.END_OF_SEGMENT_MARKER);
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

            // list (otherwise we'll just start replay from the first flush position that we do have, which is not correct).
            ReplayPosition rp = ReplayPosition.getReplayPosition(cfs.getSSTables());
            cfPositions.put(cfs.metadata.cfId, rp);
        }
        this.globalPosition = Ordering.from(ReplayPosition.comparator).min(cfPositions.values());
        this.checksum = new PureJavaCrc32();
    }
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

    {
        assert !closed;
        ReplayPosition repPos = getContext();
        markDirty(rowMutation, repPos);

        Checksum checksum = new PureJavaCrc32();
        byte[] serializedRow = FBUtilities.serialize(rowMutation, RowMutation.serializer, MessagingService.current_version);

        checksum.update(serializedRow.length);
        buffer.putInt(serializedRow.length);
        buffer.putLong(checksum.getValue());

        buffer.put(serializedRow);
        checksum.update(serializedRow, 0, serializedRow.length);
        buffer.putLong(checksum.getValue());

        if (buffer.remaining() >= 4)
        {
            // writes end of segment marker and rewinds back to position where it starts
            buffer.putInt(CommitLog.END_OF_SEGMENT_MARKER);
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

        this.futures = new ArrayList<Future<?>>();
        this.buffer = new byte[4096];
        this.invalidMutations = new HashMap<UUID, AtomicInteger>();
        // count the number of replayed mutation. We don't really care about atomicity, but we need it to be a reference.
        this.replayedCount = new AtomicInteger();
        this.checksum = new PureJavaCrc32();

        // compute per-CF and global replay positions
        cfPositions = new HashMap<UUID, ReplayPosition>();
        Ordering<ReplayPosition> replayPositionOrdering = Ordering.from(ReplayPosition.comparator);
        Map<UUID, ReplayPosition> truncationPositions = SystemTable.getTruncationPositions();
View Full Code Here

Examples of org.apache.cassandra.utils.PureJavaCrc32

            assert nextMarker > lastSyncedOffset;

            // write previous sync marker to point to next sync marker
            // we don't chain the crcs here to ensure this method is idempotent if it fails
            int offset = lastSyncedOffset;
            final PureJavaCrc32 crc = new PureJavaCrc32();
            crc.update((int) (id & 0xFFFFFFFFL));
            crc.update((int) (id >>> 32));
            crc.update(offset);
            buffer.putInt(offset, nextMarker);
            buffer.putLong(offset + 4, crc.getValue());

            // zero out the next sync marker so replayer can cleanly exit
            if (nextMarker < buffer.capacity())
            {
                buffer.putInt(nextMarker, 0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.