public class ApiStatePersistenceStore extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
ApiStatePersistenceStore.SbkApiStatusKeySerde |
static class |
ApiStatePersistenceStore.SbkApiStatusMessageSerde |
Modifier and Type | Field and Description |
---|---|
static String |
API_STATE_TOPIC_CLEANUP_POLICY |
Constructor and Description |
---|
ApiStatePersistenceStore(kafka.server.KafkaConfig config,
org.apache.kafka.common.utils.Time time,
Map<String,Object> clientProperties) |
Modifier and Type | Method and Description |
---|---|
static void |
checkStartupCondition(KafkaCruiseControlConfig config,
Semaphore abortStartupCheck)
Make sure any condition needed to start this
CruiseControlComponent is satisfied. |
void |
close() |
Map<ImmutableSet<Integer>,BrokerRemovalStateRecord> |
getAllBrokerRemovalStateRecords() |
BrokerRemovalStateRecord |
getBrokerRemovalStateRecord(ImmutableSet<Integer> brokerIds) |
EvenClusterLoadStateRecord |
getEvenClusterLoadStateRecord() |
Map<Integer,Long> |
getFailedBrokers() |
void |
init(kafka.server.KafkaConfig config,
org.apache.kafka.common.utils.Time time,
Map<String,Object> clientProperties) |
void |
putRemovalRecord(BrokerRemovalStateRecord stateRecord) |
void |
save(BrokerRemovalStateRecord removalStateRecord,
boolean isNew)
Save api status passed in as argument
removalStatus to persistence store. |
void |
save(EvenClusterLoadStateRecord stateRecord)
Method to save EvenClusterLoad status
|
void |
save(Map<Integer,Long> failedBrokers)
Save list of failed brokers to the persistence store.
|
public static final String API_STATE_TOPIC_CLEANUP_POLICY
public void init(kafka.server.KafkaConfig config, org.apache.kafka.common.utils.Time time, Map<String,Object> clientProperties)
public void close()
close
in interface AutoCloseable
public void save(BrokerRemovalStateRecord removalStateRecord, boolean isNew) throws InterruptedException
removalStatus
to persistence store. If isNew
is set to true, the "startTime" field will be set to current time. This is the case when we acknowledge
the api request to process. Any update to api status will then onward will have this field set and the
isNew
flag should be false.
After adding the removalStatus
to topic, the method flushes the producer and then reads it back,
which may block upto READ_TO_END_TIMEOUT_MS
.InterruptedException
public BrokerRemovalStateRecord getBrokerRemovalStateRecord(ImmutableSet<Integer> brokerIds)
public Map<ImmutableSet<Integer>,BrokerRemovalStateRecord> getAllBrokerRemovalStateRecords()
public void putRemovalRecord(BrokerRemovalStateRecord stateRecord)
public void save(Map<Integer,Long> failedBrokers) throws InterruptedException
failedBrokers
- A map of "broker id" to "broker failure time". This gets
serialized as a list and get saved as one record in the persistence topic.InterruptedException
public void save(EvenClusterLoadStateRecord stateRecord) throws InterruptedException
InterruptedException
public EvenClusterLoadStateRecord getEvenClusterLoadStateRecord()
public static void checkStartupCondition(KafkaCruiseControlConfig config, Semaphore abortStartupCheck)
CruiseControlComponent
is satisfied.