Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public interface AdminClient extends AutoCloseable { 

    /**
     * AlterQuery the log directory information for the specified replicas.
log directories on the given *brokers.
     * UpdatesAll arelog notdirectories transactionalon soa theybroker mayare succeedqueried forif somean resourcesempty whilecollection failof forlog others.directories Theis log directoryspecified for
     * a particular replica is updated atomically.this broker
     *
     * This operation is supported by brokers with version 0.11.1.0 or higher.
     *
     * @param replicaAssignmentlogDirsByBroker    The replicasA withlist theirof log directorydirs absoluteper pathbroker
     * @param options             The options to use when changingquerying replicalog dir info
     * @return                    The AlterReplicaDirResultDescribeDirsResult
     */
    public abstract AlterReplicaDirResultDescribeDirsResult alterReplicaDirdescribeDirs(Map<TopicPartitionReplicaMap<Integer, String>Collection<String>> replicaAssignmentlogDirsByBroker, AlterReplicaDirOptionsDescribeDirsOptions options);
 
    /**
     * Query the logreplica directory information for the specified log directories on the given brokersreplicas.
     * All
 log directories on a broker* areThis queriedoperation ifis ansupported emptyby collectionbrokers ofwith log directories is specified for this brokerversion 0.11.1.0 or higher.
     *
     * This@param operationreplicas is supported by brokers with version 0.11.1.0 or higher.The replicas to query
     *
 @param options   * @param logDirsByBroker  The options to Ause listwhen ofquerying logreplica dirsdir per brokerinfo
     * @param@return options             The options to use when querying log dir info
     * @return    DescribeReplicaDirResult
     */
    public abstract DescribeReplicaDirResult describeReplicaDir(Collection<TopicPartitionReplica> replicas, DescribeReplicaDirOptions options);
}
 
 
public class KafkaAdminClient implements AdminClient {
    /**
     * Alter the log directory for the specified replicas.
    The DescribeDirsResult*
     */
    public abstract DescribeDirsResult describeDirs(Map<Integer, Collection<String>> logDirsByBroker, DescribeDirsOptions options);
 
    /** Updates are not transactional so they may succeed for some resources while fail for others. The log directory for
     * Querya theparticular replica directoryis information for the specified replicasupdated atomically.
     *
     * This operation is supported by brokers with version 0.11.1.0 or higher.
     *
     * @param replicasreplicaAssignment  The replicas with their Thelog replicasdirectory toabsolute querypath
     * @param options            The options to use when queryingchanging replica dir info
     * @return                   The DescribeReplicaDirResultAlterReplicaDirResult
     */
    public abstract DescribeReplicaDirResult describeReplicaDir(Collection<TopicPartitionReplica> replicas, DescribeReplicaDirOptionsAlterReplicaDirResult alterReplicaDir(Map<TopicPartitionReplica, String> replicaAssignment, AlterReplicaDirOptions options);
 
}


/**
  * Options for the alterReplicaDir call.
  */
class AlterReplicaDirOptions {
    private Integer timeoutMs = null;
    public AlterReplicaDirOptions timeoutMs(Integer timeoutMs);
    public Integer timeoutMs();
}
 
/**
  * The result of the alterReplicaDir call.
  */
class AlterReplicaDirResult {
    /**
     * Return a map from replica to futures, which can be used to check the status of individual replica movement.
     */
    public Map<TopicPartitionReplica, KafkaFuture<Void>> values();

    /**
     * Return a future which succeeds if all the replica movement have succeeded
     */
    public KafkaFuture<Void> all();
}
 
/**
  * Options for the describeDirs call.
  */
class DescribeDirsOptions {
    private Integer timeoutMs = null;
    public DescribeDirsOptions timeoutMs(Integer timeoutMs);
    public Integer timeoutMs();
}
 
/**
  * The result of the describeDirs call.
  */
class DescribeDirsResult {
    /**
     * Return a map from brokerId to futures which can be used to check the information of partitions on each individual broker
     */
    public Map<Integer, KafkaFuture<Map<String, LogDirInfo>>> values();

    /**
     * Return a future which succeeds only if all the brokers have responded without error
     */
    public KafkaFuture<Map<Integer, Map<String, LogDirInfo>>> all();
}
 
/**
  * Description of a log directory
  */
class LogDirInfo {
    public final Errors error;
    public final Map<TopicPartition, ReplicaInfo> replicaInfos;
}
 
/**
  * Description of a replica
  */
public class ReplicaInfo {
    public final long size;
    public final long logEndOffset;
    public final boolean isTemporary;
}
 
/**
  * Options for the describeReplicaDir call.
  */
class DescribeReplicaDirOptions {
    private Integer timeoutMs = null;
    public DescribeReplicaDirOptions timeoutMs(Integer timeoutMs);
    public Integer timeoutMs();
}
 
/**
  * The result of the describeReplicaDir call.
  */
class DescribeReplicaDirResult {
    /**
     * Return a map from replica to futures which can be used to check the log directory information of individual replicas
     */
    public Map<TopicPartitionReplica, KafkaFuture<ReplicaDirInfo>> values();

    /**
     * Return a future which succeeds if log directory information of all replicas are available
     */
    public KafkaFuture<Map<TopicPartitionReplica, ReplicaDirInfo>> all();
}

/**
  * Log directory information of a given replica and its intra-broker movement progress
  */
class ReplicaDirInfo {
    public String currentReplicaDir;
    public String temporaryReplicaDir;
    public long temporaryReplicaOffsetLag;
}

...