diff --git a/src/main/resources/Block/BloomBlocks b/src/main/resources/Block/BloomBlocks deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/Block/DataBlock b/src/main/resources/Block/DataBlock deleted file mode 100644 index 519aeae..0000000 Binary files a/src/main/resources/Block/DataBlock and /dev/null differ diff --git a/src/main/resources/Block/indexBlock b/src/main/resources/Block/indexBlock deleted file mode 100644 index 23fc26b..0000000 Binary files a/src/main/resources/Block/indexBlock and /dev/null differ diff --git a/src/main/resources/DB/Db.desc b/src/main/resources/DB/Db.desc deleted file mode 100644 index be0c5e1..0000000 --- a/src/main/resources/DB/Db.desc +++ /dev/null @@ -1,106 +0,0 @@ - -… - DB/Db.protogoogle.protobuf"‡ -SSTable -fileName ( RfileName -size (Rsize/ -minKey ( 2.google.protobuf.IntKeyRminKey8 - -longMinKey ( 2.google.protobuf.LongKeyR -longMinKey: - BytesMinKey ( 2.google.protobuf.ByteKeyR BytesMinKey/ -maxKey ( 2.google.protobuf.IntKeyRmaxKey8 - -longMaxKey ( 2.google.protobuf.LongKeyR -longMaxKey: - BytesMaxKey ( 2.google.protobuf.ByteKeyR BytesMaxKey"„ -FileList0 -level0 ( 2.google.protobuf.SSTableRlevel00 -level1 ( 2.google.protobuf.SSTableRlevel10 -level2 ( 2.google.protobuf.SSTableRlevel20 -level3 ( 2.google.protobuf.SSTableRlevel30 -level4 ( 2.google.protobuf.SSTableRlevel4"˜ -ColumnFamilyHandle/ -id ( 2.google.protobuf.ColumnFamilyIdRid -name ( Rname5 -fileList ( 2.google.protobuf.FileListRfileList -WalFile ( RWalFile2 -keyType (2.google.protobuf.KeyTypeRkeyType8 - valueType (2.google.protobuf.ValueTypeR valueType"k -DB1 -c ( 2#.google.protobuf.ColumnFamilyHandleRc2 -columnFamilyHandleId (RcolumnFamilyHandleId". -log' -k ( 2.google.protobuf.KeyValueRk"’ -KeyValue -key ( Rkey -intKey (RintKey -longKey (RlongKey -value ( Rvalue -intValue (RintValue - LongValue (R LongValue8 - prepareId ( 2.google.protobuf.PrepareIdR prepareId1 -seq ( 2.google.protobuf.SequenceNumberRseq5 -commitId ( 2.google.protobuf.CommitIdRcommitId2 -type - (2.google.protobuf.KeyValue.TypeRtype"* -Type - -delete - -update - -insert"/ - PrepareId -time (Rtime -id (Rid". -CommitId -time (Rtime -id (Rid"4 -SequenceNumber -time (Rtime -id (Rid" -IntKey -key (Rkey" -LongKey -key (Rkey" -ByteKey -key ( Rkey"ž -Key/ -intKey ( 2.google.protobuf.IntKeyRintKey2 -longKey ( 2.google.protobuf.LongKeyRlongKey2 -byteKey ( 2.google.protobuf.ByteKeyRbyteKey" -IntValue -value (Rvalue"! - LongValue -value (Rvalue"! - ByteValue -value ( Rvalue"² -Value5 -intValue ( 2.google.protobuf.IntValueRintValue8 - longValue ( 2.google.protobuf.LongValueR longValue8 - byteValue ( 2.google.protobuf.ByteValueR byteValue"• -TransactionKeyValueG -columnFamilyId ( 2.google.protobuf.ColumnFamilyIdRcolumnFamilyId5 -keyValue ( 2.google.protobuf.KeyValueRkeyValue" -ColumnFamilyId -id (Rid"d -Offset -key ( Rkey -intKey (RintKey -longKey (RlongKey -offset (Roffset"9 - -OffSetList+ -list ( 2.google.protobuf.OffsetRlist*0 -KeyType - -intKey -longKey -bytesKey*8 - ValueType -intValue - longValue - -bytesValueB -com \ No newline at end of file diff --git a/src/main/resources/DB/Db.proto b/src/main/resources/DB/Db.proto deleted file mode 100644 index 4cc9418..0000000 --- a/src/main/resources/DB/Db.proto +++ /dev/null @@ -1,194 +0,0 @@ -syntax = "proto2"; -package google.protobuf; -option java_package = "com"; - - - -message SSTable{ - - required string fileName = 1; - - required int32 size = 2; - - required IntKey minKey=3; - - required LongKey longMinKey=4; - - required ByteKey BytesMinKey=5; - - required IntKey maxKey=6; - - required LongKey longMaxKey=7; - - required ByteKey BytesMaxKey=8; - - - -} - - -message FileList{ - - repeated SSTable level0 = 1; - - repeated SSTable level1 = 2; - - repeated SSTable level2 = 3; - - repeated SSTable level3 = 4; - - repeated SSTable level4 = 5; - -} - - - - -message ColumnFamilyHandle{ - - required ColumnFamilyId id = 1; - - required string name = 2; - - required FileList fileList = 3; - - repeated string WalFile=4; - - required KeyType keyType=5; - - required ValueType valueType=6; -} - - -message DB{ - repeated ColumnFamilyHandle c = 1; - - required int64 columnFamilyHandleId=2; -} - - -message log{ - required KeyValue k = 1; -} - -message KeyValue{ - optional bytes key = 1; - optional int32 intKey = 2; - optional int64 longKey = 3; - optional bytes value = 4; - optional int32 intValue = 5; - optional int64 LongValue = 6; - optional PrepareId prepareId = 7; - required SequenceNumber seq = 8; - optional CommitId commitId = 9; - - enum Type{ - delete = 1; - update = 2; - insert = 3; - } - - required Type type = 10; -} - -message PrepareId{ - required int64 time = 1; - required int32 id = 2; -} - -message CommitId{ - required int64 time = 1; - required int32 id = 2; -} - -message SequenceNumber{ - required int64 time = 1; - required int32 id = 2; -} - - -message IntKey{ - required int32 key = 1; -} - -message LongKey{ - required int64 key = 1; -} - -message ByteKey{ - required bytes key = 1; -} - -message Key{ - optional IntKey intKey = 1; - - optional LongKey longKey = 2; - - optional ByteKey byteKey = 3; - - - -} - -enum KeyType{ - intKey=1; - longKey=2; - bytesKey=3; - -} - -enum ValueType{ - intValue=1; - longValue=2; - bytesValue=3; - -} - - -message IntValue{ - required int32 value = 1; -} - -message LongValue{ - required int64 value = 1; -} - -message ByteValue{ - required bytes value = 1; -} - -message Value{ - optional IntValue intValue = 1; - - optional LongValue longValue = 2; - - optional ByteValue byteValue = 3; - -} - -message TransactionKeyValue{ - required ColumnFamilyId columnFamilyId = 1; - - required KeyValue keyValue = 2; -} - -message ColumnFamilyId { - required int64 id = 1; -} - - -message Offset{ - - optional bytes key = 1; - optional int32 intKey = 2; - optional int64 longKey = 3; - - required int32 offset = 4; - -} - -message OffSetList{ - repeated Offset list = 1 ; -} - - diff --git a/src/main/resources/TransactionLog/luu b/src/main/resources/TransactionLog/luu deleted file mode 100644 index e69de29..0000000 diff --git a/src/test/java/BlockTest/BlockTest.java b/src/test/java/BlockTest/BlockTest.java deleted file mode 100644 index f07fba2..0000000 --- a/src/test/java/BlockTest/BlockTest.java +++ /dev/null @@ -1,81 +0,0 @@ -package BlockTest; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.PooledByteBufAllocator; -import io.netty.buffer.UnpooledDirectByteBuf; -import net.openio.jrocksDb.db.*; -import net.openio.jrocksDb.mem.KeyValueEntry; -import net.openio.jrocksDb.strorage.IndexList; -import net.openio.jrocksDb.strorage.IndexOffset; -import net.openio.jrocksDb.tool.Serializer; -import net.openio.jrocksDb.transaction.CommitId; -import net.openio.jrocksDb.transaction.PrepareId; -import net.openio.jrocksDb.transaction.SequenceNumber; - -import java.util.Date; - -public class BlockTest { - - static int p = 1; - - static long b = new Date().getTime(); - - public static void main(String[] args) { - - IndexList indexList = new IndexList(); - - for (int i = 0; i < 100; i++) { - Key key = new IntKey(2 + i); -// Value value = new IntValue(2); -// KeyValueEntry keyValue = new KeyValueEntry(); -// keyValue.setKey(key); -// keyValue.setValue(value); -// keyValue.setPrepareId(p()); -// keyValue.setCommitId(c()); -// keyValue.setSqId(s()); -// keyValue.setType(KeyValueEntry.Type.insert); - IndexOffset indexOffset = new IndexOffset(); - indexOffset.setOffset(12345 + i); - indexOffset.setKey(key); - indexList.add(indexOffset); - } - - ByteBuf byteBuf = new PooledByteBufAllocator().buffer(indexList.getByteSize()); - indexList.encode(byteBuf); - for (IndexOffset offset : IndexList.decode(byteBuf,indexList.getByteSize()).getList()) { - System.out.println(offset); - } - } - - - static synchronized PrepareId p() { - Date date = new Date(); - if (date.getTime() == b) { - return new PrepareId(date.getTime(), p++); - } - p = 1; - b = date.getTime(); - return new PrepareId(date.getTime(), p++); - } - - static synchronized CommitId c() { - Date date = new Date(); - if (date.getTime() == b) { - return new CommitId(date.getTime(), p++); - } - p = 1; - b = date.getTime(); - return new CommitId(date.getTime(), p++); - } - - - static synchronized SequenceNumber s() { - Date date = new Date(); - if (date.getTime() == b) { - return new SequenceNumber(date.getTime(), p++); - } - p = 1; - b = date.getTime(); - return new SequenceNumber(date.getTime(), p++); - } -} diff --git a/src/test/java/BlockTest/BloomBlocksTest.java b/src/test/java/BlockTest/BloomBlocksTest.java deleted file mode 100644 index e09d160..0000000 --- a/src/test/java/BlockTest/BloomBlocksTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package BlockTest; - -import net.openio.jrocksDb.memArena.MemArena; -import net.openio.jrocksDb.strorage.BloomBlocks; -import net.openio.jrocksDb.strorage.IndexOffset; - -import java.io.File; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.Random; - -public class BloomBlocksTest { - - public static void main(String[] args) { - int[] b=new int[1024]; - Random random=new Random(); - for(int i=0;i<1024;i++){ - b[i]=(int)(Math.random()*100000000); - } - - BloomBlocks bloomBlocks=new BloomBlocks(); - bloomBlocks.setMemArena(new MemArena()); - File file=new File("src/main/resources/Block/BloomBlocks"); - try { - - RandomAccessFile randomAccessFile=new RandomAccessFile(file,"rw"); - bloomBlocks.flush(randomAccessFile.getChannel(),0,b); - int in=0; - for(int i: bloomBlocks.getBloomFile(randomAccessFile.getChannel(),0)){ - - if(!(i==b[in++])){ - System.out.println(i); - } - } - randomAccessFile.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - } -} diff --git a/src/test/java/BlockTest/DataBlock.java b/src/test/java/BlockTest/DataBlock.java deleted file mode 100644 index fcec1a4..0000000 --- a/src/test/java/BlockTest/DataBlock.java +++ /dev/null @@ -1,98 +0,0 @@ -package BlockTest; - -import net.openio.jrocksDb.db.IntValue; -import net.openio.jrocksDb.db.Key; -import net.openio.jrocksDb.db.LongKey; -import net.openio.jrocksDb.db.Value; -import net.openio.jrocksDb.mem.KeyValueEntry; -import net.openio.jrocksDb.memArena.MemArena; -import net.openio.jrocksDb.strorage.DataBlocks; -import net.openio.jrocksDb.transaction.CommitId; -import net.openio.jrocksDb.transaction.PrepareId; -import net.openio.jrocksDb.transaction.SequenceNumber; - -import java.io.File; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class DataBlock { - - - static int p = 1; - - static long b = new Date().getTime(); - - public static void main(String[] args) { - File file=new File("src/main/resources/Block/DataBlock"); - - List list=new ArrayList<>(); - for(int i=0;i<1000;i++){ - Key key=new LongKey(i); - Value value=new IntValue(i); - KeyValueEntry keyValue = new KeyValueEntry(); - keyValue.setKey(key); - keyValue.setValue(value); - keyValue.setPrepareId(p()); - keyValue.setCommitId(c()); - keyValue.setSqId(s()); - keyValue.setType(KeyValueEntry.Type.insert); - list.add(keyValue); - } - try { - RandomAccessFile randomAccessFile=new RandomAccessFile(file,"rw"); - - DataBlocks dataBlocks=new DataBlocks(); - dataBlocks.setMemArena(new MemArena()); - int seek=0; - for(KeyValueEntry keyValueEntry: list) { - seek+=dataBlocks.flush(randomAccessFile.getChannel(), seek, keyValueEntry); - } - - seek=0; - List list1=new ArrayList<>(); - for(int i=0;i arr = Arrays.asList(1, 3, 5, 7, 9, 11, 13, 15); - - System.out.println(binarySearch(arr,16)); - } - - public static int binarySearch(List arr, int key) { - int low = 0; - int high = arr.size() - 1; - while (low <= high) { - int mid = low + (high - low) / 2; - int midVal = arr.get(mid); - if (midVal < key) { - low = mid + 1; - } else if (midVal > key) { - high = mid - 1; - } else { - return mid; - } - } - return low; // θΏ”ε›ž-1θ‘¨η€Ίζ²‘ζ‰Ύεˆ° - } -} diff --git a/src/test/java/DBTest.java b/src/test/java/DBTest.java deleted file mode 100644 index d7e4b79..0000000 --- a/src/test/java/DBTest.java +++ /dev/null @@ -1,22 +0,0 @@ -import net.openio.jrocksDb.db.*; - -public class DBTest { - - public static void main(String[] args) { - JRocksDB jRocksDB=OptimisticTransactionDB.createDB(); - - jRocksDB.createColumnFamily("luoluo", Key.KeyType.intKey, Value.ValueType.intValue); - - for(int i=0;i<1024*1024;i++) { - - Status status=jRocksDB.put(new IntKey(i), new IntValue(i), "luoluo"); - - - } - - - System.out.println(jRocksDB.get(new IntKey(997),"luoluo")); - - - } -} diff --git a/src/test/java/LogTest/FileListTest.java b/src/test/java/LogTest/FileListTest.java deleted file mode 100644 index 1630f23..0000000 --- a/src/test/java/LogTest/FileListTest.java +++ /dev/null @@ -1,43 +0,0 @@ -package LogTest; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.PooledByteBufAllocator; -import io.netty.buffer.UnpooledByteBufAllocator; -import io.netty.buffer.UnpooledDirectByteBuf; -import net.openio.jrocksDb.db.FileList; -import net.openio.jrocksDb.db.IntKey; -import net.openio.jrocksDb.strorage.SSTable; - -public class FileListTest { - - public static void main(String[] args) { - SSTable ssTable=new SSTable("12354",new IntKey(1),new IntKey(2),1231); - int size1=ssTable.getByteSize(); - ByteBuf buf1=UnpooledByteBufAllocator.DEFAULT.buffer(size1); - System.out.println(size1); - ssTable.encode(buf1); - System.out.println(buf1); - System.out.println(SSTable.decode(buf1,size1)); - - - FileList fileListTest=new FileList(); -// fileListTestadd(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getSSTable(0).add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getSSTable(0).add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getSSTable(0).add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getSSTable(0).add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getLevel2().add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getLevel3().add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getLevel3().add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getLevel4().add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); -// fileListTest.getLevel4().add(new SSTable("12354",new IntKey(1),new IntKey(2),1231)); - - int size= fileListTest.getByteSize(); - ByteBuf buf= UnpooledByteBufAllocator.DEFAULT.buffer(size); - System.out.println(size); - fileListTest.encode(buf); - System.out.println(buf); - FileList.decode(buf,size); - - } -} diff --git a/src/test/java/LogTest/LogTest.java b/src/test/java/LogTest/LogTest.java deleted file mode 100644 index eb8cb95..0000000 --- a/src/test/java/LogTest/LogTest.java +++ /dev/null @@ -1,189 +0,0 @@ -package LogTest; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.PooledByteBufAllocator; -import net.openio.jrocksDb.config.Config; -import net.openio.jrocksDb.db.*; -import net.openio.jrocksDb.log.WalStorage; -import net.openio.jrocksDb.mem.KeyValueEntry; -import net.openio.jrocksDb.memArena.MemArena; -import net.openio.jrocksDb.transaction.CommitId; -import net.openio.jrocksDb.transaction.PrepareId; -import net.openio.jrocksDb.transaction.SequenceNumber; - -import java.io.File; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.channels.FileChannel; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class LogTest { - - - static int p=1; - - static long b=new Date().getTime(); - - static long isnull=0; - - static long nonull=0; - - - - public static void main(String[] args) throws IOException { - WalStorage walStorage=new WalStorage(); - walStorage.setMemArena(new MemArena()); -// MemArena mem=new MemArena(); -// Key key=new LongKey(1); -// Value value=new IntValue(1); -// KeyValueEntry keyValue = new KeyValueEntry(); -// keyValue.setKey(key); -// keyValue.setValue(value); -// keyValue.setPrepareId(p()); -// keyValue.setCommitId(c()); -// keyValue.setSqId(s()); -// -// ByteBuf b=mem.allocator(keyValue.getSize()); -// keyValue.encode(b); -// -// int a=Serializer.decode32(b); -// -// System.out.println(KeyValueEntry.decode(b, a)); - -// writeOffset(13); - walStorage.createFile("luo",new ColumnFamilyId(1)); - - - List list=new ArrayList<>(); - for(int i=0;i<1000;i++){ - Key key=new LongKey(i); - Value value=new IntValue(i); - KeyValueEntry keyValue = new KeyValueEntry(); - keyValue.setKey(key); - keyValue.setValue(value); - keyValue.setPrepareId(p()); - keyValue.setCommitId(c()); - keyValue.setSqId(s()); - keyValue.setType(KeyValueEntry.Type.insert); - list.add(keyValue); - walStorage.write("luo",keyValue,false); - } -// writeOffset(100); -// readOffset(); - - -// writeOffset(123213); -// walStorage.createFile("luo",new ColumnFamilyId(1)); - walStorage.write("luo",list,false); - - - for(KeyValueEntry value: walStorage.getAllMemTable("luo")){ - System.out.println(value); - } - - } - - - - - - - static synchronized PrepareId p(){ - Date date=new Date(); - if(date.getTime()==b){ - return new PrepareId(date.getTime(),p++); - } - p=1; - b=date.getTime(); - return new PrepareId(date.getTime(),p++); - } - - static synchronized CommitId c(){ - Date date=new Date(); - if(date.getTime()==b){ - return new CommitId(date.getTime(),p++); - } - p=1; - b=date.getTime(); - return new CommitId(date.getTime(),p++); } - - static synchronized SequenceNumber s(){ - Date date=new Date(); - if(date.getTime()==b){ - return new SequenceNumber(date.getTime(),p++); - } - p=1; - b=date.getTime(); - return new SequenceNumber(date.getTime(),p++); } - - - private static int writeOffseta( int length) throws IOException { - - File file2=new File(Config.WalLogPath+"ll"); - RandomAccessFile accessFile; - accessFile=new RandomAccessFile(file2,"rw"); - ByteBuf buf = new PooledByteBufAllocator().buffer(8); - buf.writeLong(Long.MAX_VALUE); - FileChannel file = accessFile.getChannel(); - file.write(buf.nioBuffer()); - buf=new PooledByteBufAllocator().buffer(8); - buf.writeLong(Long.MAX_VALUE); - file.write(buf.nioBuffer()); - buf = new PooledByteBufAllocator().buffer(4); - file.position(16); - buf.writeLong(Long.MAX_VALUE); - file.write(buf.nioBuffer()); - file.force(true); - buf.release(); - accessFile.close(); - return length; - } - - - - private static int readOffset() throws IOException { - File file2=new File(Config.WalLogPath+"ll"); - RandomAccessFile accessFile; - accessFile=new RandomAccessFile(file2,"rw"); - ByteBuf buf = new PooledByteBufAllocator().buffer(8); - accessFile.seek(16); - FileChannel fileChannel = accessFile.getChannel(); - accessFile.seek(16); - buf.writerIndex(8); - fileChannel.read(buf.nioBuffer()); - long length = buf.readLong(); - buf.release(); - fileChannel.close(); - accessFile.close(); - return (int) (Long.MAX_VALUE-length); - - } - - - private static int writeOffset( int length) throws IOException { - File file2=new File(Config.WalLogPath+"ll"); - RandomAccessFile accessFile; - accessFile=new RandomAccessFile(file2,"rw"); - ByteBuf buf = new PooledByteBufAllocator().buffer(8); - buf.writeLong(Long.MAX_VALUE-length); - accessFile.seek(16); - FileChannel file = accessFile.getChannel(); - file.write(buf.nioBuffer()); - file.force(true); - buf.clear(); - accessFile.seek(16); - FileChannel fileChannel = accessFile.getChannel(); - fileChannel.read(buf.nioBuffer()); - buf.writerIndex(8); - buf.readerIndex(0); - System.out.println(Long.MAX_VALUE-buf.readLong()); - file.force(true); - buf.release(); - file.close(); - accessFile.close(); - return length; - } - -} diff --git a/src/test/java/TransactionTest/LockTest.java b/src/test/java/TransactionTest/LockTest.java deleted file mode 100644 index 6a4f053..0000000 --- a/src/test/java/TransactionTest/LockTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package TransactionTest; - -import net.openio.jrocksDb.db.ColumnFamilyId; -import net.openio.jrocksDb.db.IntKey; -import net.openio.jrocksDb.db.Key; -import net.openio.jrocksDb.transaction.SequenceNumber; -import net.openio.jrocksDb.transaction.lock.PointLockManager; - -import java.util.Date; - -public class LockTest { - - static long a=1; - public static void main(String[] args) { - - int i=0; - for( i=0;i<1000;i++) { - Runnable runnable = new Runnable() { - - @Override - public void run() { - testTryLockAndUnlock(a++,1,(int) a++,(int) a++); - } - }; - - Thread thread=new Thread(runnable); - thread.start(); - - } - - - } - - - public static void testTryLockAndUnlock(long tid,long cid,int k,int s ) { - PointLockManager lockManager = new PointLockManager(1000, 500); - ColumnFamilyId cId = new ColumnFamilyId(cid); - Key key = new IntKey(k); - SequenceNumber sequenceNumber = new SequenceNumber(new Date().getTime(),s); - - SequenceNumber tryLockResult = lockManager.TryLock(tid, cId, key, true, false, sequenceNumber,true); - System.out.println(tryLockResult); - - System.out.println(lockManager.GetPointLockStatus(cId,key)); - - lockManager.UnLock(1, cId, key, true, false,true); - } -} diff --git a/src/test/java/com/ByteKey.java b/src/test/java/com/ByteKey.java deleted file mode 100644 index 41bfbf8..0000000 --- a/src/test/java/com/ByteKey.java +++ /dev/null @@ -1,136 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class ByteKey { - - private int ByteKey_size = 0; - - private byte[] key; - public final static int key_Num = 1; - public final static int key_Tag = 10;// the value is num<<<3|wireType - public final static int key_TagEncodeSize = 1; - - private void encode_key(ByteBuf buf) { - Serializer.encodeVarInt32(buf, key_Tag); - Serializer.encodeByteString(buf, this.key); - } - - private static void decode_key(ByteBuf buf, ByteKey a_1) { - byte[] value_1 = null; - value_1 = Serializer.decodeByteString(buf, Serializer.decodeVarInt32(buf)); - a_1.key = value_1; - } - - private void set_key(byte[] value_1) { - ByteKey_size += key_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.length); - size_1 += value_1.length; - ByteKey_size += size_1; - this.key = value_1; - } - - public byte[] getKey() { - return this.key; - } - - private boolean hasKey() { - return this.key != null; - } - - public static ByteKey decode(ByteBuf buf) { - ByteKey value_1 = new ByteKey(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ByteKey_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasKey()) { - this.encode_key(buf); - } - - } - public static ByteKey decode(ByteBuf buf, int length_1) { - ByteKey value_1 = new ByteKey(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ByteKey_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.ByteKey_size; - } - - public static ByteKeyBuild newBuilder() { - return new ByteKeyBuild(); - } - - private void verify() { - if (this.key == null) { - throw new RuntimeException("required key"); - } - } - - public static class ByteKeyBuild { - private byte[] key; - - public ByteKeyBuild setKey(byte[] a) { - this.key = a; - return this; - } - - public byte[] getKey() { - return this.key; - } - - public ByteKeyBuild clearKey() { - this.key = null; - return this; - } - - public boolean hasKey() { - return this.key != null; - } - - public ByteKey build() { - ByteKey value_1 = new ByteKey(); - if (this.key == null) { - throw new RuntimeException(" key is required"); - } - value_1.set_key(this.key); - return value_1; - } - public ByteKeyBuild clear() { - this.key = null; - return this; - } - - private ByteKeyBuild() { - } - } - -} diff --git a/src/test/java/com/ByteValue.java b/src/test/java/com/ByteValue.java deleted file mode 100644 index e52ea8a..0000000 --- a/src/test/java/com/ByteValue.java +++ /dev/null @@ -1,136 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class ByteValue { - - private int ByteValue_size = 0; - - private byte[] value; - public final static int value_Num = 1; - public final static int value_Tag = 10;// the value is num<<<3|wireType - public final static int value_TagEncodeSize = 1; - - private void encode_value(ByteBuf buf) { - Serializer.encodeVarInt32(buf, value_Tag); - Serializer.encodeByteString(buf, this.value); - } - - private static void decode_value(ByteBuf buf, ByteValue a_1) { - byte[] value_1 = null; - value_1 = Serializer.decodeByteString(buf, Serializer.decodeVarInt32(buf)); - a_1.value = value_1; - } - - private void set_value(byte[] value_1) { - ByteValue_size += value_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.length); - size_1 += value_1.length; - ByteValue_size += size_1; - this.value = value_1; - } - - public byte[] getValue() { - return this.value; - } - - private boolean hasValue() { - return this.value != null; - } - - public static ByteValue decode(ByteBuf buf) { - ByteValue value_1 = new ByteValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case value_Tag : - decode_value(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ByteValue_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasValue()) { - this.encode_value(buf); - } - - } - public static ByteValue decode(ByteBuf buf, int length_1) { - ByteValue value_1 = new ByteValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case value_Tag : - decode_value(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ByteValue_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.ByteValue_size; - } - - public static ByteValueBuild newBuilder() { - return new ByteValueBuild(); - } - - private void verify() { - if (this.value == null) { - throw new RuntimeException("required value"); - } - } - - public static class ByteValueBuild { - private byte[] value; - - public ByteValueBuild setValue(byte[] a) { - this.value = a; - return this; - } - - public byte[] getValue() { - return this.value; - } - - public ByteValueBuild clearValue() { - this.value = null; - return this; - } - - public boolean hasValue() { - return this.value != null; - } - - public ByteValue build() { - ByteValue value_1 = new ByteValue(); - if (this.value == null) { - throw new RuntimeException(" value is required"); - } - value_1.set_value(this.value); - return value_1; - } - public ByteValueBuild clear() { - this.value = null; - return this; - } - - private ByteValueBuild() { - } - } - -} diff --git a/src/test/java/com/ColumnFamilyHandle.java b/src/test/java/com/ColumnFamilyHandle.java deleted file mode 100644 index 921da6a..0000000 --- a/src/test/java/com/ColumnFamilyHandle.java +++ /dev/null @@ -1,546 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class ColumnFamilyHandle { - - private int ColumnFamilyHandle_size = 0; - - private com.ColumnFamilyId id; - public final static int id_Num = 1; - public final static int id_Tag = 10;// the value is num<<<3|wireType - public final static int id_TagEncodeSize = 1; - - private void encode_id(ByteBuf buf) { - Serializer.encodeVarInt32(buf, id_Tag); - Serializer.encodeVarInt32(buf, this.id.getByteSize()); - this.id.encode(buf); - } - - private static void decode_id(ByteBuf buf, ColumnFamilyHandle a_1) { - com.ColumnFamilyId value_1 = null; - value_1 = com.ColumnFamilyId.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.id = value_1; - } - - private void set_id(com.ColumnFamilyId value_1) { - ColumnFamilyHandle_size += id_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - ColumnFamilyHandle_size += size_1; - this.id = value_1; - } - - public com.ColumnFamilyId getId() { - return this.id; - } - - private boolean hasId() { - return this.id != null; - } - - private java.lang.String name; - public final static int name_Num = 2; - public final static int name_Tag = 18;// the value is num<<<3|wireType - public final static int name_TagEncodeSize = 1; - - private void encode_name(ByteBuf buf) { - Serializer.encodeVarInt32(buf, name_Tag); - Serializer.encodeString(buf, this.name); - } - - private static void decode_name(ByteBuf buf, ColumnFamilyHandle a_1) { - java.lang.String value_1 = null; - value_1 = Serializer.decodeString(buf, Serializer.decodeVarInt32(buf)); - a_1.name = value_1; - } - - private void set_name(java.lang.String value_1) { - ColumnFamilyHandle_size += name_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(ByteBufUtil.utf8Bytes(value_1)); - size_1 += ByteBufUtil.utf8Bytes(value_1);// value length - ColumnFamilyHandle_size += size_1; - this.name = value_1; - } - - public java.lang.String getName() { - return this.name; - } - - private boolean hasName() { - return this.name != null; - } - - private com.FileList filelist; - public final static int filelist_Num = 3; - public final static int filelist_Tag = 26;// the value is num<<<3|wireType - public final static int filelist_TagEncodeSize = 1; - - private void encode_filelist(ByteBuf buf) { - Serializer.encodeVarInt32(buf, filelist_Tag); - Serializer.encodeVarInt32(buf, this.filelist.getByteSize()); - this.filelist.encode(buf); - } - - private static void decode_filelist(ByteBuf buf, ColumnFamilyHandle a_1) { - com.FileList value_1 = null; - value_1 = com.FileList.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.filelist = value_1; - } - - private void set_filelist(com.FileList value_1) { - ColumnFamilyHandle_size += filelist_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - ColumnFamilyHandle_size += size_1; - this.filelist = value_1; - } - - public com.FileList getFilelist() { - return this.filelist; - } - - private boolean hasFilelist() { - return this.filelist != null; - } - - private java.util.List walfile; - public final static int walfile_Num = 4; - public final static int walfile_Tag = 34;// the value is num<<3|wireType - public final static int walfile_TagEncodeSize = 1; - - private void set_walfile(java.util.List list_1) { - this.walfile = new java.util.ArrayList<>(list_1.size()); - this.ColumnFamilyHandle_size += walfile_TagEncodeSize * list_1.size();// add tag length - for (java.lang.String value_1 : list_1) { - this.walfile.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(ByteBufUtil.utf8Bytes(value_1)); - length_1 += ByteBufUtil.utf8Bytes(value_1);// value length - this.ColumnFamilyHandle_size += length_1; - } - } - public java.lang.String getWalfile(int index) { - if (this.walfile == null) { - return null; - } - - return this.walfile.get(index); - } - - public int getWalfileSize() { - if (this.walfile == null) { - return 0; - } - - return this.walfile.size(); - } - - private static void decode_walfile(ByteBuf buf, ColumnFamilyHandle a_1) { - java.lang.String value_1 = null; - value_1 = Serializer.decodeString(buf, Serializer.decodeVarInt32(buf)); - a_1.add_walfile(value_1); - } - - private void encode_walfile(ByteBuf buf) { - for (java.lang.String value_1 : walfile) { - Serializer.encodeVarInt32(buf, walfile_Tag); - Serializer.encodeString(buf, value_1); - } - } - - private void add_walfile(java.lang.String value) { - if (this.walfile == null) { - this.walfile = new java.util.ArrayList<>(); - } - - this.walfile.add(value); - } - - public boolean hasWalfile() { - if (this.walfile == null) { - return false; - } - return this.walfile.size() != 0; - } - - private com.KeyType keytype; - public final static int keytype_Num = 5; - public final static int keytype_Tag = 40;// the value is num<<<3|wireType - public final static int keytype_TagEncodeSize = 1; - - private void encode_keytype(ByteBuf buf) { - Serializer.encodeVarInt32(buf, keytype_Tag); - Serializer.encodeVarInt32(buf, this.keytype.getNum()); - } - - private static void decode_keytype(ByteBuf buf, ColumnFamilyHandle a_1) { - com.KeyType value_1 = null; - value_1 = com.KeyType.get(Serializer.decodeVarInt32(buf)); - a_1.keytype = value_1; - } - - private void set_keytype(com.KeyType value_1) { - ColumnFamilyHandle_size += keytype_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getNum()); - ColumnFamilyHandle_size += size_1; - this.keytype = value_1; - } - - public com.KeyType getKeytype() { - return this.keytype; - } - - private boolean hasKeytype() { - return this.keytype != null; - } - - private com.ValueType valuetype; - public final static int valuetype_Num = 6; - public final static int valuetype_Tag = 48;// the value is num<<<3|wireType - public final static int valuetype_TagEncodeSize = 1; - - private void encode_valuetype(ByteBuf buf) { - Serializer.encodeVarInt32(buf, valuetype_Tag); - Serializer.encodeVarInt32(buf, this.valuetype.getNum()); - } - - private static void decode_valuetype(ByteBuf buf, ColumnFamilyHandle a_1) { - com.ValueType value_1 = null; - value_1 = com.ValueType.get(Serializer.decodeVarInt32(buf)); - a_1.valuetype = value_1; - } - - private void set_valuetype(com.ValueType value_1) { - ColumnFamilyHandle_size += valuetype_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getNum()); - ColumnFamilyHandle_size += size_1; - this.valuetype = value_1; - } - - public com.ValueType getValuetype() { - return this.valuetype; - } - - private boolean hasValuetype() { - return this.valuetype != null; - } - - public static ColumnFamilyHandle decode(ByteBuf buf) { - ColumnFamilyHandle value_1 = new ColumnFamilyHandle(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case id_Tag : - decode_id(buf, value_1); - break; - case name_Tag : - decode_name(buf, value_1); - break; - case filelist_Tag : - decode_filelist(buf, value_1); - break; - case walfile_Tag : - decode_walfile(buf, value_1); - break; - case keytype_Tag : - decode_keytype(buf, value_1); - break; - case valuetype_Tag : - decode_valuetype(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ColumnFamilyHandle_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasId()) { - this.encode_id(buf); - } - - if (hasName()) { - this.encode_name(buf); - } - - if (hasFilelist()) { - this.encode_filelist(buf); - } - - if (hasWalfile()) { - this.encode_walfile(buf); - } - - if (hasKeytype()) { - this.encode_keytype(buf); - } - - if (hasValuetype()) { - this.encode_valuetype(buf); - } - - } - public static ColumnFamilyHandle decode(ByteBuf buf, int length_1) { - ColumnFamilyHandle value_1 = new ColumnFamilyHandle(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case id_Tag : - decode_id(buf, value_1); - break; - case name_Tag : - decode_name(buf, value_1); - break; - case filelist_Tag : - decode_filelist(buf, value_1); - break; - case walfile_Tag : - decode_walfile(buf, value_1); - break; - case keytype_Tag : - decode_keytype(buf, value_1); - break; - case valuetype_Tag : - decode_valuetype(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ColumnFamilyHandle_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.ColumnFamilyHandle_size; - } - - public static ColumnFamilyHandleBuild newBuilder() { - return new ColumnFamilyHandleBuild(); - } - - private void verify() { - if (this.id == null) { - throw new RuntimeException("required id"); - } - if (this.name == null) { - throw new RuntimeException("required name"); - } - if (this.filelist == null) { - throw new RuntimeException("required filelist"); - } - if (this.keytype == null) { - throw new RuntimeException("required keytype"); - } - if (this.valuetype == null) { - throw new RuntimeException("required valuetype"); - } - } - - public static class ColumnFamilyHandleBuild { - private com.ColumnFamilyId id; - private java.lang.String name; - private com.FileList filelist; - private java.util.List walfile; - private com.KeyType keytype; - private com.ValueType valuetype; - - public ColumnFamilyHandleBuild setId(com.ColumnFamilyId a) { - this.id = a; - return this; - } - - public com.ColumnFamilyId getId() { - return this.id; - } - - public ColumnFamilyHandleBuild clearId() { - this.id = null; - return this; - } - - public boolean hasId() { - return this.id != null; - } - - public ColumnFamilyHandleBuild setName(java.lang.String a) { - this.name = a; - return this; - } - - public java.lang.String getName() { - return this.name; - } - - public ColumnFamilyHandleBuild clearName() { - this.name = null; - return this; - } - - public boolean hasName() { - return this.name != null; - } - - public ColumnFamilyHandleBuild setFilelist(com.FileList a) { - this.filelist = a; - return this; - } - - public com.FileList getFilelist() { - return this.filelist; - } - - public ColumnFamilyHandleBuild clearFilelist() { - this.filelist = null; - return this; - } - - public boolean hasFilelist() { - return this.filelist != null; - } - - public ColumnFamilyHandleBuild addWalfile(java.lang.String a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.walfile == null) { - this.walfile = new java.util.ArrayList<>(); - this.walfile.add(a); - } else { - this.walfile.add(a); - } - return this; - } - - public java.lang.String getWalfile(int index) { - if (this.walfile == null || index >= this.walfile.size()) { - throw new RuntimeException("walfile is null or index bigger than walfile size"); - } - - return this.walfile.get(index); - } - - public ColumnFamilyHandleBuild removeWalfile(int index) { - if (this.walfile == null || index >= this.walfile.size()) { - throw new RuntimeException("walfile is null or index bigger than walfile size"); - } - - this.walfile.remove(index); - return this; - - } - - public int sizeWalfile() { - if (this.walfile == null) { - throw new RuntimeException("walfile is null"); - } - - return this.walfile.size(); - } - - public ColumnFamilyHandleBuild clearWalfile() { - this.walfile = null; - return this; - } - - public boolean hasWalfile() { - if (this.walfile == null) { - return false; - } - return this.walfile.size() != 0; - } - - public ColumnFamilyHandleBuild setKeytype(com.KeyType a) { - this.keytype = a; - return this; - } - - public com.KeyType getKeytype() { - return this.keytype; - } - - public ColumnFamilyHandleBuild clearKeytype() { - this.keytype = null; - return this; - } - - public boolean hasKeytype() { - return this.keytype != null; - } - - public ColumnFamilyHandleBuild setValuetype(com.ValueType a) { - this.valuetype = a; - return this; - } - - public com.ValueType getValuetype() { - return this.valuetype; - } - - public ColumnFamilyHandleBuild clearValuetype() { - this.valuetype = null; - return this; - } - - public boolean hasValuetype() { - return this.valuetype != null; - } - - public ColumnFamilyHandle build() { - ColumnFamilyHandle value_1 = new ColumnFamilyHandle(); - if (this.id == null) { - throw new RuntimeException(" id is required"); - } - value_1.set_id(this.id); - if (this.name == null) { - throw new RuntimeException(" name is required"); - } - value_1.set_name(this.name); - if (this.filelist == null) { - throw new RuntimeException(" filelist is required"); - } - value_1.set_filelist(this.filelist); - if (this.hasWalfile()) { - value_1.set_walfile(this.walfile); - } - if (this.keytype == null) { - throw new RuntimeException(" keytype is required"); - } - value_1.set_keytype(this.keytype); - if (this.valuetype == null) { - throw new RuntimeException(" valuetype is required"); - } - value_1.set_valuetype(this.valuetype); - return value_1; - } - public ColumnFamilyHandleBuild clear() { - this.id = null; - this.name = null; - this.filelist = null; - this.walfile = null; - this.keytype = null; - this.valuetype = null; - return this; - } - - private ColumnFamilyHandleBuild() { - } - } - -} diff --git a/src/test/java/com/ColumnFamilyId.java b/src/test/java/com/ColumnFamilyId.java deleted file mode 100644 index 915be7b..0000000 --- a/src/test/java/com/ColumnFamilyId.java +++ /dev/null @@ -1,135 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class ColumnFamilyId { - - private int ColumnFamilyId_size = 0; - - private java.lang.Long id; - public final static int id_Num = 1; - public final static int id_Tag = 8;// the value is num<<<3|wireType - public final static int id_TagEncodeSize = 1; - - private void encode_id(ByteBuf buf) { - Serializer.encodeVarInt32(buf, id_Tag); - Serializer.encodeVarInt64(buf, this.id); - } - - private static void decode_id(ByteBuf buf, ColumnFamilyId a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.id = value_1; - } - - private void set_id(java.lang.Long value_1) { - ColumnFamilyId_size += id_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - ColumnFamilyId_size += size_1; - this.id = value_1; - } - - public java.lang.Long getId() { - return this.id; - } - - private boolean hasId() { - return this.id != null; - } - - public static ColumnFamilyId decode(ByteBuf buf) { - ColumnFamilyId value_1 = new ColumnFamilyId(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ColumnFamilyId_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasId()) { - this.encode_id(buf); - } - - } - public static ColumnFamilyId decode(ByteBuf buf, int length_1) { - ColumnFamilyId value_1 = new ColumnFamilyId(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.ColumnFamilyId_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.ColumnFamilyId_size; - } - - public static ColumnFamilyIdBuild newBuilder() { - return new ColumnFamilyIdBuild(); - } - - private void verify() { - if (this.id == null) { - throw new RuntimeException("required id"); - } - } - - public static class ColumnFamilyIdBuild { - private java.lang.Long id; - - public ColumnFamilyIdBuild setId(java.lang.Long a) { - this.id = a; - return this; - } - - public java.lang.Long getId() { - return this.id; - } - - public ColumnFamilyIdBuild clearId() { - this.id = null; - return this; - } - - public boolean hasId() { - return this.id != null; - } - - public ColumnFamilyId build() { - ColumnFamilyId value_1 = new ColumnFamilyId(); - if (this.id == null) { - throw new RuntimeException(" id is required"); - } - value_1.set_id(this.id); - return value_1; - } - public ColumnFamilyIdBuild clear() { - this.id = null; - return this; - } - - private ColumnFamilyIdBuild() { - } - } - -} diff --git a/src/test/java/com/CommitId.java b/src/test/java/com/CommitId.java deleted file mode 100644 index 4dd7d33..0000000 --- a/src/test/java/com/CommitId.java +++ /dev/null @@ -1,205 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class CommitId { - - private int CommitId_size = 0; - - private java.lang.Long time; - public final static int time_Num = 1; - public final static int time_Tag = 8;// the value is num<<<3|wireType - public final static int time_TagEncodeSize = 1; - - private void encode_time(ByteBuf buf) { - Serializer.encodeVarInt32(buf, time_Tag); - Serializer.encodeVarInt64(buf, this.time); - } - - private static void decode_time(ByteBuf buf, CommitId a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.time = value_1; - } - - private void set_time(java.lang.Long value_1) { - CommitId_size += time_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - CommitId_size += size_1; - this.time = value_1; - } - - public java.lang.Long getTime() { - return this.time; - } - - private boolean hasTime() { - return this.time != null; - } - - private java.lang.Integer id; - public final static int id_Num = 2; - public final static int id_Tag = 16;// the value is num<<<3|wireType - public final static int id_TagEncodeSize = 1; - - private void encode_id(ByteBuf buf) { - Serializer.encodeVarInt32(buf, id_Tag); - Serializer.encodeVarInt32(buf, this.id); - } - - private static void decode_id(ByteBuf buf, CommitId a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.id = value_1; - } - - private void set_id(java.lang.Integer value_1) { - CommitId_size += id_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - CommitId_size += size_1; - this.id = value_1; - } - - public java.lang.Integer getId() { - return this.id; - } - - private boolean hasId() { - return this.id != null; - } - - public static CommitId decode(ByteBuf buf) { - CommitId value_1 = new CommitId(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case time_Tag : - decode_time(buf, value_1); - break; - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.CommitId_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasTime()) { - this.encode_time(buf); - } - - if (hasId()) { - this.encode_id(buf); - } - - } - public static CommitId decode(ByteBuf buf, int length_1) { - CommitId value_1 = new CommitId(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case time_Tag : - decode_time(buf, value_1); - break; - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.CommitId_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.CommitId_size; - } - - public static CommitIdBuild newBuilder() { - return new CommitIdBuild(); - } - - private void verify() { - if (this.time == null) { - throw new RuntimeException("required time"); - } - if (this.id == null) { - throw new RuntimeException("required id"); - } - } - - public static class CommitIdBuild { - private java.lang.Long time; - private java.lang.Integer id; - - public CommitIdBuild setTime(java.lang.Long a) { - this.time = a; - return this; - } - - public java.lang.Long getTime() { - return this.time; - } - - public CommitIdBuild clearTime() { - this.time = null; - return this; - } - - public boolean hasTime() { - return this.time != null; - } - - public CommitIdBuild setId(java.lang.Integer a) { - this.id = a; - return this; - } - - public java.lang.Integer getId() { - return this.id; - } - - public CommitIdBuild clearId() { - this.id = null; - return this; - } - - public boolean hasId() { - return this.id != null; - } - - public CommitId build() { - CommitId value_1 = new CommitId(); - if (this.time == null) { - throw new RuntimeException(" time is required"); - } - value_1.set_time(this.time); - if (this.id == null) { - throw new RuntimeException(" id is required"); - } - value_1.set_id(this.id); - return value_1; - } - public CommitIdBuild clear() { - this.time = null; - this.id = null; - return this; - } - - private CommitIdBuild() { - } - } - -} diff --git a/src/test/java/com/DB.java b/src/test/java/com/DB.java deleted file mode 100644 index fed58a6..0000000 --- a/src/test/java/com/DB.java +++ /dev/null @@ -1,262 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class DB { - - private int DB_size = 0; - - private java.util.List c; - public final static int c_Num = 1; - public final static int c_Tag = 10;// the value is num<<3|wireType - public final static int c_TagEncodeSize = 1; - - private void set_c(java.util.List list_1) { - this.c = new java.util.ArrayList<>(list_1.size()); - this.DB_size += c_TagEncodeSize * list_1.size();// add tag length - for (com.ColumnFamilyHandle value_1 : list_1) { - this.c.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.DB_size += length_1; - } - } - public com.ColumnFamilyHandle getC(int index) { - if (this.c == null) { - return null; - } - - return this.c.get(index); - } - - public int getCSize() { - if (this.c == null) { - return 0; - } - - return this.c.size(); - } - - private static void decode_c(ByteBuf buf, DB a_1) { - com.ColumnFamilyHandle value_1 = null; - value_1 = com.ColumnFamilyHandle.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_c(value_1); - } - - private void encode_c(ByteBuf buf) { - for (com.ColumnFamilyHandle value_1 : c) { - Serializer.encodeVarInt32(buf, c_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_c(com.ColumnFamilyHandle value) { - if (this.c == null) { - this.c = new java.util.ArrayList<>(); - } - - this.c.add(value); - } - - public boolean hasC() { - if (this.c == null) { - return false; - } - return this.c.size() != 0; - } - - private java.lang.Long columnfamilyhandleid; - public final static int columnfamilyhandleid_Num = 2; - public final static int columnfamilyhandleid_Tag = 16;// the value is num<<<3|wireType - public final static int columnfamilyhandleid_TagEncodeSize = 1; - - private void encode_columnfamilyhandleid(ByteBuf buf) { - Serializer.encodeVarInt32(buf, columnfamilyhandleid_Tag); - Serializer.encodeVarInt64(buf, this.columnfamilyhandleid); - } - - private static void decode_columnfamilyhandleid(ByteBuf buf, DB a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.columnfamilyhandleid = value_1; - } - - private void set_columnfamilyhandleid(java.lang.Long value_1) { - DB_size += columnfamilyhandleid_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - DB_size += size_1; - this.columnfamilyhandleid = value_1; - } - - public java.lang.Long getColumnfamilyhandleid() { - return this.columnfamilyhandleid; - } - - private boolean hasColumnfamilyhandleid() { - return this.columnfamilyhandleid != null; - } - - public static DB decode(ByteBuf buf) { - DB value_1 = new DB(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case c_Tag : - decode_c(buf, value_1); - break; - case columnfamilyhandleid_Tag : - decode_columnfamilyhandleid(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.DB_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasC()) { - this.encode_c(buf); - } - - if (hasColumnfamilyhandleid()) { - this.encode_columnfamilyhandleid(buf); - } - - } - public static DB decode(ByteBuf buf, int length_1) { - DB value_1 = new DB(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case c_Tag : - decode_c(buf, value_1); - break; - case columnfamilyhandleid_Tag : - decode_columnfamilyhandleid(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.DB_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.DB_size; - } - - public static DBBuild newBuilder() { - return new DBBuild(); - } - - private void verify() { - if (this.columnfamilyhandleid == null) { - throw new RuntimeException("required columnfamilyhandleid"); - } - } - - public static class DBBuild { - private java.util.List c; - private java.lang.Long columnfamilyhandleid; - - public DBBuild addC(com.ColumnFamilyHandle a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.c == null) { - this.c = new java.util.ArrayList<>(); - this.c.add(a); - } else { - this.c.add(a); - } - return this; - } - - public com.ColumnFamilyHandle getC(int index) { - if (this.c == null || index >= this.c.size()) { - throw new RuntimeException("c is null or index bigger than c size"); - } - - return this.c.get(index); - } - - public DBBuild removeC(int index) { - if (this.c == null || index >= this.c.size()) { - throw new RuntimeException("c is null or index bigger than c size"); - } - - this.c.remove(index); - return this; - - } - - public int sizeC() { - if (this.c == null) { - throw new RuntimeException("c is null"); - } - - return this.c.size(); - } - - public DBBuild clearC() { - this.c = null; - return this; - } - - public boolean hasC() { - if (this.c == null) { - return false; - } - return this.c.size() != 0; - } - - public DBBuild setColumnfamilyhandleid(java.lang.Long a) { - this.columnfamilyhandleid = a; - return this; - } - - public java.lang.Long getColumnfamilyhandleid() { - return this.columnfamilyhandleid; - } - - public DBBuild clearColumnfamilyhandleid() { - this.columnfamilyhandleid = null; - return this; - } - - public boolean hasColumnfamilyhandleid() { - return this.columnfamilyhandleid != null; - } - - public DB build() { - DB value_1 = new DB(); - if (this.hasC()) { - value_1.set_c(this.c); - } - if (this.columnfamilyhandleid == null) { - throw new RuntimeException(" columnfamilyhandleid is required"); - } - value_1.set_columnfamilyhandleid(this.columnfamilyhandleid); - return value_1; - } - public DBBuild clear() { - this.c = null; - this.columnfamilyhandleid = null; - return this; - } - - private DBBuild() { - } - } - -} diff --git a/src/test/java/com/FileList.java b/src/test/java/com/FileList.java deleted file mode 100644 index 2dd31d2..0000000 --- a/src/test/java/com/FileList.java +++ /dev/null @@ -1,700 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class FileList { - - private int FileList_size = 0; - - private java.util.List level0; - public final static int level0_Num = 1; - public final static int level0_Tag = 10;// the value is num<<3|wireType - public final static int level0_TagEncodeSize = 1; - - private void set_level0(java.util.List list_1) { - this.level0 = new java.util.ArrayList<>(list_1.size()); - this.FileList_size += level0_TagEncodeSize * list_1.size();// add tag length - for (com.SSTable value_1 : list_1) { - this.level0.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.FileList_size += length_1; - } - } - public com.SSTable getLevel0(int index) { - if (this.level0 == null) { - return null; - } - - return this.level0.get(index); - } - - public int getLevel0Size() { - if (this.level0 == null) { - return 0; - } - - return this.level0.size(); - } - - private static void decode_level0(ByteBuf buf, FileList a_1) { - com.SSTable value_1 = null; - value_1 = com.SSTable.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_level0(value_1); - } - - private void encode_level0(ByteBuf buf) { - for (com.SSTable value_1 : level0) { - Serializer.encodeVarInt32(buf, level0_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_level0(com.SSTable value) { - if (this.level0 == null) { - this.level0 = new java.util.ArrayList<>(); - } - - this.level0.add(value); - } - - public boolean hasLevel0() { - if (this.level0 == null) { - return false; - } - return this.level0.size() != 0; - } - - private java.util.List level1; - public final static int level1_Num = 2; - public final static int level1_Tag = 18;// the value is num<<3|wireType - public final static int level1_TagEncodeSize = 1; - - private void set_level1(java.util.List list_1) { - this.level1 = new java.util.ArrayList<>(list_1.size()); - this.FileList_size += level1_TagEncodeSize * list_1.size();// add tag length - for (com.SSTable value_1 : list_1) { - this.level1.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.FileList_size += length_1; - } - } - public com.SSTable getLevel1(int index) { - if (this.level1 == null) { - return null; - } - - return this.level1.get(index); - } - - public int getLevel1Size() { - if (this.level1 == null) { - return 0; - } - - return this.level1.size(); - } - - private static void decode_level1(ByteBuf buf, FileList a_1) { - com.SSTable value_1 = null; - value_1 = com.SSTable.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_level1(value_1); - } - - private void encode_level1(ByteBuf buf) { - for (com.SSTable value_1 : level1) { - Serializer.encodeVarInt32(buf, level1_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_level1(com.SSTable value) { - if (this.level1 == null) { - this.level1 = new java.util.ArrayList<>(); - } - - this.level1.add(value); - } - - public boolean hasLevel1() { - if (this.level1 == null) { - return false; - } - return this.level1.size() != 0; - } - - private java.util.List level2; - public final static int level2_Num = 3; - public final static int level2_Tag = 26;// the value is num<<3|wireType - public final static int level2_TagEncodeSize = 1; - - private void set_level2(java.util.List list_1) { - this.level2 = new java.util.ArrayList<>(list_1.size()); - this.FileList_size += level2_TagEncodeSize * list_1.size();// add tag length - for (com.SSTable value_1 : list_1) { - this.level2.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.FileList_size += length_1; - } - } - public com.SSTable getLevel2(int index) { - if (this.level2 == null) { - return null; - } - - return this.level2.get(index); - } - - public int getLevel2Size() { - if (this.level2 == null) { - return 0; - } - - return this.level2.size(); - } - - private static void decode_level2(ByteBuf buf, FileList a_1) { - com.SSTable value_1 = null; - value_1 = com.SSTable.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_level2(value_1); - } - - private void encode_level2(ByteBuf buf) { - for (com.SSTable value_1 : level2) { - Serializer.encodeVarInt32(buf, level2_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_level2(com.SSTable value) { - if (this.level2 == null) { - this.level2 = new java.util.ArrayList<>(); - } - - this.level2.add(value); - } - - public boolean hasLevel2() { - if (this.level2 == null) { - return false; - } - return this.level2.size() != 0; - } - - private java.util.List level3; - public final static int level3_Num = 4; - public final static int level3_Tag = 34;// the value is num<<3|wireType - public final static int level3_TagEncodeSize = 1; - - private void set_level3(java.util.List list_1) { - this.level3 = new java.util.ArrayList<>(list_1.size()); - this.FileList_size += level3_TagEncodeSize * list_1.size();// add tag length - for (com.SSTable value_1 : list_1) { - this.level3.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.FileList_size += length_1; - } - } - public com.SSTable getLevel3(int index) { - if (this.level3 == null) { - return null; - } - - return this.level3.get(index); - } - - public int getLevel3Size() { - if (this.level3 == null) { - return 0; - } - - return this.level3.size(); - } - - private static void decode_level3(ByteBuf buf, FileList a_1) { - com.SSTable value_1 = null; - value_1 = com.SSTable.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_level3(value_1); - } - - private void encode_level3(ByteBuf buf) { - for (com.SSTable value_1 : level3) { - Serializer.encodeVarInt32(buf, level3_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_level3(com.SSTable value) { - if (this.level3 == null) { - this.level3 = new java.util.ArrayList<>(); - } - - this.level3.add(value); - } - - public boolean hasLevel3() { - if (this.level3 == null) { - return false; - } - return this.level3.size() != 0; - } - - private java.util.List level4; - public final static int level4_Num = 5; - public final static int level4_Tag = 42;// the value is num<<3|wireType - public final static int level4_TagEncodeSize = 1; - - private void set_level4(java.util.List list_1) { - this.level4 = new java.util.ArrayList<>(list_1.size()); - this.FileList_size += level4_TagEncodeSize * list_1.size();// add tag length - for (com.SSTable value_1 : list_1) { - this.level4.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.FileList_size += length_1; - } - } - public com.SSTable getLevel4(int index) { - if (this.level4 == null) { - return null; - } - - return this.level4.get(index); - } - - public int getLevel4Size() { - if (this.level4 == null) { - return 0; - } - - return this.level4.size(); - } - - private static void decode_level4(ByteBuf buf, FileList a_1) { - com.SSTable value_1 = null; - value_1 = com.SSTable.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_level4(value_1); - } - - private void encode_level4(ByteBuf buf) { - for (com.SSTable value_1 : level4) { - Serializer.encodeVarInt32(buf, level4_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_level4(com.SSTable value) { - if (this.level4 == null) { - this.level4 = new java.util.ArrayList<>(); - } - - this.level4.add(value); - } - - public boolean hasLevel4() { - if (this.level4 == null) { - return false; - } - return this.level4.size() != 0; - } - - public static FileList decode(ByteBuf buf) { - FileList value_1 = new FileList(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case level0_Tag : - decode_level0(buf, value_1); - break; - case level1_Tag : - decode_level1(buf, value_1); - break; - case level2_Tag : - decode_level2(buf, value_1); - break; - case level3_Tag : - decode_level3(buf, value_1); - break; - case level4_Tag : - decode_level4(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.FileList_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasLevel0()) { - this.encode_level0(buf); - } - - if (hasLevel1()) { - this.encode_level1(buf); - } - - if (hasLevel2()) { - this.encode_level2(buf); - } - - if (hasLevel3()) { - this.encode_level3(buf); - } - - if (hasLevel4()) { - this.encode_level4(buf); - } - - } - public static FileList decode(ByteBuf buf, int length_1) { - FileList value_1 = new FileList(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case level0_Tag : - decode_level0(buf, value_1); - break; - case level1_Tag : - decode_level1(buf, value_1); - break; - case level2_Tag : - decode_level2(buf, value_1); - break; - case level3_Tag : - decode_level3(buf, value_1); - break; - case level4_Tag : - decode_level4(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.FileList_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.FileList_size; - } - - public static FileListBuild newBuilder() { - return new FileListBuild(); - } - - private void verify() { - } - - public static class FileListBuild { - private java.util.List level0; - private java.util.List level1; - private java.util.List level2; - private java.util.List level3; - private java.util.List level4; - - public FileListBuild addLevel0(com.SSTable a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.level0 == null) { - this.level0 = new java.util.ArrayList<>(); - this.level0.add(a); - } else { - this.level0.add(a); - } - return this; - } - - public com.SSTable getLevel0(int index) { - if (this.level0 == null || index >= this.level0.size()) { - throw new RuntimeException("level0 is null or index bigger than level0 size"); - } - - return this.level0.get(index); - } - - public FileListBuild removeLevel0(int index) { - if (this.level0 == null || index >= this.level0.size()) { - throw new RuntimeException("level0 is null or index bigger than level0 size"); - } - - this.level0.remove(index); - return this; - - } - - public int sizeLevel0() { - if (this.level0 == null) { - throw new RuntimeException("level0 is null"); - } - - return this.level0.size(); - } - - public FileListBuild clearLevel0() { - this.level0 = null; - return this; - } - - public boolean hasLevel0() { - if (this.level0 == null) { - return false; - } - return this.level0.size() != 0; - } - - public FileListBuild addLevel1(com.SSTable a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.level1 == null) { - this.level1 = new java.util.ArrayList<>(); - this.level1.add(a); - } else { - this.level1.add(a); - } - return this; - } - - public com.SSTable getLevel1(int index) { - if (this.level1 == null || index >= this.level1.size()) { - throw new RuntimeException("level1 is null or index bigger than level1 size"); - } - - return this.level1.get(index); - } - - public FileListBuild removeLevel1(int index) { - if (this.level1 == null || index >= this.level1.size()) { - throw new RuntimeException("level1 is null or index bigger than level1 size"); - } - - this.level1.remove(index); - return this; - - } - - public int sizeLevel1() { - if (this.level1 == null) { - throw new RuntimeException("level1 is null"); - } - - return this.level1.size(); - } - - public FileListBuild clearLevel1() { - this.level1 = null; - return this; - } - - public boolean hasLevel1() { - if (this.level1 == null) { - return false; - } - return this.level1.size() != 0; - } - - public FileListBuild addLevel2(com.SSTable a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.level2 == null) { - this.level2 = new java.util.ArrayList<>(); - this.level2.add(a); - } else { - this.level2.add(a); - } - return this; - } - - public com.SSTable getLevel2(int index) { - if (this.level2 == null || index >= this.level2.size()) { - throw new RuntimeException("level2 is null or index bigger than level2 size"); - } - - return this.level2.get(index); - } - - public FileListBuild removeLevel2(int index) { - if (this.level2 == null || index >= this.level2.size()) { - throw new RuntimeException("level2 is null or index bigger than level2 size"); - } - - this.level2.remove(index); - return this; - - } - - public int sizeLevel2() { - if (this.level2 == null) { - throw new RuntimeException("level2 is null"); - } - - return this.level2.size(); - } - - public FileListBuild clearLevel2() { - this.level2 = null; - return this; - } - - public boolean hasLevel2() { - if (this.level2 == null) { - return false; - } - return this.level2.size() != 0; - } - - public FileListBuild addLevel3(com.SSTable a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.level3 == null) { - this.level3 = new java.util.ArrayList<>(); - this.level3.add(a); - } else { - this.level3.add(a); - } - return this; - } - - public com.SSTable getLevel3(int index) { - if (this.level3 == null || index >= this.level3.size()) { - throw new RuntimeException("level3 is null or index bigger than level3 size"); - } - - return this.level3.get(index); - } - - public FileListBuild removeLevel3(int index) { - if (this.level3 == null || index >= this.level3.size()) { - throw new RuntimeException("level3 is null or index bigger than level3 size"); - } - - this.level3.remove(index); - return this; - - } - - public int sizeLevel3() { - if (this.level3 == null) { - throw new RuntimeException("level3 is null"); - } - - return this.level3.size(); - } - - public FileListBuild clearLevel3() { - this.level3 = null; - return this; - } - - public boolean hasLevel3() { - if (this.level3 == null) { - return false; - } - return this.level3.size() != 0; - } - - public FileListBuild addLevel4(com.SSTable a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.level4 == null) { - this.level4 = new java.util.ArrayList<>(); - this.level4.add(a); - } else { - this.level4.add(a); - } - return this; - } - - public com.SSTable getLevel4(int index) { - if (this.level4 == null || index >= this.level4.size()) { - throw new RuntimeException("level4 is null or index bigger than level4 size"); - } - - return this.level4.get(index); - } - - public FileListBuild removeLevel4(int index) { - if (this.level4 == null || index >= this.level4.size()) { - throw new RuntimeException("level4 is null or index bigger than level4 size"); - } - - this.level4.remove(index); - return this; - - } - - public int sizeLevel4() { - if (this.level4 == null) { - throw new RuntimeException("level4 is null"); - } - - return this.level4.size(); - } - - public FileListBuild clearLevel4() { - this.level4 = null; - return this; - } - - public boolean hasLevel4() { - if (this.level4 == null) { - return false; - } - return this.level4.size() != 0; - } - - public FileList build() { - FileList value_1 = new FileList(); - if (this.hasLevel0()) { - value_1.set_level0(this.level0); - } - if (this.hasLevel1()) { - value_1.set_level1(this.level1); - } - if (this.hasLevel2()) { - value_1.set_level2(this.level2); - } - if (this.hasLevel3()) { - value_1.set_level3(this.level3); - } - if (this.hasLevel4()) { - value_1.set_level4(this.level4); - } - return value_1; - } - public FileListBuild clear() { - this.level0 = null; - this.level1 = null; - this.level2 = null; - this.level3 = null; - this.level4 = null; - return this; - } - - private FileListBuild() { - } - } - -} diff --git a/src/test/java/com/IntKey.java b/src/test/java/com/IntKey.java deleted file mode 100644 index 1456539..0000000 --- a/src/test/java/com/IntKey.java +++ /dev/null @@ -1,135 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class IntKey { - - private int IntKey_size = 0; - - private java.lang.Integer key; - public final static int key_Num = 1; - public final static int key_Tag = 8;// the value is num<<<3|wireType - public final static int key_TagEncodeSize = 1; - - private void encode_key(ByteBuf buf) { - Serializer.encodeVarInt32(buf, key_Tag); - Serializer.encodeVarInt32(buf, this.key); - } - - private static void decode_key(ByteBuf buf, IntKey a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.key = value_1; - } - - private void set_key(java.lang.Integer value_1) { - IntKey_size += key_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - IntKey_size += size_1; - this.key = value_1; - } - - public java.lang.Integer getKey() { - return this.key; - } - - private boolean hasKey() { - return this.key != null; - } - - public static IntKey decode(ByteBuf buf) { - IntKey value_1 = new IntKey(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.IntKey_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasKey()) { - this.encode_key(buf); - } - - } - public static IntKey decode(ByteBuf buf, int length_1) { - IntKey value_1 = new IntKey(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.IntKey_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.IntKey_size; - } - - public static IntKeyBuild newBuilder() { - return new IntKeyBuild(); - } - - private void verify() { - if (this.key == null) { - throw new RuntimeException("required key"); - } - } - - public static class IntKeyBuild { - private java.lang.Integer key; - - public IntKeyBuild setKey(java.lang.Integer a) { - this.key = a; - return this; - } - - public java.lang.Integer getKey() { - return this.key; - } - - public IntKeyBuild clearKey() { - this.key = null; - return this; - } - - public boolean hasKey() { - return this.key != null; - } - - public IntKey build() { - IntKey value_1 = new IntKey(); - if (this.key == null) { - throw new RuntimeException(" key is required"); - } - value_1.set_key(this.key); - return value_1; - } - public IntKeyBuild clear() { - this.key = null; - return this; - } - - private IntKeyBuild() { - } - } - -} diff --git a/src/test/java/com/IntValue.java b/src/test/java/com/IntValue.java deleted file mode 100644 index de2c08c..0000000 --- a/src/test/java/com/IntValue.java +++ /dev/null @@ -1,135 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class IntValue { - - private int IntValue_size = 0; - - private java.lang.Integer value; - public final static int value_Num = 1; - public final static int value_Tag = 8;// the value is num<<<3|wireType - public final static int value_TagEncodeSize = 1; - - private void encode_value(ByteBuf buf) { - Serializer.encodeVarInt32(buf, value_Tag); - Serializer.encodeVarInt32(buf, this.value); - } - - private static void decode_value(ByteBuf buf, IntValue a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.value = value_1; - } - - private void set_value(java.lang.Integer value_1) { - IntValue_size += value_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - IntValue_size += size_1; - this.value = value_1; - } - - public java.lang.Integer getValue() { - return this.value; - } - - private boolean hasValue() { - return this.value != null; - } - - public static IntValue decode(ByteBuf buf) { - IntValue value_1 = new IntValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case value_Tag : - decode_value(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.IntValue_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasValue()) { - this.encode_value(buf); - } - - } - public static IntValue decode(ByteBuf buf, int length_1) { - IntValue value_1 = new IntValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case value_Tag : - decode_value(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.IntValue_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.IntValue_size; - } - - public static IntValueBuild newBuilder() { - return new IntValueBuild(); - } - - private void verify() { - if (this.value == null) { - throw new RuntimeException("required value"); - } - } - - public static class IntValueBuild { - private java.lang.Integer value; - - public IntValueBuild setValue(java.lang.Integer a) { - this.value = a; - return this; - } - - public java.lang.Integer getValue() { - return this.value; - } - - public IntValueBuild clearValue() { - this.value = null; - return this; - } - - public boolean hasValue() { - return this.value != null; - } - - public IntValue build() { - IntValue value_1 = new IntValue(); - if (this.value == null) { - throw new RuntimeException(" value is required"); - } - value_1.set_value(this.value); - return value_1; - } - public IntValueBuild clear() { - this.value = null; - return this; - } - - private IntValueBuild() { - } - } - -} diff --git a/src/test/java/com/Key.java b/src/test/java/com/Key.java deleted file mode 100644 index a83b685..0000000 --- a/src/test/java/com/Key.java +++ /dev/null @@ -1,269 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class Key { - - private int Key_size = 0; - - private com.IntKey intkey; - public final static int intkey_Num = 1; - public final static int intkey_Tag = 10;// the value is num<<<3|wireType - public final static int intkey_TagEncodeSize = 1; - - private void encode_intkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, intkey_Tag); - Serializer.encodeVarInt32(buf, this.intkey.getByteSize()); - this.intkey.encode(buf); - } - - private static void decode_intkey(ByteBuf buf, Key a_1) { - com.IntKey value_1 = null; - value_1 = com.IntKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.intkey = value_1; - } - - private void set_intkey(com.IntKey value_1) { - Key_size += intkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - Key_size += size_1; - this.intkey = value_1; - } - - public com.IntKey getIntkey() { - return this.intkey; - } - - private boolean hasIntkey() { - return this.intkey != null; - } - - private com.LongKey longkey; - public final static int longkey_Num = 2; - public final static int longkey_Tag = 18;// the value is num<<<3|wireType - public final static int longkey_TagEncodeSize = 1; - - private void encode_longkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longkey_Tag); - Serializer.encodeVarInt32(buf, this.longkey.getByteSize()); - this.longkey.encode(buf); - } - - private static void decode_longkey(ByteBuf buf, Key a_1) { - com.LongKey value_1 = null; - value_1 = com.LongKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.longkey = value_1; - } - - private void set_longkey(com.LongKey value_1) { - Key_size += longkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - Key_size += size_1; - this.longkey = value_1; - } - - public com.LongKey getLongkey() { - return this.longkey; - } - - private boolean hasLongkey() { - return this.longkey != null; - } - - private com.ByteKey bytekey; - public final static int bytekey_Num = 3; - public final static int bytekey_Tag = 26;// the value is num<<<3|wireType - public final static int bytekey_TagEncodeSize = 1; - - private void encode_bytekey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, bytekey_Tag); - Serializer.encodeVarInt32(buf, this.bytekey.getByteSize()); - this.bytekey.encode(buf); - } - - private static void decode_bytekey(ByteBuf buf, Key a_1) { - com.ByteKey value_1 = null; - value_1 = com.ByteKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.bytekey = value_1; - } - - private void set_bytekey(com.ByteKey value_1) { - Key_size += bytekey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - Key_size += size_1; - this.bytekey = value_1; - } - - public com.ByteKey getBytekey() { - return this.bytekey; - } - - private boolean hasBytekey() { - return this.bytekey != null; - } - - public static Key decode(ByteBuf buf) { - Key value_1 = new Key(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case intkey_Tag : - decode_intkey(buf, value_1); - break; - case longkey_Tag : - decode_longkey(buf, value_1); - break; - case bytekey_Tag : - decode_bytekey(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.Key_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasIntkey()) { - this.encode_intkey(buf); - } - - if (hasLongkey()) { - this.encode_longkey(buf); - } - - if (hasBytekey()) { - this.encode_bytekey(buf); - } - - } - public static Key decode(ByteBuf buf, int length_1) { - Key value_1 = new Key(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case intkey_Tag : - decode_intkey(buf, value_1); - break; - case longkey_Tag : - decode_longkey(buf, value_1); - break; - case bytekey_Tag : - decode_bytekey(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.Key_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.Key_size; - } - - public static KeyBuild newBuilder() { - return new KeyBuild(); - } - - private void verify() { - } - - public static class KeyBuild { - private com.IntKey intkey; - private com.LongKey longkey; - private com.ByteKey bytekey; - - public KeyBuild setIntkey(com.IntKey a) { - this.intkey = a; - return this; - } - - public com.IntKey getIntkey() { - return this.intkey; - } - - public KeyBuild clearIntkey() { - this.intkey = null; - return this; - } - - public boolean hasIntkey() { - return this.intkey != null; - } - - public KeyBuild setLongkey(com.LongKey a) { - this.longkey = a; - return this; - } - - public com.LongKey getLongkey() { - return this.longkey; - } - - public KeyBuild clearLongkey() { - this.longkey = null; - return this; - } - - public boolean hasLongkey() { - return this.longkey != null; - } - - public KeyBuild setBytekey(com.ByteKey a) { - this.bytekey = a; - return this; - } - - public com.ByteKey getBytekey() { - return this.bytekey; - } - - public KeyBuild clearBytekey() { - this.bytekey = null; - return this; - } - - public boolean hasBytekey() { - return this.bytekey != null; - } - - public Key build() { - Key value_1 = new Key(); - if (this.intkey != null) { - value_1.set_intkey(this.intkey); - } - if (this.longkey != null) { - value_1.set_longkey(this.longkey); - } - if (this.bytekey != null) { - value_1.set_bytekey(this.bytekey); - } - return value_1; - } - public KeyBuild clear() { - this.intkey = null; - this.longkey = null; - this.bytekey = null; - return this; - } - - private KeyBuild() { - } - } - -} diff --git a/src/test/java/com/KeyType.java b/src/test/java/com/KeyType.java deleted file mode 100644 index a12b24f..0000000 --- a/src/test/java/com/KeyType.java +++ /dev/null @@ -1,32 +0,0 @@ -package com; -public enum KeyType { - - intKey(1), - - longKey(2), - - bytesKey(3), - - ; - public static KeyType get(int tag) { - if (tag == 1) { - return KeyType.intKey; - } - if (tag == 2) { - return KeyType.longKey; - } - if (tag == 3) { - return KeyType.bytesKey; - } - return null; - } - int num; - - KeyType(int num) { - this.num = num; - } - - int getNum() { - return this.num; - } -} diff --git a/src/test/java/com/KeyValue.java b/src/test/java/com/KeyValue.java deleted file mode 100644 index 5225a91..0000000 --- a/src/test/java/com/KeyValue.java +++ /dev/null @@ -1,773 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class KeyValue { - - private int KeyValue_size = 0; - - private byte[] key; - public final static int key_Num = 1; - public final static int key_Tag = 10;// the value is num<<<3|wireType - public final static int key_TagEncodeSize = 1; - - private void encode_key(ByteBuf buf) { - Serializer.encodeVarInt32(buf, key_Tag); - Serializer.encodeByteString(buf, this.key); - } - - private static void decode_key(ByteBuf buf, KeyValue a_1) { - byte[] value_1 = null; - value_1 = Serializer.decodeByteString(buf, Serializer.decodeVarInt32(buf)); - a_1.key = value_1; - } - - private void set_key(byte[] value_1) { - KeyValue_size += key_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.length); - size_1 += value_1.length; - KeyValue_size += size_1; - this.key = value_1; - } - - public byte[] getKey() { - return this.key; - } - - private boolean hasKey() { - return this.key != null; - } - - private java.lang.Integer intkey; - public final static int intkey_Num = 2; - public final static int intkey_Tag = 16;// the value is num<<<3|wireType - public final static int intkey_TagEncodeSize = 1; - - private void encode_intkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, intkey_Tag); - Serializer.encodeVarInt32(buf, this.intkey); - } - - private static void decode_intkey(ByteBuf buf, KeyValue a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.intkey = value_1; - } - - private void set_intkey(java.lang.Integer value_1) { - KeyValue_size += intkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - KeyValue_size += size_1; - this.intkey = value_1; - } - - public java.lang.Integer getIntkey() { - return this.intkey; - } - - private boolean hasIntkey() { - return this.intkey != null; - } - - private java.lang.Long longkey; - public final static int longkey_Num = 3; - public final static int longkey_Tag = 24;// the value is num<<<3|wireType - public final static int longkey_TagEncodeSize = 1; - - private void encode_longkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longkey_Tag); - Serializer.encodeVarInt64(buf, this.longkey); - } - - private static void decode_longkey(ByteBuf buf, KeyValue a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.longkey = value_1; - } - - private void set_longkey(java.lang.Long value_1) { - KeyValue_size += longkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - KeyValue_size += size_1; - this.longkey = value_1; - } - - public java.lang.Long getLongkey() { - return this.longkey; - } - - private boolean hasLongkey() { - return this.longkey != null; - } - - private byte[] value; - public final static int value_Num = 4; - public final static int value_Tag = 34;// the value is num<<<3|wireType - public final static int value_TagEncodeSize = 1; - - private void encode_value(ByteBuf buf) { - Serializer.encodeVarInt32(buf, value_Tag); - Serializer.encodeByteString(buf, this.value); - } - - private static void decode_value(ByteBuf buf, KeyValue a_1) { - byte[] value_1 = null; - value_1 = Serializer.decodeByteString(buf, Serializer.decodeVarInt32(buf)); - a_1.value = value_1; - } - - private void set_value(byte[] value_1) { - KeyValue_size += value_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.length); - size_1 += value_1.length; - KeyValue_size += size_1; - this.value = value_1; - } - - public byte[] getValue() { - return this.value; - } - - private boolean hasValue() { - return this.value != null; - } - - private java.lang.Integer intvalue; - public final static int intvalue_Num = 5; - public final static int intvalue_Tag = 40;// the value is num<<<3|wireType - public final static int intvalue_TagEncodeSize = 1; - - private void encode_intvalue(ByteBuf buf) { - Serializer.encodeVarInt32(buf, intvalue_Tag); - Serializer.encodeVarInt32(buf, this.intvalue); - } - - private static void decode_intvalue(ByteBuf buf, KeyValue a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.intvalue = value_1; - } - - private void set_intvalue(java.lang.Integer value_1) { - KeyValue_size += intvalue_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - KeyValue_size += size_1; - this.intvalue = value_1; - } - - public java.lang.Integer getIntvalue() { - return this.intvalue; - } - - private boolean hasIntvalue() { - return this.intvalue != null; - } - - private java.lang.Long longvalue; - public final static int longvalue_Num = 6; - public final static int longvalue_Tag = 48;// the value is num<<<3|wireType - public final static int longvalue_TagEncodeSize = 1; - - private void encode_longvalue(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longvalue_Tag); - Serializer.encodeVarInt64(buf, this.longvalue); - } - - private static void decode_longvalue(ByteBuf buf, KeyValue a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.longvalue = value_1; - } - - private void set_longvalue(java.lang.Long value_1) { - KeyValue_size += longvalue_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - KeyValue_size += size_1; - this.longvalue = value_1; - } - - public java.lang.Long getLongvalue() { - return this.longvalue; - } - - private boolean hasLongvalue() { - return this.longvalue != null; - } - - private com.PrepareId prepareid; - public final static int prepareid_Num = 7; - public final static int prepareid_Tag = 58;// the value is num<<<3|wireType - public final static int prepareid_TagEncodeSize = 1; - - private void encode_prepareid(ByteBuf buf) { - Serializer.encodeVarInt32(buf, prepareid_Tag); - Serializer.encodeVarInt32(buf, this.prepareid.getByteSize()); - this.prepareid.encode(buf); - } - - private static void decode_prepareid(ByteBuf buf, KeyValue a_1) { - com.PrepareId value_1 = null; - value_1 = com.PrepareId.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.prepareid = value_1; - } - - private void set_prepareid(com.PrepareId value_1) { - KeyValue_size += prepareid_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - KeyValue_size += size_1; - this.prepareid = value_1; - } - - public com.PrepareId getPrepareid() { - return this.prepareid; - } - - private boolean hasPrepareid() { - return this.prepareid != null; - } - - private com.SequenceNumber seq; - public final static int seq_Num = 8; - public final static int seq_Tag = 66;// the value is num<<<3|wireType - public final static int seq_TagEncodeSize = 1; - - private void encode_seq(ByteBuf buf) { - Serializer.encodeVarInt32(buf, seq_Tag); - Serializer.encodeVarInt32(buf, this.seq.getByteSize()); - this.seq.encode(buf); - } - - private static void decode_seq(ByteBuf buf, KeyValue a_1) { - com.SequenceNumber value_1 = null; - value_1 = com.SequenceNumber.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.seq = value_1; - } - - private void set_seq(com.SequenceNumber value_1) { - KeyValue_size += seq_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - KeyValue_size += size_1; - this.seq = value_1; - } - - public com.SequenceNumber getSeq() { - return this.seq; - } - - private boolean hasSeq() { - return this.seq != null; - } - - private com.CommitId commitid; - public final static int commitid_Num = 9; - public final static int commitid_Tag = 74;// the value is num<<<3|wireType - public final static int commitid_TagEncodeSize = 1; - - private void encode_commitid(ByteBuf buf) { - Serializer.encodeVarInt32(buf, commitid_Tag); - Serializer.encodeVarInt32(buf, this.commitid.getByteSize()); - this.commitid.encode(buf); - } - - private static void decode_commitid(ByteBuf buf, KeyValue a_1) { - com.CommitId value_1 = null; - value_1 = com.CommitId.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.commitid = value_1; - } - - private void set_commitid(com.CommitId value_1) { - KeyValue_size += commitid_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - KeyValue_size += size_1; - this.commitid = value_1; - } - - public com.CommitId getCommitid() { - return this.commitid; - } - - private boolean hasCommitid() { - return this.commitid != null; - } - - private com.KeyValue.Type type; - public final static int type_Num = 10; - public final static int type_Tag = 80;// the value is num<<<3|wireType - public final static int type_TagEncodeSize = 1; - - private void encode_type(ByteBuf buf) { - Serializer.encodeVarInt32(buf, type_Tag); - Serializer.encodeVarInt32(buf, this.type.getNum()); - } - - private static void decode_type(ByteBuf buf, KeyValue a_1) { - com.KeyValue.Type value_1 = null; - value_1 = com.KeyValue.Type.get(Serializer.decodeVarInt32(buf)); - a_1.type = value_1; - } - - private void set_type(com.KeyValue.Type value_1) { - KeyValue_size += type_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getNum()); - KeyValue_size += size_1; - this.type = value_1; - } - - public com.KeyValue.Type getType() { - return this.type; - } - - private boolean hasType() { - return this.type != null; - } - - public static KeyValue decode(ByteBuf buf) { - KeyValue value_1 = new KeyValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - case intkey_Tag : - decode_intkey(buf, value_1); - break; - case longkey_Tag : - decode_longkey(buf, value_1); - break; - case value_Tag : - decode_value(buf, value_1); - break; - case intvalue_Tag : - decode_intvalue(buf, value_1); - break; - case longvalue_Tag : - decode_longvalue(buf, value_1); - break; - case prepareid_Tag : - decode_prepareid(buf, value_1); - break; - case seq_Tag : - decode_seq(buf, value_1); - break; - case commitid_Tag : - decode_commitid(buf, value_1); - break; - case type_Tag : - decode_type(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.KeyValue_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasKey()) { - this.encode_key(buf); - } - - if (hasIntkey()) { - this.encode_intkey(buf); - } - - if (hasLongkey()) { - this.encode_longkey(buf); - } - - if (hasValue()) { - this.encode_value(buf); - } - - if (hasIntvalue()) { - this.encode_intvalue(buf); - } - - if (hasLongvalue()) { - this.encode_longvalue(buf); - } - - if (hasPrepareid()) { - this.encode_prepareid(buf); - } - - if (hasSeq()) { - this.encode_seq(buf); - } - - if (hasCommitid()) { - this.encode_commitid(buf); - } - - if (hasType()) { - this.encode_type(buf); - } - - } - public static KeyValue decode(ByteBuf buf, int length_1) { - KeyValue value_1 = new KeyValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - case intkey_Tag : - decode_intkey(buf, value_1); - break; - case longkey_Tag : - decode_longkey(buf, value_1); - break; - case value_Tag : - decode_value(buf, value_1); - break; - case intvalue_Tag : - decode_intvalue(buf, value_1); - break; - case longvalue_Tag : - decode_longvalue(buf, value_1); - break; - case prepareid_Tag : - decode_prepareid(buf, value_1); - break; - case seq_Tag : - decode_seq(buf, value_1); - break; - case commitid_Tag : - decode_commitid(buf, value_1); - break; - case type_Tag : - decode_type(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.KeyValue_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.KeyValue_size; - } - - public static KeyValueBuild newBuilder() { - return new KeyValueBuild(); - } - - private void verify() { - if (this.seq == null) { - throw new RuntimeException("required seq"); - } - if (this.type == null) { - throw new RuntimeException("required type"); - } - } - - public static class KeyValueBuild { - private byte[] key; - private java.lang.Integer intkey; - private java.lang.Long longkey; - private byte[] value; - private java.lang.Integer intvalue; - private java.lang.Long longvalue; - private com.PrepareId prepareid; - private com.SequenceNumber seq; - private com.CommitId commitid; - private com.KeyValue.Type type; - - public KeyValueBuild setKey(byte[] a) { - this.key = a; - return this; - } - - public byte[] getKey() { - return this.key; - } - - public KeyValueBuild clearKey() { - this.key = null; - return this; - } - - public boolean hasKey() { - return this.key != null; - } - - public KeyValueBuild setIntkey(java.lang.Integer a) { - this.intkey = a; - return this; - } - - public java.lang.Integer getIntkey() { - return this.intkey; - } - - public KeyValueBuild clearIntkey() { - this.intkey = null; - return this; - } - - public boolean hasIntkey() { - return this.intkey != null; - } - - public KeyValueBuild setLongkey(java.lang.Long a) { - this.longkey = a; - return this; - } - - public java.lang.Long getLongkey() { - return this.longkey; - } - - public KeyValueBuild clearLongkey() { - this.longkey = null; - return this; - } - - public boolean hasLongkey() { - return this.longkey != null; - } - - public KeyValueBuild setValue(byte[] a) { - this.value = a; - return this; - } - - public byte[] getValue() { - return this.value; - } - - public KeyValueBuild clearValue() { - this.value = null; - return this; - } - - public boolean hasValue() { - return this.value != null; - } - - public KeyValueBuild setIntvalue(java.lang.Integer a) { - this.intvalue = a; - return this; - } - - public java.lang.Integer getIntvalue() { - return this.intvalue; - } - - public KeyValueBuild clearIntvalue() { - this.intvalue = null; - return this; - } - - public boolean hasIntvalue() { - return this.intvalue != null; - } - - public KeyValueBuild setLongvalue(java.lang.Long a) { - this.longvalue = a; - return this; - } - - public java.lang.Long getLongvalue() { - return this.longvalue; - } - - public KeyValueBuild clearLongvalue() { - this.longvalue = null; - return this; - } - - public boolean hasLongvalue() { - return this.longvalue != null; - } - - public KeyValueBuild setPrepareid(com.PrepareId a) { - this.prepareid = a; - return this; - } - - public com.PrepareId getPrepareid() { - return this.prepareid; - } - - public KeyValueBuild clearPrepareid() { - this.prepareid = null; - return this; - } - - public boolean hasPrepareid() { - return this.prepareid != null; - } - - public KeyValueBuild setSeq(com.SequenceNumber a) { - this.seq = a; - return this; - } - - public com.SequenceNumber getSeq() { - return this.seq; - } - - public KeyValueBuild clearSeq() { - this.seq = null; - return this; - } - - public boolean hasSeq() { - return this.seq != null; - } - - public KeyValueBuild setCommitid(com.CommitId a) { - this.commitid = a; - return this; - } - - public com.CommitId getCommitid() { - return this.commitid; - } - - public KeyValueBuild clearCommitid() { - this.commitid = null; - return this; - } - - public boolean hasCommitid() { - return this.commitid != null; - } - - public KeyValueBuild setType(com.KeyValue.Type a) { - this.type = a; - return this; - } - - public com.KeyValue.Type getType() { - return this.type; - } - - public KeyValueBuild clearType() { - this.type = null; - return this; - } - - public boolean hasType() { - return this.type != null; - } - - public KeyValue build() { - KeyValue value_1 = new KeyValue(); - if (this.key != null) { - value_1.set_key(this.key); - } - if (this.intkey != null) { - value_1.set_intkey(this.intkey); - } - if (this.longkey != null) { - value_1.set_longkey(this.longkey); - } - if (this.value != null) { - value_1.set_value(this.value); - } - if (this.intvalue != null) { - value_1.set_intvalue(this.intvalue); - } - if (this.longvalue != null) { - value_1.set_longvalue(this.longvalue); - } - if (this.prepareid != null) { - value_1.set_prepareid(this.prepareid); - } - if (this.seq == null) { - throw new RuntimeException(" seq is required"); - } - value_1.set_seq(this.seq); - if (this.commitid != null) { - value_1.set_commitid(this.commitid); - } - if (this.type == null) { - throw new RuntimeException(" type is required"); - } - value_1.set_type(this.type); - return value_1; - } - public KeyValueBuild clear() { - this.key = null; - this.intkey = null; - this.longkey = null; - this.value = null; - this.intvalue = null; - this.longvalue = null; - this.prepareid = null; - this.seq = null; - this.commitid = null; - this.type = null; - return this; - } - - private KeyValueBuild() { - } - } - - public static enum Type { - - delete(1), - - update(2), - - insert(3), - - ; - public static Type get(int tag) { - if (tag == 1) { - return Type.delete; - } - if (tag == 2) { - return Type.update; - } - if (tag == 3) { - return Type.insert; - } - return null; - } - int num; - - Type(int num) { - this.num = num; - } - - int getNum() { - return this.num; - } - } - -} diff --git a/src/test/java/com/LongKey.java b/src/test/java/com/LongKey.java deleted file mode 100644 index 6c4e218..0000000 --- a/src/test/java/com/LongKey.java +++ /dev/null @@ -1,135 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class LongKey { - - private int LongKey_size = 0; - - private java.lang.Long key; - public final static int key_Num = 1; - public final static int key_Tag = 8;// the value is num<<<3|wireType - public final static int key_TagEncodeSize = 1; - - private void encode_key(ByteBuf buf) { - Serializer.encodeVarInt32(buf, key_Tag); - Serializer.encodeVarInt64(buf, this.key); - } - - private static void decode_key(ByteBuf buf, LongKey a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.key = value_1; - } - - private void set_key(java.lang.Long value_1) { - LongKey_size += key_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - LongKey_size += size_1; - this.key = value_1; - } - - public java.lang.Long getKey() { - return this.key; - } - - private boolean hasKey() { - return this.key != null; - } - - public static LongKey decode(ByteBuf buf) { - LongKey value_1 = new LongKey(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.LongKey_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasKey()) { - this.encode_key(buf); - } - - } - public static LongKey decode(ByteBuf buf, int length_1) { - LongKey value_1 = new LongKey(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.LongKey_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.LongKey_size; - } - - public static LongKeyBuild newBuilder() { - return new LongKeyBuild(); - } - - private void verify() { - if (this.key == null) { - throw new RuntimeException("required key"); - } - } - - public static class LongKeyBuild { - private java.lang.Long key; - - public LongKeyBuild setKey(java.lang.Long a) { - this.key = a; - return this; - } - - public java.lang.Long getKey() { - return this.key; - } - - public LongKeyBuild clearKey() { - this.key = null; - return this; - } - - public boolean hasKey() { - return this.key != null; - } - - public LongKey build() { - LongKey value_1 = new LongKey(); - if (this.key == null) { - throw new RuntimeException(" key is required"); - } - value_1.set_key(this.key); - return value_1; - } - public LongKeyBuild clear() { - this.key = null; - return this; - } - - private LongKeyBuild() { - } - } - -} diff --git a/src/test/java/com/LongValue.java b/src/test/java/com/LongValue.java deleted file mode 100644 index 8a74c4c..0000000 --- a/src/test/java/com/LongValue.java +++ /dev/null @@ -1,135 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class LongValue { - - private int LongValue_size = 0; - - private java.lang.Long value; - public final static int value_Num = 1; - public final static int value_Tag = 8;// the value is num<<<3|wireType - public final static int value_TagEncodeSize = 1; - - private void encode_value(ByteBuf buf) { - Serializer.encodeVarInt32(buf, value_Tag); - Serializer.encodeVarInt64(buf, this.value); - } - - private static void decode_value(ByteBuf buf, LongValue a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.value = value_1; - } - - private void set_value(java.lang.Long value_1) { - LongValue_size += value_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - LongValue_size += size_1; - this.value = value_1; - } - - public java.lang.Long getValue() { - return this.value; - } - - private boolean hasValue() { - return this.value != null; - } - - public static LongValue decode(ByteBuf buf) { - LongValue value_1 = new LongValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case value_Tag : - decode_value(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.LongValue_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasValue()) { - this.encode_value(buf); - } - - } - public static LongValue decode(ByteBuf buf, int length_1) { - LongValue value_1 = new LongValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case value_Tag : - decode_value(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.LongValue_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.LongValue_size; - } - - public static LongValueBuild newBuilder() { - return new LongValueBuild(); - } - - private void verify() { - if (this.value == null) { - throw new RuntimeException("required value"); - } - } - - public static class LongValueBuild { - private java.lang.Long value; - - public LongValueBuild setValue(java.lang.Long a) { - this.value = a; - return this; - } - - public java.lang.Long getValue() { - return this.value; - } - - public LongValueBuild clearValue() { - this.value = null; - return this; - } - - public boolean hasValue() { - return this.value != null; - } - - public LongValue build() { - LongValue value_1 = new LongValue(); - if (this.value == null) { - throw new RuntimeException(" value is required"); - } - value_1.set_value(this.value); - return value_1; - } - public LongValueBuild clear() { - this.value = null; - return this; - } - - private LongValueBuild() { - } - } - -} diff --git a/src/test/java/com/OffSetList.java b/src/test/java/com/OffSetList.java deleted file mode 100644 index a0087b5..0000000 --- a/src/test/java/com/OffSetList.java +++ /dev/null @@ -1,192 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class OffSetList { - - private int OffSetList_size = 0; - - private java.util.List list; - public final static int list_Num = 1; - public final static int list_Tag = 10;// the value is num<<3|wireType - public final static int list_TagEncodeSize = 1; - - private void set_list(java.util.List list_1) { - this.list = new java.util.ArrayList<>(list_1.size()); - this.OffSetList_size += list_TagEncodeSize * list_1.size();// add tag length - for (com.Offset value_1 : list_1) { - this.list.add(value_1); - int length_1 = 0; - length_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - length_1 += value_1.getByteSize(); - this.OffSetList_size += length_1; - } - } - public com.Offset getList(int index) { - if (this.list == null) { - return null; - } - - return this.list.get(index); - } - - public int getListSize() { - if (this.list == null) { - return 0; - } - - return this.list.size(); - } - - private static void decode_list(ByteBuf buf, OffSetList a_1) { - com.Offset value_1 = null; - value_1 = com.Offset.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.add_list(value_1); - } - - private void encode_list(ByteBuf buf) { - for (com.Offset value_1 : list) { - Serializer.encodeVarInt32(buf, list_Tag); - Serializer.encodeVarInt32(buf, value_1.getByteSize()); - value_1.encode(buf); - } - } - - private void add_list(com.Offset value) { - if (this.list == null) { - this.list = new java.util.ArrayList<>(); - } - - this.list.add(value); - } - - public boolean hasList() { - if (this.list == null) { - return false; - } - return this.list.size() != 0; - } - - public static OffSetList decode(ByteBuf buf) { - OffSetList value_1 = new OffSetList(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case list_Tag : - decode_list(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.OffSetList_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasList()) { - this.encode_list(buf); - } - - } - public static OffSetList decode(ByteBuf buf, int length_1) { - OffSetList value_1 = new OffSetList(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case list_Tag : - decode_list(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.OffSetList_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.OffSetList_size; - } - - public static OffSetListBuild newBuilder() { - return new OffSetListBuild(); - } - - private void verify() { - } - - public static class OffSetListBuild { - private java.util.List list; - - public OffSetListBuild addList(com.Offset a) { - if (a == null) { - throw new RuntimeException("a is null"); - } - if (this.list == null) { - this.list = new java.util.ArrayList<>(); - this.list.add(a); - } else { - this.list.add(a); - } - return this; - } - - public com.Offset getList(int index) { - if (this.list == null || index >= this.list.size()) { - throw new RuntimeException("list is null or index bigger than list size"); - } - - return this.list.get(index); - } - - public OffSetListBuild removeList(int index) { - if (this.list == null || index >= this.list.size()) { - throw new RuntimeException("list is null or index bigger than list size"); - } - - this.list.remove(index); - return this; - - } - - public int sizeList() { - if (this.list == null) { - throw new RuntimeException("list is null"); - } - - return this.list.size(); - } - - public OffSetListBuild clearList() { - this.list = null; - return this; - } - - public boolean hasList() { - if (this.list == null) { - return false; - } - return this.list.size() != 0; - } - - public OffSetList build() { - OffSetList value_1 = new OffSetList(); - if (this.hasList()) { - value_1.set_list(this.list); - } - return value_1; - } - public OffSetListBuild clear() { - this.list = null; - return this; - } - - private OffSetListBuild() { - } - } - -} diff --git a/src/test/java/com/Offset.java b/src/test/java/com/Offset.java deleted file mode 100644 index 04adf75..0000000 --- a/src/test/java/com/Offset.java +++ /dev/null @@ -1,334 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class Offset { - - private int Offset_size = 0; - - private byte[] key; - public final static int key_Num = 1; - public final static int key_Tag = 10;// the value is num<<<3|wireType - public final static int key_TagEncodeSize = 1; - - private void encode_key(ByteBuf buf) { - Serializer.encodeVarInt32(buf, key_Tag); - Serializer.encodeByteString(buf, this.key); - } - - private static void decode_key(ByteBuf buf, Offset a_1) { - byte[] value_1 = null; - value_1 = Serializer.decodeByteString(buf, Serializer.decodeVarInt32(buf)); - a_1.key = value_1; - } - - private void set_key(byte[] value_1) { - Offset_size += key_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.length); - size_1 += value_1.length; - Offset_size += size_1; - this.key = value_1; - } - - public byte[] getKey() { - return this.key; - } - - private boolean hasKey() { - return this.key != null; - } - - private java.lang.Integer intkey; - public final static int intkey_Num = 2; - public final static int intkey_Tag = 16;// the value is num<<<3|wireType - public final static int intkey_TagEncodeSize = 1; - - private void encode_intkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, intkey_Tag); - Serializer.encodeVarInt32(buf, this.intkey); - } - - private static void decode_intkey(ByteBuf buf, Offset a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.intkey = value_1; - } - - private void set_intkey(java.lang.Integer value_1) { - Offset_size += intkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - Offset_size += size_1; - this.intkey = value_1; - } - - public java.lang.Integer getIntkey() { - return this.intkey; - } - - private boolean hasIntkey() { - return this.intkey != null; - } - - private java.lang.Long longkey; - public final static int longkey_Num = 3; - public final static int longkey_Tag = 24;// the value is num<<<3|wireType - public final static int longkey_TagEncodeSize = 1; - - private void encode_longkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longkey_Tag); - Serializer.encodeVarInt64(buf, this.longkey); - } - - private static void decode_longkey(ByteBuf buf, Offset a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.longkey = value_1; - } - - private void set_longkey(java.lang.Long value_1) { - Offset_size += longkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - Offset_size += size_1; - this.longkey = value_1; - } - - public java.lang.Long getLongkey() { - return this.longkey; - } - - private boolean hasLongkey() { - return this.longkey != null; - } - - private java.lang.Integer offset; - public final static int offset_Num = 4; - public final static int offset_Tag = 32;// the value is num<<<3|wireType - public final static int offset_TagEncodeSize = 1; - - private void encode_offset(ByteBuf buf) { - Serializer.encodeVarInt32(buf, offset_Tag); - Serializer.encodeVarInt32(buf, this.offset); - } - - private static void decode_offset(ByteBuf buf, Offset a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.offset = value_1; - } - - private void set_offset(java.lang.Integer value_1) { - Offset_size += offset_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - Offset_size += size_1; - this.offset = value_1; - } - - public java.lang.Integer getOffset() { - return this.offset; - } - - private boolean hasOffset() { - return this.offset != null; - } - - public static Offset decode(ByteBuf buf) { - Offset value_1 = new Offset(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - case intkey_Tag : - decode_intkey(buf, value_1); - break; - case longkey_Tag : - decode_longkey(buf, value_1); - break; - case offset_Tag : - decode_offset(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.Offset_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasKey()) { - this.encode_key(buf); - } - - if (hasIntkey()) { - this.encode_intkey(buf); - } - - if (hasLongkey()) { - this.encode_longkey(buf); - } - - if (hasOffset()) { - this.encode_offset(buf); - } - - } - public static Offset decode(ByteBuf buf, int length_1) { - Offset value_1 = new Offset(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case key_Tag : - decode_key(buf, value_1); - break; - case intkey_Tag : - decode_intkey(buf, value_1); - break; - case longkey_Tag : - decode_longkey(buf, value_1); - break; - case offset_Tag : - decode_offset(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.Offset_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.Offset_size; - } - - public static OffsetBuild newBuilder() { - return new OffsetBuild(); - } - - private void verify() { - if (this.offset == null) { - throw new RuntimeException("required offset"); - } - } - - public static class OffsetBuild { - private byte[] key; - private java.lang.Integer intkey; - private java.lang.Long longkey; - private java.lang.Integer offset; - - public OffsetBuild setKey(byte[] a) { - this.key = a; - return this; - } - - public byte[] getKey() { - return this.key; - } - - public OffsetBuild clearKey() { - this.key = null; - return this; - } - - public boolean hasKey() { - return this.key != null; - } - - public OffsetBuild setIntkey(java.lang.Integer a) { - this.intkey = a; - return this; - } - - public java.lang.Integer getIntkey() { - return this.intkey; - } - - public OffsetBuild clearIntkey() { - this.intkey = null; - return this; - } - - public boolean hasIntkey() { - return this.intkey != null; - } - - public OffsetBuild setLongkey(java.lang.Long a) { - this.longkey = a; - return this; - } - - public java.lang.Long getLongkey() { - return this.longkey; - } - - public OffsetBuild clearLongkey() { - this.longkey = null; - return this; - } - - public boolean hasLongkey() { - return this.longkey != null; - } - - public OffsetBuild setOffset(java.lang.Integer a) { - this.offset = a; - return this; - } - - public java.lang.Integer getOffset() { - return this.offset; - } - - public OffsetBuild clearOffset() { - this.offset = null; - return this; - } - - public boolean hasOffset() { - return this.offset != null; - } - - public Offset build() { - Offset value_1 = new Offset(); - if (this.key != null) { - value_1.set_key(this.key); - } - if (this.intkey != null) { - value_1.set_intkey(this.intkey); - } - if (this.longkey != null) { - value_1.set_longkey(this.longkey); - } - if (this.offset == null) { - throw new RuntimeException(" offset is required"); - } - value_1.set_offset(this.offset); - return value_1; - } - public OffsetBuild clear() { - this.key = null; - this.intkey = null; - this.longkey = null; - this.offset = null; - return this; - } - - private OffsetBuild() { - } - } - -} diff --git a/src/test/java/com/PrepareId.java b/src/test/java/com/PrepareId.java deleted file mode 100644 index 3995394..0000000 --- a/src/test/java/com/PrepareId.java +++ /dev/null @@ -1,205 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class PrepareId { - - private int PrepareId_size = 0; - - private java.lang.Long time; - public final static int time_Num = 1; - public final static int time_Tag = 8;// the value is num<<<3|wireType - public final static int time_TagEncodeSize = 1; - - private void encode_time(ByteBuf buf) { - Serializer.encodeVarInt32(buf, time_Tag); - Serializer.encodeVarInt64(buf, this.time); - } - - private static void decode_time(ByteBuf buf, PrepareId a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.time = value_1; - } - - private void set_time(java.lang.Long value_1) { - PrepareId_size += time_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - PrepareId_size += size_1; - this.time = value_1; - } - - public java.lang.Long getTime() { - return this.time; - } - - private boolean hasTime() { - return this.time != null; - } - - private java.lang.Integer id; - public final static int id_Num = 2; - public final static int id_Tag = 16;// the value is num<<<3|wireType - public final static int id_TagEncodeSize = 1; - - private void encode_id(ByteBuf buf) { - Serializer.encodeVarInt32(buf, id_Tag); - Serializer.encodeVarInt32(buf, this.id); - } - - private static void decode_id(ByteBuf buf, PrepareId a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.id = value_1; - } - - private void set_id(java.lang.Integer value_1) { - PrepareId_size += id_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - PrepareId_size += size_1; - this.id = value_1; - } - - public java.lang.Integer getId() { - return this.id; - } - - private boolean hasId() { - return this.id != null; - } - - public static PrepareId decode(ByteBuf buf) { - PrepareId value_1 = new PrepareId(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case time_Tag : - decode_time(buf, value_1); - break; - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.PrepareId_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasTime()) { - this.encode_time(buf); - } - - if (hasId()) { - this.encode_id(buf); - } - - } - public static PrepareId decode(ByteBuf buf, int length_1) { - PrepareId value_1 = new PrepareId(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case time_Tag : - decode_time(buf, value_1); - break; - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.PrepareId_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.PrepareId_size; - } - - public static PrepareIdBuild newBuilder() { - return new PrepareIdBuild(); - } - - private void verify() { - if (this.time == null) { - throw new RuntimeException("required time"); - } - if (this.id == null) { - throw new RuntimeException("required id"); - } - } - - public static class PrepareIdBuild { - private java.lang.Long time; - private java.lang.Integer id; - - public PrepareIdBuild setTime(java.lang.Long a) { - this.time = a; - return this; - } - - public java.lang.Long getTime() { - return this.time; - } - - public PrepareIdBuild clearTime() { - this.time = null; - return this; - } - - public boolean hasTime() { - return this.time != null; - } - - public PrepareIdBuild setId(java.lang.Integer a) { - this.id = a; - return this; - } - - public java.lang.Integer getId() { - return this.id; - } - - public PrepareIdBuild clearId() { - this.id = null; - return this; - } - - public boolean hasId() { - return this.id != null; - } - - public PrepareId build() { - PrepareId value_1 = new PrepareId(); - if (this.time == null) { - throw new RuntimeException(" time is required"); - } - value_1.set_time(this.time); - if (this.id == null) { - throw new RuntimeException(" id is required"); - } - value_1.set_id(this.id); - return value_1; - } - public PrepareIdBuild clear() { - this.time = null; - this.id = null; - return this; - } - - private PrepareIdBuild() { - } - } - -} diff --git a/src/test/java/com/SSTable.java b/src/test/java/com/SSTable.java deleted file mode 100644 index aecd586..0000000 --- a/src/test/java/com/SSTable.java +++ /dev/null @@ -1,638 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class SSTable { - - private int SSTable_size = 0; - - private java.lang.String filename; - public final static int filename_Num = 1; - public final static int filename_Tag = 10;// the value is num<<<3|wireType - public final static int filename_TagEncodeSize = 1; - - private void encode_filename(ByteBuf buf) { - Serializer.encodeVarInt32(buf, filename_Tag); - Serializer.encodeString(buf, this.filename); - } - - private static void decode_filename(ByteBuf buf, SSTable a_1) { - java.lang.String value_1 = null; - value_1 = Serializer.decodeString(buf, Serializer.decodeVarInt32(buf)); - a_1.filename = value_1; - } - - private void set_filename(java.lang.String value_1) { - SSTable_size += filename_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(ByteBufUtil.utf8Bytes(value_1)); - size_1 += ByteBufUtil.utf8Bytes(value_1);// value length - SSTable_size += size_1; - this.filename = value_1; - } - - public java.lang.String getFilename() { - return this.filename; - } - - private boolean hasFilename() { - return this.filename != null; - } - - private java.lang.Integer size; - public final static int size_Num = 2; - public final static int size_Tag = 16;// the value is num<<<3|wireType - public final static int size_TagEncodeSize = 1; - - private void encode_size(ByteBuf buf) { - Serializer.encodeVarInt32(buf, size_Tag); - Serializer.encodeVarInt32(buf, this.size); - } - - private static void decode_size(ByteBuf buf, SSTable a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.size = value_1; - } - - private void set_size(java.lang.Integer value_1) { - SSTable_size += size_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - SSTable_size += size_1; - this.size = value_1; - } - - public java.lang.Integer getSize() { - return this.size; - } - - private boolean hasSize() { - return this.size != null; - } - - private com.IntKey minkey; - public final static int minkey_Num = 3; - public final static int minkey_Tag = 26;// the value is num<<<3|wireType - public final static int minkey_TagEncodeSize = 1; - - private void encode_minkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, minkey_Tag); - Serializer.encodeVarInt32(buf, this.minkey.getByteSize()); - this.minkey.encode(buf); - } - - private static void decode_minkey(ByteBuf buf, SSTable a_1) { - com.IntKey value_1 = null; - value_1 = com.IntKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.minkey = value_1; - } - - private void set_minkey(com.IntKey value_1) { - SSTable_size += minkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - SSTable_size += size_1; - this.minkey = value_1; - } - - public com.IntKey getMinkey() { - return this.minkey; - } - - private boolean hasMinkey() { - return this.minkey != null; - } - - private com.LongKey longminkey; - public final static int longminkey_Num = 4; - public final static int longminkey_Tag = 34;// the value is num<<<3|wireType - public final static int longminkey_TagEncodeSize = 1; - - private void encode_longminkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longminkey_Tag); - Serializer.encodeVarInt32(buf, this.longminkey.getByteSize()); - this.longminkey.encode(buf); - } - - private static void decode_longminkey(ByteBuf buf, SSTable a_1) { - com.LongKey value_1 = null; - value_1 = com.LongKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.longminkey = value_1; - } - - private void set_longminkey(com.LongKey value_1) { - SSTable_size += longminkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - SSTable_size += size_1; - this.longminkey = value_1; - } - - public com.LongKey getLongminkey() { - return this.longminkey; - } - - private boolean hasLongminkey() { - return this.longminkey != null; - } - - private com.ByteKey bytesminkey; - public final static int bytesminkey_Num = 5; - public final static int bytesminkey_Tag = 42;// the value is num<<<3|wireType - public final static int bytesminkey_TagEncodeSize = 1; - - private void encode_bytesminkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, bytesminkey_Tag); - Serializer.encodeVarInt32(buf, this.bytesminkey.getByteSize()); - this.bytesminkey.encode(buf); - } - - private static void decode_bytesminkey(ByteBuf buf, SSTable a_1) { - com.ByteKey value_1 = null; - value_1 = com.ByteKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.bytesminkey = value_1; - } - - private void set_bytesminkey(com.ByteKey value_1) { - SSTable_size += bytesminkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - SSTable_size += size_1; - this.bytesminkey = value_1; - } - - public com.ByteKey getBytesminkey() { - return this.bytesminkey; - } - - private boolean hasBytesminkey() { - return this.bytesminkey != null; - } - - private com.IntKey maxkey; - public final static int maxkey_Num = 6; - public final static int maxkey_Tag = 50;// the value is num<<<3|wireType - public final static int maxkey_TagEncodeSize = 1; - - private void encode_maxkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, maxkey_Tag); - Serializer.encodeVarInt32(buf, this.maxkey.getByteSize()); - this.maxkey.encode(buf); - } - - private static void decode_maxkey(ByteBuf buf, SSTable a_1) { - com.IntKey value_1 = null; - value_1 = com.IntKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.maxkey = value_1; - } - - private void set_maxkey(com.IntKey value_1) { - SSTable_size += maxkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - SSTable_size += size_1; - this.maxkey = value_1; - } - - public com.IntKey getMaxkey() { - return this.maxkey; - } - - private boolean hasMaxkey() { - return this.maxkey != null; - } - - private com.LongKey longmaxkey; - public final static int longmaxkey_Num = 7; - public final static int longmaxkey_Tag = 58;// the value is num<<<3|wireType - public final static int longmaxkey_TagEncodeSize = 1; - - private void encode_longmaxkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longmaxkey_Tag); - Serializer.encodeVarInt32(buf, this.longmaxkey.getByteSize()); - this.longmaxkey.encode(buf); - } - - private static void decode_longmaxkey(ByteBuf buf, SSTable a_1) { - com.LongKey value_1 = null; - value_1 = com.LongKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.longmaxkey = value_1; - } - - private void set_longmaxkey(com.LongKey value_1) { - SSTable_size += longmaxkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - SSTable_size += size_1; - this.longmaxkey = value_1; - } - - public com.LongKey getLongmaxkey() { - return this.longmaxkey; - } - - private boolean hasLongmaxkey() { - return this.longmaxkey != null; - } - - private com.ByteKey bytesmaxkey; - public final static int bytesmaxkey_Num = 8; - public final static int bytesmaxkey_Tag = 66;// the value is num<<<3|wireType - public final static int bytesmaxkey_TagEncodeSize = 1; - - private void encode_bytesmaxkey(ByteBuf buf) { - Serializer.encodeVarInt32(buf, bytesmaxkey_Tag); - Serializer.encodeVarInt32(buf, this.bytesmaxkey.getByteSize()); - this.bytesmaxkey.encode(buf); - } - - private static void decode_bytesmaxkey(ByteBuf buf, SSTable a_1) { - com.ByteKey value_1 = null; - value_1 = com.ByteKey.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.bytesmaxkey = value_1; - } - - private void set_bytesmaxkey(com.ByteKey value_1) { - SSTable_size += bytesmaxkey_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - SSTable_size += size_1; - this.bytesmaxkey = value_1; - } - - public com.ByteKey getBytesmaxkey() { - return this.bytesmaxkey; - } - - private boolean hasBytesmaxkey() { - return this.bytesmaxkey != null; - } - - public static SSTable decode(ByteBuf buf) { - SSTable value_1 = new SSTable(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case filename_Tag : - decode_filename(buf, value_1); - break; - case size_Tag : - decode_size(buf, value_1); - break; - case minkey_Tag : - decode_minkey(buf, value_1); - break; - case longminkey_Tag : - decode_longminkey(buf, value_1); - break; - case bytesminkey_Tag : - decode_bytesminkey(buf, value_1); - break; - case maxkey_Tag : - decode_maxkey(buf, value_1); - break; - case longmaxkey_Tag : - decode_longmaxkey(buf, value_1); - break; - case bytesmaxkey_Tag : - decode_bytesmaxkey(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.SSTable_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasFilename()) { - this.encode_filename(buf); - } - - if (hasSize()) { - this.encode_size(buf); - } - - if (hasMinkey()) { - this.encode_minkey(buf); - } - - if (hasLongminkey()) { - this.encode_longminkey(buf); - } - - if (hasBytesminkey()) { - this.encode_bytesminkey(buf); - } - - if (hasMaxkey()) { - this.encode_maxkey(buf); - } - - if (hasLongmaxkey()) { - this.encode_longmaxkey(buf); - } - - if (hasBytesmaxkey()) { - this.encode_bytesmaxkey(buf); - } - - } - public static SSTable decode(ByteBuf buf, int length_1) { - SSTable value_1 = new SSTable(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case filename_Tag : - decode_filename(buf, value_1); - break; - case size_Tag : - decode_size(buf, value_1); - break; - case minkey_Tag : - decode_minkey(buf, value_1); - break; - case longminkey_Tag : - decode_longminkey(buf, value_1); - break; - case bytesminkey_Tag : - decode_bytesminkey(buf, value_1); - break; - case maxkey_Tag : - decode_maxkey(buf, value_1); - break; - case longmaxkey_Tag : - decode_longmaxkey(buf, value_1); - break; - case bytesmaxkey_Tag : - decode_bytesmaxkey(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.SSTable_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.SSTable_size; - } - - public static SSTableBuild newBuilder() { - return new SSTableBuild(); - } - - private void verify() { - if (this.filename == null) { - throw new RuntimeException("required filename"); - } - if (this.size == null) { - throw new RuntimeException("required size"); - } - if (this.minkey == null) { - throw new RuntimeException("required minkey"); - } - if (this.longminkey == null) { - throw new RuntimeException("required longminkey"); - } - if (this.bytesminkey == null) { - throw new RuntimeException("required bytesminkey"); - } - if (this.maxkey == null) { - throw new RuntimeException("required maxkey"); - } - if (this.longmaxkey == null) { - throw new RuntimeException("required longmaxkey"); - } - if (this.bytesmaxkey == null) { - throw new RuntimeException("required bytesmaxkey"); - } - } - - public static class SSTableBuild { - private java.lang.String filename; - private java.lang.Integer size; - private com.IntKey minkey; - private com.LongKey longminkey; - private com.ByteKey bytesminkey; - private com.IntKey maxkey; - private com.LongKey longmaxkey; - private com.ByteKey bytesmaxkey; - - public SSTableBuild setFilename(java.lang.String a) { - this.filename = a; - return this; - } - - public java.lang.String getFilename() { - return this.filename; - } - - public SSTableBuild clearFilename() { - this.filename = null; - return this; - } - - public boolean hasFilename() { - return this.filename != null; - } - - public SSTableBuild setSize(java.lang.Integer a) { - this.size = a; - return this; - } - - public java.lang.Integer getSize() { - return this.size; - } - - public SSTableBuild clearSize() { - this.size = null; - return this; - } - - public boolean hasSize() { - return this.size != null; - } - - public SSTableBuild setMinkey(com.IntKey a) { - this.minkey = a; - return this; - } - - public com.IntKey getMinkey() { - return this.minkey; - } - - public SSTableBuild clearMinkey() { - this.minkey = null; - return this; - } - - public boolean hasMinkey() { - return this.minkey != null; - } - - public SSTableBuild setLongminkey(com.LongKey a) { - this.longminkey = a; - return this; - } - - public com.LongKey getLongminkey() { - return this.longminkey; - } - - public SSTableBuild clearLongminkey() { - this.longminkey = null; - return this; - } - - public boolean hasLongminkey() { - return this.longminkey != null; - } - - public SSTableBuild setBytesminkey(com.ByteKey a) { - this.bytesminkey = a; - return this; - } - - public com.ByteKey getBytesminkey() { - return this.bytesminkey; - } - - public SSTableBuild clearBytesminkey() { - this.bytesminkey = null; - return this; - } - - public boolean hasBytesminkey() { - return this.bytesminkey != null; - } - - public SSTableBuild setMaxkey(com.IntKey a) { - this.maxkey = a; - return this; - } - - public com.IntKey getMaxkey() { - return this.maxkey; - } - - public SSTableBuild clearMaxkey() { - this.maxkey = null; - return this; - } - - public boolean hasMaxkey() { - return this.maxkey != null; - } - - public SSTableBuild setLongmaxkey(com.LongKey a) { - this.longmaxkey = a; - return this; - } - - public com.LongKey getLongmaxkey() { - return this.longmaxkey; - } - - public SSTableBuild clearLongmaxkey() { - this.longmaxkey = null; - return this; - } - - public boolean hasLongmaxkey() { - return this.longmaxkey != null; - } - - public SSTableBuild setBytesmaxkey(com.ByteKey a) { - this.bytesmaxkey = a; - return this; - } - - public com.ByteKey getBytesmaxkey() { - return this.bytesmaxkey; - } - - public SSTableBuild clearBytesmaxkey() { - this.bytesmaxkey = null; - return this; - } - - public boolean hasBytesmaxkey() { - return this.bytesmaxkey != null; - } - - public SSTable build() { - SSTable value_1 = new SSTable(); - if (this.filename == null) { - throw new RuntimeException(" filename is required"); - } - value_1.set_filename(this.filename); - if (this.size == null) { - throw new RuntimeException(" size is required"); - } - value_1.set_size(this.size); - if (this.minkey == null) { - throw new RuntimeException(" minkey is required"); - } - value_1.set_minkey(this.minkey); - if (this.longminkey == null) { - throw new RuntimeException(" longminkey is required"); - } - value_1.set_longminkey(this.longminkey); - if (this.bytesminkey == null) { - throw new RuntimeException(" bytesminkey is required"); - } - value_1.set_bytesminkey(this.bytesminkey); - if (this.maxkey == null) { - throw new RuntimeException(" maxkey is required"); - } - value_1.set_maxkey(this.maxkey); - if (this.longmaxkey == null) { - throw new RuntimeException(" longmaxkey is required"); - } - value_1.set_longmaxkey(this.longmaxkey); - if (this.bytesmaxkey == null) { - throw new RuntimeException(" bytesmaxkey is required"); - } - value_1.set_bytesmaxkey(this.bytesmaxkey); - return value_1; - } - public SSTableBuild clear() { - this.filename = null; - this.size = null; - this.minkey = null; - this.longminkey = null; - this.bytesminkey = null; - this.maxkey = null; - this.longmaxkey = null; - this.bytesmaxkey = null; - return this; - } - - private SSTableBuild() { - } - } - -} diff --git a/src/test/java/com/SequenceNumber.java b/src/test/java/com/SequenceNumber.java deleted file mode 100644 index 1a50617..0000000 --- a/src/test/java/com/SequenceNumber.java +++ /dev/null @@ -1,205 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class SequenceNumber { - - private int SequenceNumber_size = 0; - - private java.lang.Long time; - public final static int time_Num = 1; - public final static int time_Tag = 8;// the value is num<<<3|wireType - public final static int time_TagEncodeSize = 1; - - private void encode_time(ByteBuf buf) { - Serializer.encodeVarInt32(buf, time_Tag); - Serializer.encodeVarInt64(buf, this.time); - } - - private static void decode_time(ByteBuf buf, SequenceNumber a_1) { - java.lang.Long value_1 = null; - value_1 = Serializer.decodeVarInt64(buf); - a_1.time = value_1; - } - - private void set_time(java.lang.Long value_1) { - SequenceNumber_size += time_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt64Size(value_1); - SequenceNumber_size += size_1; - this.time = value_1; - } - - public java.lang.Long getTime() { - return this.time; - } - - private boolean hasTime() { - return this.time != null; - } - - private java.lang.Integer id; - public final static int id_Num = 2; - public final static int id_Tag = 16;// the value is num<<<3|wireType - public final static int id_TagEncodeSize = 1; - - private void encode_id(ByteBuf buf) { - Serializer.encodeVarInt32(buf, id_Tag); - Serializer.encodeVarInt32(buf, this.id); - } - - private static void decode_id(ByteBuf buf, SequenceNumber a_1) { - java.lang.Integer value_1 = null; - value_1 = Serializer.decodeVarInt32(buf); - a_1.id = value_1; - } - - private void set_id(java.lang.Integer value_1) { - SequenceNumber_size += id_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1); - SequenceNumber_size += size_1; - this.id = value_1; - } - - public java.lang.Integer getId() { - return this.id; - } - - private boolean hasId() { - return this.id != null; - } - - public static SequenceNumber decode(ByteBuf buf) { - SequenceNumber value_1 = new SequenceNumber(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case time_Tag : - decode_time(buf, value_1); - break; - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.SequenceNumber_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasTime()) { - this.encode_time(buf); - } - - if (hasId()) { - this.encode_id(buf); - } - - } - public static SequenceNumber decode(ByteBuf buf, int length_1) { - SequenceNumber value_1 = new SequenceNumber(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case time_Tag : - decode_time(buf, value_1); - break; - case id_Tag : - decode_id(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.SequenceNumber_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.SequenceNumber_size; - } - - public static SequenceNumberBuild newBuilder() { - return new SequenceNumberBuild(); - } - - private void verify() { - if (this.time == null) { - throw new RuntimeException("required time"); - } - if (this.id == null) { - throw new RuntimeException("required id"); - } - } - - public static class SequenceNumberBuild { - private java.lang.Long time; - private java.lang.Integer id; - - public SequenceNumberBuild setTime(java.lang.Long a) { - this.time = a; - return this; - } - - public java.lang.Long getTime() { - return this.time; - } - - public SequenceNumberBuild clearTime() { - this.time = null; - return this; - } - - public boolean hasTime() { - return this.time != null; - } - - public SequenceNumberBuild setId(java.lang.Integer a) { - this.id = a; - return this; - } - - public java.lang.Integer getId() { - return this.id; - } - - public SequenceNumberBuild clearId() { - this.id = null; - return this; - } - - public boolean hasId() { - return this.id != null; - } - - public SequenceNumber build() { - SequenceNumber value_1 = new SequenceNumber(); - if (this.time == null) { - throw new RuntimeException(" time is required"); - } - value_1.set_time(this.time); - if (this.id == null) { - throw new RuntimeException(" id is required"); - } - value_1.set_id(this.id); - return value_1; - } - public SequenceNumberBuild clear() { - this.time = null; - this.id = null; - return this; - } - - private SequenceNumberBuild() { - } - } - -} diff --git a/src/test/java/com/Serializer.java b/src/test/java/com/Serializer.java deleted file mode 100644 index 3ea7e1c..0000000 --- a/src/test/java/com/Serializer.java +++ /dev/null @@ -1,378 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; - -public class Serializer { - - public static int decodeVarInt32(ByteBuf byteBuf) { - int value;// decode first number - int a = byteBuf.readByte(); - if (a >= 0) { - return a; - } - value = a ^ 0xffffff80; - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 7); - } - - value = value | ((a ^ 0xffffff80) << 7); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 14); - } - - value = value | ((a ^ (0xffffff80)) << 14); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 21); - } - - value = value | ((a ^ (0xffffff80)) << 21); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 28); - } - value = value | ((a & 15) << 28);// the value is negative , - a = byteBuf.readByte(); - - if (a != -1) { - throw new RuntimeException("this code is wrong"); - } - - a = byteBuf.readByte(); - if (a != -1) { - throw new RuntimeException("this code is wrong"); - } - - a = byteBuf.readByte(); - if (a != -1) { - throw new RuntimeException("this code is wrong"); - } - a = byteBuf.readByte(); - if (a != -1) { - throw new RuntimeException("this code is wrong"); - } - a = byteBuf.readByte(); - if (a != 1) { - throw new RuntimeException("this code is wrong"); - } - - return value; - } - - public static int decodeVarUInt32(ByteBuf byteBuf) { - int value;// decode first number - int a = byteBuf.readByte(); - if (a >= 0) { - return a; - } - value = a ^ 0xffffff80; - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 7); - } - - value = value | ((a ^ 0xffffff80) << 7); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 14); - } - - value = value | ((a ^ (0xffffff80)) << 14); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 21); - } - - value = value | ((a ^ (0xffffff80)) << 21); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 28); - } - throw new RuntimeException("this code is wrong"); - } - - public static void encodeVarUInt32(ByteBuf byteBuf, int value) { - while (true) { - int value2 = value >>> 7; - if (value2 == 0) { - byteBuf.writeByte(value); - return; - } - byteBuf.writeByte((value | 128)); - - value = value2; - } - } - - public static long decodeVarInt64(ByteBuf byteBuf) { - long value; - long a = byteBuf.readByte(); - if (a >= 0L) { - return a; - } - value = a ^ 0xffffffffffffff80L; - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 7L); - } - - value = value | ((a ^ 0xffffffffffffff80L) << 7L); - - a = byteBuf.readByte(); - if (a >= 0) { - return value | (a << 14L); - } - - value = value | ((a ^ 0xffffffffffffff80L) << 14L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 21L); - } - - value = value | ((a ^ 0xffffffffffffff80L) << 21L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 28L); - } - value = value | ((a ^ 0xffffffffffffff80L) << 28L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 35L); - } - value = value | ((a ^ 0xffffffffffffff80L) << 35L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 42L); - } - value = value | ((a ^ 0xffffffffffffff80L) << 42L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 49L); - } - value = value | ((a ^ 0xffffffffffffff80L) << 49L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 56L); - } - value = value | ((a ^ 0xffffffffffffff80L) << 56L); - - a = byteBuf.readByte(); - if (a >= 0L) { - return value | (a << 63L); - } - throw new RuntimeException("this code is wrong"); - - } - - public static void encodeVarInt32(ByteBuf byteBuf, int value) { - if (value < 0) { - encodeVarInt64(byteBuf, value); - return; - } - while (true) { - int value2 = value >>> 7; - if (value2 == 0) { - byteBuf.writeByte(value); - return; - } - byteBuf.writeByte((value | 128)); - - value = value2; - } - - } - - public static void encodeVarInt64(ByteBuf byteBuf, long value) { - while (true) { - long value2 = value >>> 7L; - if (value2 == 0L) { - byteBuf.writeByte((int) value); - return; - } - byteBuf.writeByte((int) (value | 128L)); - - value = value2; - } - - } - - public static int encodeZigzag32(int value) { - return (value << 1) ^ (value >> 31); - } - - public static long encodeZigzag64(long value) { - return (value << 1L) ^ (value >> 63L); - } - - public static int decodeZigzag32(int value) { - return (value >>> 1) ^ -(value & 1); - } - - public static long decodeZigzag64(long value) { - return (value >>> 1L) ^ -(value & 1L); - } - - public static void encodeString(ByteBuf byteBuf, String s) { - byte[] a = s.getBytes(StandardCharsets.UTF_8); - int length = a.length; - Serializer.encodeVarInt32(byteBuf, length); - byteBuf.writeBytes(a); - } - - public static void encodeByteString(ByteBuf byteBuf, byte[] s) { - Serializer.encodeVarInt32(byteBuf, s.length); - byteBuf.writeBytes(s); - - } - - public static String decodeString(ByteBuf byteBuf, int length) { - int read = byteBuf.readerIndex(); - byteBuf.readerIndex(read + length); - return byteBuf.toString(read, length, StandardCharsets.UTF_8); - } - - public static byte[] decodeByteString(ByteBuf byteBuf, int length) { - byte[] bytes = new byte[length]; - byteBuf.readBytes(bytes, 0, length); - return bytes; - } - - public static boolean decodeBoolean(ByteBuf byteBuf) { - return decodeVarInt64(byteBuf) != 0; - } - - public static void encodeBoolean(ByteBuf byteBuf, Boolean b) { - long a = b ? 1L : 0L; - encodeVarInt64(byteBuf, a); - } - - public static void encodeDouble(ByteBuf byteBuf, double b) { - byteBuf.writeDoubleLE(b); - } - - public static void encodeFloat(ByteBuf byteBuf, float b) { - byteBuf.writeFloatLE(b); - } - - public static double decodeDouble(ByteBuf byteBuf) { - return byteBuf.readDoubleLE(); - } - - public static float decodeFloat(ByteBuf byteBuf) { - return byteBuf.readFloatLE(); - - } - - public static void encode32(ByteBuf byteBuf, int b) { - byteBuf.writeIntLE(b); - } - - public static void encode64(ByteBuf byteBuf, long b) { - - byteBuf.writeLongLE(b); - - } - - public static int decode32(ByteBuf byteBuf) { - - return byteBuf.readIntLE(); - } - - public static long decode64(ByteBuf byteBuf) { - return byteBuf.readLongLE(); - } - - public static int computeVarInt32Size(final int value) { - if (value < 0) - return 10; - if ((value & 0xffffff80) == 0) { - return 1; - } else if ((value & 0xffffc000) == 0) { - return 2; - } else if ((value & 0xffe00000) == 0) { - return 3; - } else if ((value & 0xf0000000) == 0) { - return 4; - } else { - return 5; - } - } - - public static int computeVarUInt32Size(final int value) { - if ((value & 0xffffff80) == 0) { - return 1; - } else if ((value & 0xffffc000) == 0) { - return 2; - } else if ((value & 0xffe00000) == 0) { - return 3; - } else if ((value & 0xf0000000) == 0) { - return 4; - } else { - return 5; - } - } - - public static int computeVarInt64Size(final long value) { - if ((value & 0xffffffffffffff80L) == 0) { - return 1; - } else if ((value & 0xffffffffffffc000L) == 0) { - return 2; - } else if ((value & 0xffffffffffe00000L) == 0) { - return 3; - } else if ((value & 0xfffffffff0000000L) == 0) { - return 4; - } else if ((value & 0xfffffff800000000L) == 0) { - return 5; - } else if ((value & 0xfffffc0000000000L) == 0) { - return 6; - } else if ((value & 0xfffe000000000000L) == 0) { - return 7; - } else if ((value & 0xff00000000000000L) == 0) { - return 8; - } else if ((value & 0x8000000000000000L) == 0) { - return 9; - } else { - return 10; - } - } - - public static void skipUnknownField(int tag, ByteBuf buffer) { - int tagType = tag & 7; - switch (tagType) { - case 0 : - decodeVarInt64(buffer); - break; - case 1 : - buffer.skipBytes(8); - break; - case 2 : - int len = decodeVarInt32(buffer); - buffer.skipBytes(len); - break; - case 5 : - buffer.skipBytes(4); - break; - default : - throw new IllegalArgumentException("Invalid unknonwn tag type: " + tagType); - } - } - -} diff --git a/src/test/java/com/TransactionKeyValue.java b/src/test/java/com/TransactionKeyValue.java deleted file mode 100644 index 6b0350f..0000000 --- a/src/test/java/com/TransactionKeyValue.java +++ /dev/null @@ -1,209 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class TransactionKeyValue { - - private int TransactionKeyValue_size = 0; - - private com.ColumnFamilyId columnfamilyid; - public final static int columnfamilyid_Num = 1; - public final static int columnfamilyid_Tag = 10;// the value is num<<<3|wireType - public final static int columnfamilyid_TagEncodeSize = 1; - - private void encode_columnfamilyid(ByteBuf buf) { - Serializer.encodeVarInt32(buf, columnfamilyid_Tag); - Serializer.encodeVarInt32(buf, this.columnfamilyid.getByteSize()); - this.columnfamilyid.encode(buf); - } - - private static void decode_columnfamilyid(ByteBuf buf, TransactionKeyValue a_1) { - com.ColumnFamilyId value_1 = null; - value_1 = com.ColumnFamilyId.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.columnfamilyid = value_1; - } - - private void set_columnfamilyid(com.ColumnFamilyId value_1) { - TransactionKeyValue_size += columnfamilyid_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - TransactionKeyValue_size += size_1; - this.columnfamilyid = value_1; - } - - public com.ColumnFamilyId getColumnfamilyid() { - return this.columnfamilyid; - } - - private boolean hasColumnfamilyid() { - return this.columnfamilyid != null; - } - - private com.KeyValue keyvalue; - public final static int keyvalue_Num = 2; - public final static int keyvalue_Tag = 18;// the value is num<<<3|wireType - public final static int keyvalue_TagEncodeSize = 1; - - private void encode_keyvalue(ByteBuf buf) { - Serializer.encodeVarInt32(buf, keyvalue_Tag); - Serializer.encodeVarInt32(buf, this.keyvalue.getByteSize()); - this.keyvalue.encode(buf); - } - - private static void decode_keyvalue(ByteBuf buf, TransactionKeyValue a_1) { - com.KeyValue value_1 = null; - value_1 = com.KeyValue.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.keyvalue = value_1; - } - - private void set_keyvalue(com.KeyValue value_1) { - TransactionKeyValue_size += keyvalue_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - TransactionKeyValue_size += size_1; - this.keyvalue = value_1; - } - - public com.KeyValue getKeyvalue() { - return this.keyvalue; - } - - private boolean hasKeyvalue() { - return this.keyvalue != null; - } - - public static TransactionKeyValue decode(ByteBuf buf) { - TransactionKeyValue value_1 = new TransactionKeyValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case columnfamilyid_Tag : - decode_columnfamilyid(buf, value_1); - break; - case keyvalue_Tag : - decode_keyvalue(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.TransactionKeyValue_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasColumnfamilyid()) { - this.encode_columnfamilyid(buf); - } - - if (hasKeyvalue()) { - this.encode_keyvalue(buf); - } - - } - public static TransactionKeyValue decode(ByteBuf buf, int length_1) { - TransactionKeyValue value_1 = new TransactionKeyValue(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case columnfamilyid_Tag : - decode_columnfamilyid(buf, value_1); - break; - case keyvalue_Tag : - decode_keyvalue(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.TransactionKeyValue_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.TransactionKeyValue_size; - } - - public static TransactionKeyValueBuild newBuilder() { - return new TransactionKeyValueBuild(); - } - - private void verify() { - if (this.columnfamilyid == null) { - throw new RuntimeException("required columnfamilyid"); - } - if (this.keyvalue == null) { - throw new RuntimeException("required keyvalue"); - } - } - - public static class TransactionKeyValueBuild { - private com.ColumnFamilyId columnfamilyid; - private com.KeyValue keyvalue; - - public TransactionKeyValueBuild setColumnfamilyid(com.ColumnFamilyId a) { - this.columnfamilyid = a; - return this; - } - - public com.ColumnFamilyId getColumnfamilyid() { - return this.columnfamilyid; - } - - public TransactionKeyValueBuild clearColumnfamilyid() { - this.columnfamilyid = null; - return this; - } - - public boolean hasColumnfamilyid() { - return this.columnfamilyid != null; - } - - public TransactionKeyValueBuild setKeyvalue(com.KeyValue a) { - this.keyvalue = a; - return this; - } - - public com.KeyValue getKeyvalue() { - return this.keyvalue; - } - - public TransactionKeyValueBuild clearKeyvalue() { - this.keyvalue = null; - return this; - } - - public boolean hasKeyvalue() { - return this.keyvalue != null; - } - - public TransactionKeyValue build() { - TransactionKeyValue value_1 = new TransactionKeyValue(); - if (this.columnfamilyid == null) { - throw new RuntimeException(" columnfamilyid is required"); - } - value_1.set_columnfamilyid(this.columnfamilyid); - if (this.keyvalue == null) { - throw new RuntimeException(" keyvalue is required"); - } - value_1.set_keyvalue(this.keyvalue); - return value_1; - } - public TransactionKeyValueBuild clear() { - this.columnfamilyid = null; - this.keyvalue = null; - return this; - } - - private TransactionKeyValueBuild() { - } - } - -} diff --git a/src/test/java/com/Value.java b/src/test/java/com/Value.java deleted file mode 100644 index d982962..0000000 --- a/src/test/java/com/Value.java +++ /dev/null @@ -1,269 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class Value { - - private int Value_size = 0; - - private com.IntValue intvalue; - public final static int intvalue_Num = 1; - public final static int intvalue_Tag = 10;// the value is num<<<3|wireType - public final static int intvalue_TagEncodeSize = 1; - - private void encode_intvalue(ByteBuf buf) { - Serializer.encodeVarInt32(buf, intvalue_Tag); - Serializer.encodeVarInt32(buf, this.intvalue.getByteSize()); - this.intvalue.encode(buf); - } - - private static void decode_intvalue(ByteBuf buf, Value a_1) { - com.IntValue value_1 = null; - value_1 = com.IntValue.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.intvalue = value_1; - } - - private void set_intvalue(com.IntValue value_1) { - Value_size += intvalue_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - Value_size += size_1; - this.intvalue = value_1; - } - - public com.IntValue getIntvalue() { - return this.intvalue; - } - - private boolean hasIntvalue() { - return this.intvalue != null; - } - - private com.LongValue longvalue; - public final static int longvalue_Num = 2; - public final static int longvalue_Tag = 18;// the value is num<<<3|wireType - public final static int longvalue_TagEncodeSize = 1; - - private void encode_longvalue(ByteBuf buf) { - Serializer.encodeVarInt32(buf, longvalue_Tag); - Serializer.encodeVarInt32(buf, this.longvalue.getByteSize()); - this.longvalue.encode(buf); - } - - private static void decode_longvalue(ByteBuf buf, Value a_1) { - com.LongValue value_1 = null; - value_1 = com.LongValue.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.longvalue = value_1; - } - - private void set_longvalue(com.LongValue value_1) { - Value_size += longvalue_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - Value_size += size_1; - this.longvalue = value_1; - } - - public com.LongValue getLongvalue() { - return this.longvalue; - } - - private boolean hasLongvalue() { - return this.longvalue != null; - } - - private com.ByteValue bytevalue; - public final static int bytevalue_Num = 3; - public final static int bytevalue_Tag = 26;// the value is num<<<3|wireType - public final static int bytevalue_TagEncodeSize = 1; - - private void encode_bytevalue(ByteBuf buf) { - Serializer.encodeVarInt32(buf, bytevalue_Tag); - Serializer.encodeVarInt32(buf, this.bytevalue.getByteSize()); - this.bytevalue.encode(buf); - } - - private static void decode_bytevalue(ByteBuf buf, Value a_1) { - com.ByteValue value_1 = null; - value_1 = com.ByteValue.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.bytevalue = value_1; - } - - private void set_bytevalue(com.ByteValue value_1) { - Value_size += bytevalue_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - Value_size += size_1; - this.bytevalue = value_1; - } - - public com.ByteValue getBytevalue() { - return this.bytevalue; - } - - private boolean hasBytevalue() { - return this.bytevalue != null; - } - - public static Value decode(ByteBuf buf) { - Value value_1 = new Value(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case intvalue_Tag : - decode_intvalue(buf, value_1); - break; - case longvalue_Tag : - decode_longvalue(buf, value_1); - break; - case bytevalue_Tag : - decode_bytevalue(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.Value_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasIntvalue()) { - this.encode_intvalue(buf); - } - - if (hasLongvalue()) { - this.encode_longvalue(buf); - } - - if (hasBytevalue()) { - this.encode_bytevalue(buf); - } - - } - public static Value decode(ByteBuf buf, int length_1) { - Value value_1 = new Value(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case intvalue_Tag : - decode_intvalue(buf, value_1); - break; - case longvalue_Tag : - decode_longvalue(buf, value_1); - break; - case bytevalue_Tag : - decode_bytevalue(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.Value_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.Value_size; - } - - public static ValueBuild newBuilder() { - return new ValueBuild(); - } - - private void verify() { - } - - public static class ValueBuild { - private com.IntValue intvalue; - private com.LongValue longvalue; - private com.ByteValue bytevalue; - - public ValueBuild setIntvalue(com.IntValue a) { - this.intvalue = a; - return this; - } - - public com.IntValue getIntvalue() { - return this.intvalue; - } - - public ValueBuild clearIntvalue() { - this.intvalue = null; - return this; - } - - public boolean hasIntvalue() { - return this.intvalue != null; - } - - public ValueBuild setLongvalue(com.LongValue a) { - this.longvalue = a; - return this; - } - - public com.LongValue getLongvalue() { - return this.longvalue; - } - - public ValueBuild clearLongvalue() { - this.longvalue = null; - return this; - } - - public boolean hasLongvalue() { - return this.longvalue != null; - } - - public ValueBuild setBytevalue(com.ByteValue a) { - this.bytevalue = a; - return this; - } - - public com.ByteValue getBytevalue() { - return this.bytevalue; - } - - public ValueBuild clearBytevalue() { - this.bytevalue = null; - return this; - } - - public boolean hasBytevalue() { - return this.bytevalue != null; - } - - public Value build() { - Value value_1 = new Value(); - if (this.intvalue != null) { - value_1.set_intvalue(this.intvalue); - } - if (this.longvalue != null) { - value_1.set_longvalue(this.longvalue); - } - if (this.bytevalue != null) { - value_1.set_bytevalue(this.bytevalue); - } - return value_1; - } - public ValueBuild clear() { - this.intvalue = null; - this.longvalue = null; - this.bytevalue = null; - return this; - } - - private ValueBuild() { - } - } - -} diff --git a/src/test/java/com/ValueType.java b/src/test/java/com/ValueType.java deleted file mode 100644 index b69afae..0000000 --- a/src/test/java/com/ValueType.java +++ /dev/null @@ -1,32 +0,0 @@ -package com; -public enum ValueType { - - intValue(1), - - longValue(2), - - bytesValue(3), - - ; - public static ValueType get(int tag) { - if (tag == 1) { - return ValueType.intValue; - } - if (tag == 2) { - return ValueType.longValue; - } - if (tag == 3) { - return ValueType.bytesValue; - } - return null; - } - int num; - - ValueType(int num) { - this.num = num; - } - - int getNum() { - return this.num; - } -} diff --git a/src/test/java/com/log.java b/src/test/java/com/log.java deleted file mode 100644 index 7c9035d..0000000 --- a/src/test/java/com/log.java +++ /dev/null @@ -1,137 +0,0 @@ -package com; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; - -public final class log { - - private int log_size = 0; - - private com.KeyValue k; - public final static int k_Num = 1; - public final static int k_Tag = 10;// the value is num<<<3|wireType - public final static int k_TagEncodeSize = 1; - - private void encode_k(ByteBuf buf) { - Serializer.encodeVarInt32(buf, k_Tag); - Serializer.encodeVarInt32(buf, this.k.getByteSize()); - this.k.encode(buf); - } - - private static void decode_k(ByteBuf buf, log a_1) { - com.KeyValue value_1 = null; - value_1 = com.KeyValue.decode(buf, Serializer.decodeVarInt32(buf)); - a_1.k = value_1; - } - - private void set_k(com.KeyValue value_1) { - log_size += k_TagEncodeSize; - int size_1 = 0; - - size_1 += Serializer.computeVarInt32Size(value_1.getByteSize()); - size_1 += value_1.getByteSize(); - log_size += size_1; - this.k = value_1; - } - - public com.KeyValue getK() { - return this.k; - } - - private boolean hasK() { - return this.k != null; - } - - public static log decode(ByteBuf buf) { - log value_1 = new log(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < buf.writerIndex()) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case k_Tag : - decode_k(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.log_size = buf.readerIndex() - f_Index; - return value_1; - } - - public void encode(ByteBuf buf) { - if (hasK()) { - this.encode_k(buf); - } - - } - public static log decode(ByteBuf buf, int length_1) { - log value_1 = new log(); - int f_Index = buf.readerIndex(); - while (buf.readerIndex() < f_Index + length_1) { - int num_1 = Serializer.decodeVarInt32(buf); - switch (num_1) { - case k_Tag : - decode_k(buf, value_1); - break; - default : - Serializer.skipUnknownField(num_1, buf); - } - } - value_1.log_size = length_1; - value_1.verify(); - return value_1; - } - - public int getByteSize() { - return this.log_size; - } - - public static logBuild newBuilder() { - return new logBuild(); - } - - private void verify() { - if (this.k == null) { - throw new RuntimeException("required k"); - } - } - - public static class logBuild { - private com.KeyValue k; - - public logBuild setK(com.KeyValue a) { - this.k = a; - return this; - } - - public com.KeyValue getK() { - return this.k; - } - - public logBuild clearK() { - this.k = null; - return this; - } - - public boolean hasK() { - return this.k != null; - } - - public log build() { - log value_1 = new log(); - if (this.k == null) { - throw new RuntimeException(" k is required"); - } - value_1.set_k(this.k); - return value_1; - } - public logBuild clear() { - this.k = null; - return this; - } - - private logBuild() { - } - } - -} diff --git a/src/test/java/memTest/Main.java b/src/test/java/memTest/Main.java deleted file mode 100644 index aefabd5..0000000 --- a/src/test/java/memTest/Main.java +++ /dev/null @@ -1,153 +0,0 @@ -package memTest; - -import net.openio.jrocksDb.db.*; -import net.openio.jrocksDb.mem.KeyValueEntry; -import net.openio.jrocksDb.mem.SkipListRep; -import net.openio.jrocksDb.transaction.CommitId; -import net.openio.jrocksDb.transaction.PrepareId; -import net.openio.jrocksDb.transaction.SequenceNumber; - -import java.util.ArrayList; -import java.util.Date; - -public class Main { - - - - static int p=1; - - static long b=new Date().getTime(); - - static long isnull=0; - - static long nonull=0; - - - - public static void main(String[] args) { - ArrayList list=new ArrayList<>(); - Thread t=Thread.currentThread(); - SkipListRep skipListRep=new SkipListRep(false); - - new KeyValueEntry(); - Key key = new IntKey(2); - Value value = new IntValue(2); - KeyValueEntry keyValue = new KeyValueEntry(); - keyValue.setKey(key); - keyValue.setValue(value); - keyValue.setPrepareId(p()); - keyValue.setCommitId(c()); - keyValue.setSqId(s()); - keyValue.setType(KeyValueEntry.Type.insert); - KeyValueEntry keyValue1 = new KeyValueEntry(); - keyValue1.setKey(key); - keyValue1.setPrepareId(p()); - keyValue1.setCommitId(c()); - keyValue1.setType(KeyValueEntry.Type.insert); - skipListRep.addKeyValue(keyValue); - - for(int i=1;i>0;i--) { - Runnable runnable=new Runnable() { - @Override - public void run() { - for (int i = 1; i < 1000; i++) { - new KeyValueEntry(); - Key key = new IntKey(i); - Value value = new IntValue(i); - KeyValueEntry keyValue1 = new KeyValueEntry(); - keyValue1.setKey(key); - keyValue1.setPrepareId(p()); - keyValue1.setCommitId(c()); - skipListRep.addKeyValue(keyValue); - } - - - } - }; - Thread thread=new Thread(runnable); - thread.start(); - list.add(thread); - - } - - for(int i=1;i>0;i--) { - - Runnable runnable=new Runnable() { - @Override - public void run() { - for (int i = 0; i < 1000; i++ ) { - - new KeyValueEntry(); - Key key = new IntKey(i); - Value value = new IntValue(i); - KeyValueEntry keyValue = new KeyValueEntry(); - keyValue.setKey(key); - keyValue.setValue(value); - - keyValue.setPrepareId(p()); - - - if(skipListRep.getValue(keyValue1)==null){ - synchronized(Main.class){ - isnull++; - } - }else { - synchronized(Main.class) { - nonull++; - } - } - } - - } - }; - Thread thread=new Thread(runnable); - thread.start(); - list.add(thread); -// - } - - - for(Thread a: list){ - try { - a.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - System.out.println(nonull); - System.out.println(isnull); - - } - - static synchronized PrepareId p(){ - Date date=new Date(); - if(date.getTime()==b){ - return new PrepareId(date.getTime(),p++); - } - p=1; - b=date.getTime(); - return new PrepareId(date.getTime(),p++); - } - - static synchronized CommitId c(){ - Date date=new Date(); - if(date.getTime()==b){ - return new CommitId(date.getTime(),p++); - } - p=1; - b=date.getTime(); - return new CommitId(date.getTime(),p++); } - - - - static synchronized SequenceNumber s(){ - Date date=new Date(); - if(date.getTime()==b){ - return new SequenceNumber(date.getTime(),p++); - } - p=1; - b=date.getTime(); - return new SequenceNumber(date.getTime(),p++); } - -} diff --git a/src/test/java/memTest/TKVEntry.java b/src/test/java/memTest/TKVEntry.java deleted file mode 100644 index b9855a1..0000000 --- a/src/test/java/memTest/TKVEntry.java +++ /dev/null @@ -1,89 +0,0 @@ -package memTest; - -import net.openio.jrocksDb.config.Config; -import net.openio.jrocksDb.db.*; -import net.openio.jrocksDb.log.TransactionLogStorage; -import net.openio.jrocksDb.mem.KeyValueEntry; -import net.openio.jrocksDb.memArena.MemArena; -import net.openio.jrocksDb.transaction.CommitId; -import net.openio.jrocksDb.transaction.PrepareId; -import net.openio.jrocksDb.transaction.SequenceNumber; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class TKVEntry { - - static int p = 1; - - static long b = new Date().getTime(); - - public static void main(String[] args) { - - List list=new ArrayList<>(); - for (int i=0;i<1000;i++) { - TransactionKeyValue keyValue1 = new TransactionKeyValue(); - Key key = new IntKey(2); - Value value = new IntValue(2); - KeyValueEntry keyValue = new KeyValueEntry(); - keyValue.setKey(key); - keyValue.setValue(value); - keyValue.setPrepareId(p()); - keyValue.setCommitId(c()); - keyValue.setSqId(s()); - keyValue1.setKeyValueEntry(keyValue); - keyValue1.setColumnFamilyId(new ColumnFamilyId(1)); - keyValue.setType(KeyValueEntry.Type.insert); - - list.add(keyValue1); - } - - TransactionLogStorage transactionLogStorage=new TransactionLogStorage(); - - transactionLogStorage.setMemArena(new MemArena()); - transactionLogStorage.setFilePath(Config.transactionLog); - - transactionLogStorage.createFile("luu",new ColumnFamilyId(12l)); - - transactionLogStorage.write("luu",list,false,null); - - for(TransactionKeyValue value: transactionLogStorage.getAllMemTable("luu")){ - System.out.println(value); - } - - - } - - - static synchronized PrepareId p() { - Date date = new Date(); - if (date.getTime() == b) { - return new PrepareId(date.getTime(), p++); - } - p = 1; - b = date.getTime(); - return new PrepareId(date.getTime(), p++); - } - - static synchronized CommitId c() { - Date date = new Date(); - if (date.getTime() == b) { - return new CommitId(date.getTime(), p++); - } - p = 1; - b = date.getTime(); - return new CommitId(date.getTime(), p++); - } - - - static synchronized SequenceNumber s() { - Date date = new Date(); - if (date.getTime() == b) { - return new SequenceNumber(date.getTime(), p++); - } - p = 1; - b = date.getTime(); - return new SequenceNumber(date.getTime(), p++); - } -}