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

io.agora.rtm.RtmLock Maven / Gradle / Ivy

package io.agora.rtm;

import io.agora.rtm.LockDetail;
import io.agora.rtm.ResultCallback;
import io.agora.rtm.RtmConstants;
import io.agora.rtm.RtmConstants.RtmChannelType;
import java.util.ArrayList;

/**
 * The RtmLock class.
 *
 * This class provides the rtm lock methods that can be invoked by your app.
 */
public abstract class RtmLock {
  /**
   * sets a lock.
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param lockName       The name of the lock.
   * @param ttl            The lock ttl.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void setLock(String channelName, RtmChannelType channelType, String lockName,
      long ttl, ResultCallback resultCallback);

  /**
   * gets locks in the channel.
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void getLocks(String channelName, RtmChannelType channelType,
      ResultCallback> resultCallback);

  /**
   * removes a lock.
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param lockName       The name of the lock.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void removeLock(String channelName, RtmChannelType channelType, String lockName,
      ResultCallback resultCallback);

  /**
   * acquires a lock
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param lockName       The name of the lock.
   * @param retry          Whether to automatically retry when acquires lock
   *                       failed
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void acquireLock(String channelName, RtmChannelType channelType, String lockName,
      boolean retry, ResultCallback resultCallback);

  /**
   * releases a lock
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param lockName       The name of the lock.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void releaseLock(String channelName, RtmChannelType channelType, String lockName,
      ResultCallback resultCallback);

  /**
   * disables a lock
   *
   * @param channelName    The name of the channel.
   * @param channelType    The type of the channel.
   * @param lockName       The name of the lock.
   * @param owner          The lock owner.
   * @param resultCallback A {@link ResultCallback} object.
   *                       - Success: will receives the
   *                       {@link ResultCallback.onSuccess()} callback.
   *                       - Failure: will receives the
   *                       {@link ResultCallback.onFailure()} callback.
   */
  public abstract void revokeLock(String channelName, RtmChannelType channelType, String lockName,
      String owner, ResultCallback resultCallback);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy