Interface ReplicationAPI


  • public interface ReplicationAPI
    This defines the API implemented by Ambry replication nodes.
    • Method Detail

      • controlReplicationForPartitions

        boolean controlReplicationForPartitions​(java.util.Collection<PartitionId> ids,
                                                java.util.List<java.lang.String> origins,
                                                boolean enable)
        Enables/disables replication of the given ids from origins. The disabling is in-memory and therefore is not valid across restarts.
        Parameters:
        ids - the PartitionIds to enable/disable it on.
        origins - the list of datacenters from which replication should be enabled/disabled. Having an empty list disables replication from all datacenters.
        enable - whether to enable (true) or disable.
        Returns:
        true if disabling succeeded, false otherwise. Disabling fails if origins is empty or contains unrecognized datacenters.
      • updateTotalBytesReadByRemoteReplica

        void updateTotalBytesReadByRemoteReplica​(PartitionId partitionId,
                                                 java.lang.String hostName,
                                                 java.lang.String replicaPath,
                                                 long totalBytesRead)
                                          throws StoreException
        Updates the total bytes read by a remote replica from local store
        Parameters:
        partitionId - PartitionId to which the replica belongs to
        hostName - HostName of the datanode where the replica belongs to
        replicaPath - Replica Path of the replica interested in
        totalBytesRead - Total bytes read by the replica
        Throws:
        StoreException
      • getRemoteReplicaLagFromLocalInBytes

        long getRemoteReplicaLagFromLocalInBytes​(PartitionId partitionId,
                                                 java.lang.String hostName,
                                                 java.lang.String replicaPath)
        Gets the replica lag of the remote replica with the local store
        Parameters:
        partitionId - The partition to which the remote replica belongs to
        hostName - The hostname where the remote replica is present
        replicaPath - The path of the remote replica on the host
        Returns:
        The lag in bytes that the remote replica is behind the local store