-
Notifications
You must be signed in to change notification settings - Fork 14
Java API
IntraVert's wire format is designed to be simple and readable even by human operators. The typical payload is Json which can be written by hand. If you are using Java (which is the reference implementation) this page will help you navigate the api.
IntraClient is a wrapper over the Vertx client. Currently it supports a single method
public IntraRes sendBlocking(IntraReq i) throws Exception ;
The user sends a request (IntraReq) object and is returned an response (IntraRes) object.
An IntraReq is composed to one or more Operatations
these operations are sometimes called verbs. Operations include set, get, slice, etc.
IntraReq innerReq = new IntraReq();
innerReq.add( Operations.setColumnFamilyOp("users") ); //0
innerReq.add( Operations.setOp(uid, "fname", fname) ); //1
innerReq.add( Operations.setOp(uid, "lname", lname) ); //2
IntraRes result = client.sendBlocking(innerReq); //3
Operations is a factory class. Each operation has one or more associated static factory methods which create an object type IntraOp. IntraOp is currently mutable so it can be edited after being created.
IntraRes is the response object. Since the request has a list of operations the response has a list of results.
Assert.assertEquals ( "OK" , res.getOpsRes().get(0) );
Assert.assertEquals( 1, res.getOpsRes().size() );
Assert.assertNotNull( res.getException() );
Assert.assertEquals( new Integer(1) , res.getExceptionId() );
If the request has an exception the processing stops. res.getException()
and res.getExceptionId()
are used by the client to see where things went wrong.
If no exception occurred the the res.getOpsRes()
will be the same size as the number of request operations. Operations like set return "OK", operations like slice return a List.