All Downloads are FREE. Search and download functionalities are using the official Maven repository.

qcloud.storage.ranger.thirdparty.org.apache.curator.framework.CuratorFramework Maven / Gradle / Ivy

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package qcloud.storage.ranger.thirdparty.org.apache.curator.framework;

import qcloud.storage.ranger.thirdparty.org.apache.curator.CuratorZookeeperClient;
import qcloud.storage.ranger.thirdparty.org.apache.curator.framework.api.*;
import qcloud.storage.ranger.thirdparty.org.apache.curator.framework.api.transaction.CuratorTransaction;
import qcloud.storage.ranger.thirdparty.org.apache.curator.framework.imps.CuratorFrameworkState;
import qcloud.storage.ranger.thirdparty.org.apache.curator.framework.listen.Listenable;
import qcloud.storage.ranger.thirdparty.org.apache.curator.framework.state.ConnectionState;
import qcloud.storage.ranger.thirdparty.org.apache.curator.framework.state.ConnectionStateListener;
import qcloud.storage.ranger.thirdparty.org.apache.curator.utils.EnsurePath;
import qcloud.storage.ranger.thirdparty.org.apache.zookeeper.Watcher;

import java.io.Closeable;
import java.util.concurrent.TimeUnit;

/**
 * Zookeeper framework-style client
 */
public interface CuratorFramework extends Closeable
{
    /**
     * Start the client. Most mutator methods will not work until the client is started
     */
    public void start();

    /**
     * Stop the client
     */
    public void close();

    /**
     * Returns the state of this instance
     *
     * @return state
     */
    public CuratorFrameworkState getState();

    /**
     * Return true if the client is started, not closed, etc.
     *
     * @return true/false
     * @deprecated use {@link #getState()} instead
     */
    public boolean isStarted();

    /**
     * Start a create builder
     *
     * @return builder object
     */
    public CreateBuilder create();

    /**
     * Start a delete builder
     *
     * @return builder object
     */
    public DeleteBuilder delete();

    /**
     * Start an exists builder
     * 

* The builder will return a Stat object as if qcloud.storage.ranger.thirdparty.org.apache.zookeeper.ZooKeeper.exists() were called. Thus, a null * means that it does not exist and an actual Stat object means it does exist. * * @return builder object */ public ExistsBuilder checkExists(); /** * Start a get data builder * * @return builder object */ public GetDataBuilder getData(); /** * Start a set data builder * * @return builder object */ public SetDataBuilder setData(); /** * Start a get children builder * * @return builder object */ public GetChildrenBuilder getChildren(); /** * Start a get ACL builder * * @return builder object */ public GetACLBuilder getACL(); /** * Start a set ACL builder * * @return builder object */ public SetACLBuilder setACL(); /** * Start a transaction builder * * @return builder object */ public CuratorTransaction inTransaction(); /** * Perform a sync on the given path - syncs are always in the background * * @param path the path * @param backgroundContextObject optional context * @deprecated use {@link #sync()} instead */ public void sync(String path, Object backgroundContextObject); /** * Start a sync builder. Note: sync is ALWAYS in the background even * if you don't use one of the background() methods * * @return builder object */ public SyncBuilder sync(); /** * Returns the listenable interface for the Connect State * * @return listenable */ public Listenable getConnectionStateListenable(); /** * Returns the listenable interface for events * * @return listenable */ public Listenable getCuratorListenable(); /** * Returns the listenable interface for unhandled errors * * @return listenable */ public Listenable getUnhandledErrorListenable(); /** * Returns a facade of the current instance that does _not_ automatically * pre-pend the namespace to all paths * * @return facade * @deprecated use {@link #usingNamespace} passing null */ public CuratorFramework nonNamespaceView(); /** * Returns a facade of the current instance that uses the specified namespace * or no namespace if newNamespace is null. * * @param newNamespace the new namespace or null for none * @return facade */ public CuratorFramework usingNamespace(String newNamespace); /** * Return the current namespace or "" if none * * @return namespace */ public String getNamespace(); /** * Return the managed zookeeper client * * @return client */ public CuratorZookeeperClient getZookeeperClient(); /** * Allocates an ensure path instance that is namespace aware * * @param path path to ensure * @return new EnsurePath instance */ public EnsurePath newNamespaceAwareEnsurePath(String path); /** * Curator can hold internal references to watchers that may inhibit garbage collection. * Call this method on watchers you are no longer interested in. * * @param watcher the watcher */ public void clearWatcherReferences(Watcher watcher); /** * Block until a connection to ZooKeeper is available or the maxWaitTime has been exceeded * @param maxWaitTime The maximum wait time. Specify a value <= 0 to wait indefinitely * @param units The time units for the maximum wait time. * @return True if connection has been established, false otherwise. * @throws InterruptedException If interrupted while waiting */ public boolean blockUntilConnected(int maxWaitTime, TimeUnit units) throws InterruptedException; /** * Block until a connection to ZooKeeper is available. This method will not return until a * connection is available or it is interrupted, in which case an InterruptedException will * be thrown * @throws InterruptedException If interrupted while waiting */ public void blockUntilConnected() throws InterruptedException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy