Examples of ExistsRequest


Examples of org.apache.zookeeper.proto.ExistsRequest

        final String path = "/m1";

        RequestHeader h = new RequestHeader();
        h.setType(888)// This code does not exists
        ExistsRequest request = new ExistsRequest();
        request.setPath(path);
        request.setWatch(false);
        ExistsResponse response = new ExistsResponse();
        ReplyHeader r = zk.submitRequest(h, request, response, null);

        Assert.assertEquals(r.getErr(), Code.UNIMPLEMENTED.intValue());
View Full Code Here

Examples of org.apache.zookeeper.proto.ExistsRequest

                break;
            }
            case OpCode.exists: {
                lastOp = "EXIS";
                // TODO we need to figure out the security requirement for this!
                ExistsRequest existsRequest = new ExistsRequest();
                ByteBufferInputStream.byteBuffer2Record(request.request,
                        existsRequest);
                String path = existsRequest.getPath();
                if (path.indexOf('\0') != -1) {
                    throw new KeeperException.BadArgumentsException();
                }
                Stat stat = zks.getZKDatabase().statNode(path, existsRequest
                        .getWatch() ? cnxn : null);
                rsp = new ExistsResponse(stat);
                break;
            }
            case OpCode.getData: {
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.proto.ExistsRequest

                break;
            }
            case OpCode.exists: {
                lastOp = "EXIS";
                // TODO we need to figure out the security requirement for this!
                ExistsRequest existsRequest = new ExistsRequest();
                ZooKeeperServer.byteBuffer2Record(request.request,
                        existsRequest);
                String path = existsRequest.getPath();
                if (path.indexOf('\0') != -1) {
                    throw new KeeperException.BadArgumentsException();
                }
                Stat stat = getZKDatabase().statNode(path,
                        existsRequest.getWatch() ? cnxn : null);
                rsp = new ExistsResponse(stat);
                break;
            }
            case OpCode.getData: {
                lastOp = "GETD";
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.proto.ExistsRequest

  }
  public int compareTo (Object peer_) throws ClassCastException {
    if (!(peer_ instanceof ExistsRequest)) {
      throw new ClassCastException("Comparing different types of records.");
    }
    ExistsRequest peer = (ExistsRequest) peer_;
    int ret = 0;
    ret = path.compareTo(peer.path);
    if (ret != 0) return ret;
    ret = (watch == peer.watch)? 0 : (watch?1:-1);
    if (ret != 0) return ret;
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.proto.ExistsRequest

      return false;
    }
    if (peer_ == this) {
      return true;
    }
    ExistsRequest peer = (ExistsRequest) peer_;
    boolean ret = false;
    ret = path.equals(peer.path);
    if (!ret) return ret;
    ret = (watch==peer.watch);
    if (!ret) return ret;
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.proto.ExistsRequest

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.exists);
        ExistsRequest request = new ExistsRequest();
        request.setPath(serverPath);
        request.setWatch(watcher != null);
        SetDataResponse response = new SetDataResponse();
        ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
        if (r.getErr() != 0) {
            if (r.getErr() == KeeperException.Code.NONODE.intValue()) {
                return null;
View Full Code Here

Examples of org.apache.zookeeper_voltpatches.proto.ExistsRequest

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.exists);
        ExistsRequest request = new ExistsRequest();
        request.setPath(serverPath);
        request.setWatch(watcher != null);
        SetDataResponse response = new SetDataResponse();
        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
                clientPath, serverPath, ctx, wcb);
    }
View Full Code Here

Examples of org.elasticsearch.action.exists.ExistsRequest

     * @param indices The indices to count matched documents against a query. Use <tt>null</tt> or <tt>_all</tt> to execute against all indices
     * @return The exists request
     * @see org.elasticsearch.client.Client#exists(org.elasticsearch.action.exists.ExistsRequest)
     */
    public static ExistsRequest existsRequest(String... indices) {
        return new ExistsRequest(indices);
    }
View Full Code Here

Examples of org.elasticsearch.action.exists.ExistsRequest

        super(settings, controller, client);
    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
        final ExistsRequest existsRequest = new ExistsRequest(Strings.splitStringByCommaToArray(request.param("index")));
        existsRequest.indicesOptions(IndicesOptions.fromRequest(request, existsRequest.indicesOptions()));
        existsRequest.listenerThreaded(false);
        if (request.hasContent()) {
            existsRequest.source(request.content(), request.contentUnsafe());
        } else {
            String source = request.param("source");
            if (source != null) {
                existsRequest.source(source);
            } else {
                QuerySourceBuilder querySourceBuilder = RestActions.parseQuerySource(request);
                if (querySourceBuilder != null) {
                    existsRequest.source(querySourceBuilder);
                }
            }
        }
        existsRequest.routing(request.param("routing"));
        existsRequest.minScore(request.paramAsFloat("min_score", DEFAULT_MIN_SCORE));
        existsRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
        existsRequest.preference(request.param("preference"));

        client.exists(existsRequest, new RestBuilderListener<ExistsResponse>(channel) {
            @Override
            public RestResponse buildResponse(ExistsResponse response, XContentBuilder builder) throws Exception {
                RestStatus status = response.exists() ? OK : NOT_FOUND;
View Full Code Here

Examples of org.elasticsearch.action.exists.ExistsRequest

    @Test
    public void testExists() {
        String existsShardAction = ExistsAction.NAME + "[s]";
        interceptTransportActions(existsShardAction);

        ExistsRequest existsRequest = new ExistsRequest(randomIndicesOrAliases());
        internalCluster().clientNodeClient().exists(existsRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(existsRequest, existsShardAction);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.