Beispiel #1
0
 @Override
 public void readFields(DataInput in) throws IOException {
   int value = in.readByte();
   event = LogEvents.values()[value];
   switch (event) {
     case OPEN:
       tid = in.readInt();
       tserverSession = in.readUTF();
       if (tid != VERSION) {
         throw new RuntimeException(
             String.format(
                 "Bad version number for log file: expected %d, but saw %d", VERSION, tid));
       }
       break;
     case COMPACTION_FINISH:
       seq = in.readLong();
       tid = in.readInt();
       break;
     case COMPACTION_START:
       seq = in.readLong();
       tid = in.readInt();
       filename = in.readUTF();
       break;
     case DEFINE_TABLET:
       seq = in.readLong();
       tid = in.readInt();
       tablet = new KeyExtent();
       tablet.readFields(in);
       break;
     case MANY_MUTATIONS:
       seq = in.readLong();
       tid = in.readInt();
       break;
     case MUTATION:
       seq = in.readLong();
       tid = in.readInt();
       break;
     default:
       throw new RuntimeException("Unknown log event type: " + event);
   }
 }
Beispiel #2
0
 @Override
 public void write(DataOutput out) throws IOException {
   out.writeByte(event.ordinal());
   switch (event) {
     case OPEN:
       seq = -1;
       tid = -1;
       out.writeInt(VERSION);
       out.writeUTF(tserverSession);
       // out.writeUTF(Accumulo.getInstanceID());
       break;
     case COMPACTION_FINISH:
       out.writeLong(seq);
       out.writeInt(tid);
       break;
     case COMPACTION_START:
       out.writeLong(seq);
       out.writeInt(tid);
       out.writeUTF(filename);
       break;
     case DEFINE_TABLET:
       out.writeLong(seq);
       out.writeInt(tid);
       tablet.write(out);
       break;
     case MANY_MUTATIONS:
       out.writeLong(seq);
       out.writeInt(tid);
       break;
     case MUTATION:
       out.writeLong(seq);
       out.writeInt(tid);
       break;
     default:
       throw new IllegalArgumentException("Bad value for LogFileEntry type");
   }
 }