/** * Check whether the parameters of the given request satisfies the * parameters of this method. * * @return true if the parameters of the given request satisfies * the parameters of this method * @param req a request **/ boolean checkParameters(Request req) { return req.parameters().satisfies(paramTypes); }
private void handleRpcUnreg(Request req) { log.log(Level.WARNING, "unregistered name " + req.parameters().get(0).asString()); }
@SuppressWarnings({"UnusedDeclaration"}) public final void setFileReferencesToDownload(Request req) { log.log(LogLevel.DEBUG, () -> "Received method call '" + req.methodName() + "' with parameters : " + req.parameters()); Arrays.stream(req.parameters().get(0).asStringArray()) .map(FileReference::new) .forEach(fileReference -> downloader.downloadIfNeeded(new FileReferenceDownload(fileReference))); req.returnValues().add(new Int32Value(0)); }
private void rpc_register(Request req) { String name = req.parameters().get(0).asString(); String spec = req.parameters().get(1).asString(); String stored = services.get(name); if (stored == null) { new RegisterCallback(req, name, spec); } else { if ( ! stored.equals(spec)) req.setError(ErrorCode.METHOD_FAILED, "service '" + name + "' registered with another spec"); } }
public void RPC_destroyIterator(Request req) { try { addResult(provider.destroyIterator(req.parameters().get(0).asInt64()), req); } catch (Exception e) { e.printStackTrace(); } }
protected Request createRequest(String method,List<String> arguments) { Request request=new Request(method); if (arguments!=null) { for (String argument : arguments) request.parameters().add(getArgument(request,argument)); } return request; }
public void RPC_put(Request req) { try { GrowableByteBuffer buffer = new GrowableByteBuffer(ByteBuffer.wrap(req.parameters().get(3).asData())); Document doc = new Document(DocumentDeserializerFactory.create42(docTypeManager, buffer)); addResult(provider.put(getBucket(req, 0), req.parameters().get(2).asInt64(), doc), req); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
public void RPC_setActiveState(Request req) { try { addResult(provider.setActiveState(getBucket(req, 0), BucketInfo.ActiveState.values()[req.parameters().get(2).asInt8()]), req); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
@Override public void getDocsums(List<FastHit> hits, NodeConnection node, CompressionType compression, int uncompressedLength, byte[] compressedSlime, RpcFillInvoker.GetDocsumsResponseReceiver responseReceiver, double timeoutSeconds) { Request request = new Request("proton.getDocsums"); request.parameters().add(new Int8Value(compression.getCode())); request.parameters().add(new Int32Value(uncompressedLength)); request.parameters().add(new DataValue(compressedSlime)); request.setContext(hits); RpcNodeConnection rpcNode = ((RpcNodeConnection) node); rpcNode.invokeAsync(request, timeoutSeconds, new RpcResponseWaiter(rpcNode, responseReceiver)); }
public void RPC_removeById(Request req) { addRemoveResult( provider.remove( getBucket(req, 0), req.parameters().get(2).asInt64(), new DocumentId(req.parameters().get(3).asString())), req); }
public void RPC_removeIfFound(Request req) { addRemoveResult( provider.removeIfFound( getBucket(req, 0), req.parameters().get(2).asInt64(), new DocumentId(req.parameters().get(3).asString())), req); }
Bucket getBucket(Request req, int index) { return new Bucket((short)req.parameters().get(index + 1).asInt64(), new BucketId(req.parameters().get(index).asInt64())); }
public boolean invokeVoid(Request req) { return postPacket(new RequestPacket(Packet.FLAG_NOREPLY, allocateKey(), req.methodName(), req.parameters())); }
public void invoke() { if (!conn.postPacket(new RequestPacket(0, replyKey.intValue(), req.methodName(), req.parameters()), this)) { req.setError(ErrorCode.CONNECTION, "Connection error"); reqWaiter.handleRequestDone(req); return; } timeoutTask.schedule(timeout); }
public void RPC_update(Request req) { try { GrowableByteBuffer buffer = new GrowableByteBuffer(ByteBuffer.wrap(req.parameters().get(3).asData())); DocumentUpdate update = new DocumentUpdate(DocumentDeserializerFactory.createHead(docTypeManager, buffer)); UpdateResult result = provider.update(getBucket(req, 0), req.parameters().get(2).asInt64(), update); addResult(result, req); req.returnValues().add(new Int64Value(result.getExistingTimestamp())); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }
private void rpc_fetchIncremental(Request req) { int gencnt = req.parameters().get(0).asInt32(); int timeout = req.parameters().get(1).asInt32(); // for now, always make "full diff" from generation 0 req.returnValues().add(new Int32Value(0)); req.returnValues().add(new StringArray(new String[0])); if (gencnt == this.gencnt) { pendingFetch.add(new FetchMirror(req, timeout)); } else { dumpServices(req); } }
public void RPC_removeEntry(Request req) { addResult( provider.removeEntry( getBucket(req, 0), req.parameters().get(2).asInt64()), req); }
public void RPC_setClusterState(Request req) throws java.text.ParseException { ClusterStateImpl state = new ClusterStateImpl(req.parameters().get(0).asData()); addResult(provider.setClusterState(state), req); }
public void RPC_move(Request req) { addResult(provider.move( getBucket(req, 0), (short)req.parameters().get(2).asInt64()), req); } }
public void RPC_get(Request req) { GetResult result = provider.get(getBucket(req, 0), getFieldSet(req, 2), new DocumentId(req.parameters().get(3).asString())); addResult(result, req); req.returnValues().add(new Int64Value(result.getLastModifiedTimestamp())); req.returnValues().add(new DataValue(serializeDocument(result.getDocument()))); }