mirror of
https://github.com/fluencelabs/jabci
synced 2025-04-22 05:12:22 +00:00
protobuf update for 0.9.1
This commit is contained in:
parent
b5b2c6e3a3
commit
f81e092a0d
@ -23,7 +23,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.github.jtendermint.jabci;
|
package com.github.jtendermint.jabci;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
@ -65,7 +64,9 @@ public class JavaCounter implements IDeliverTx, ICheckTx, ICommit, IQuery {
|
|||||||
|
|
||||||
socket.registerListener(this);
|
socket.registerListener(this);
|
||||||
|
|
||||||
new Thread(socket::start).start();
|
Thread t = new Thread(socket::start);
|
||||||
|
t.setName("Java Counter Main Thread");
|
||||||
|
t.start();
|
||||||
while (true) {
|
while (true) {
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
}
|
}
|
||||||
@ -133,30 +134,15 @@ public class JavaCounter implements IDeliverTx, ICheckTx, ICommit, IQuery {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseQuery requestQuery(RequestQuery req) {
|
public ResponseQuery requestQuery(RequestQuery req) {
|
||||||
|
final String query = new String(req.getData().toByteArray());
|
||||||
final ResponseQuery internalError = ResponseQuery.newBuilder().setCode(CodeType.InternalError).setLog("some shit happened").build();
|
|
||||||
|
|
||||||
final String query = req.getQuery().toString();
|
|
||||||
|
|
||||||
System.out.println("Query is: " + query);
|
|
||||||
|
|
||||||
switch (query) {
|
switch (query) {
|
||||||
case "hash":
|
case "hash":
|
||||||
try {
|
return ResponseQuery.newBuilder().setCode(CodeType.OK).setValue(ByteString.copyFrom(("" + hashCount).getBytes())).build();
|
||||||
return ResponseQuery.newBuilder().setCode(CodeType.OK).setData(ByteString.copyFrom("" + hashCount, "UTF-8")).build();
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
return internalError;
|
|
||||||
}
|
|
||||||
case "tx":
|
case "tx":
|
||||||
try {
|
return ResponseQuery.newBuilder().setCode(CodeType.OK).setValue(ByteString.copyFrom(("" + txCount).getBytes())).build();
|
||||||
return ResponseQuery.newBuilder().setCode(CodeType.OK).setData(ByteString.copyFrom("" + txCount, "UTF-8")).build();
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
return internalError;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
|
return ResponseQuery.newBuilder().setCode(CodeType.BadNonce).setLog("Invalid query path. Expected hash or tx, got " + query)
|
||||||
return ResponseQuery.newBuilder().setLog("Invalid query path. Expected hash or tx, got " + query).build();
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,7 @@ public class TSocket extends ASocket {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (!isInterrupted()) {
|
if (!isInterrupted()) {
|
||||||
HANDLER_LOG.error("Error with " + this.getName(), e);
|
HANDLER_LOG.error("Error with " + this.getName(), e);
|
||||||
|
HANDLER_LOG.info("Note: If \"the input ended unexpectedly\" it could mean the protobuf file is not up to date.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HANDLER_LOG.debug("Stopping Thread " + this.getName());
|
HANDLER_LOG.debug("Stopping Thread " + this.getName());
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -113,7 +113,10 @@ message RequestCheckTx{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message RequestQuery{
|
message RequestQuery{
|
||||||
bytes query = 1;
|
bytes data = 1;
|
||||||
|
string path = 2;
|
||||||
|
uint64 height = 3;
|
||||||
|
bool prove = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
message RequestCommit{
|
message RequestCommit{
|
||||||
@ -189,8 +192,12 @@ message ResponseCheckTx{
|
|||||||
|
|
||||||
message ResponseQuery{
|
message ResponseQuery{
|
||||||
CodeType code = 1;
|
CodeType code = 1;
|
||||||
bytes data = 2;
|
int64 index = 2;
|
||||||
string log = 3;
|
bytes key = 3;
|
||||||
|
bytes value = 4;
|
||||||
|
bytes proof = 5;
|
||||||
|
uint64 height = 6;
|
||||||
|
string log = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ResponseCommit{
|
message ResponseCommit{
|
||||||
@ -207,7 +214,7 @@ message ResponseBeginBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
message ResponseEndBlock{
|
message ResponseEndBlock{
|
||||||
repeated Validator diffs = 4;
|
repeated Validator diffs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------
|
//----------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user