use of io.camunda.zeebe.protocol.record.BrokerInfoEncoder.PartitionLeaderTermsEncoder in project zeebe by zeebe-io.
the class BrokerInfo method write.
// TODO: This will be fixed in the https://github.com/zeebe-io/zeebe/issues/5640
@Override
public void write(final MutableDirectBuffer buffer, int offset) {
headerEncoder.wrap(buffer, offset).blockLength(bodyEncoder.sbeBlockLength()).templateId(bodyEncoder.sbeTemplateId()).schemaId(bodyEncoder.sbeSchemaId()).version(bodyEncoder.sbeSchemaVersion());
offset += headerEncoder.encodedLength();
bodyEncoder.wrap(buffer, offset).nodeId(nodeId).partitionsCount(partitionsCount).clusterSize(clusterSize).replicationFactor(replicationFactor);
final int addressesCount = addresses.size();
final AddressesEncoder addressesEncoder = bodyEncoder.addressesCount(addressesCount);
if (addressesCount > 0) {
for (final Entry<DirectBuffer, DirectBuffer> entry : addresses.entrySet()) {
final DirectBuffer apiName = entry.getKey();
final DirectBuffer address = entry.getValue();
addressesEncoder.next().putApiName(apiName, 0, apiName.capacity()).putAddress(address, 0, address.capacity());
}
}
final int partitionRolesCount = partitionRoles.size();
final PartitionRolesEncoder partitionRolesEncoder = bodyEncoder.partitionRolesCount(partitionRolesCount);
if (partitionRolesCount > 0) {
for (final Entry<Integer, PartitionRole> entry : partitionRoles.entrySet()) {
partitionRolesEncoder.next().partitionId(entry.getKey()).role(entry.getValue());
}
}
final int partitionLeaderTermsCount = partitionLeaderTerms.size();
final PartitionLeaderTermsEncoder partitionLeaderTermsEncoder = bodyEncoder.partitionLeaderTermsCount(partitionLeaderTermsCount);
if (partitionLeaderTermsCount > 0) {
for (final Entry<Integer, Long> entry : partitionLeaderTerms.entrySet()) {
partitionLeaderTermsEncoder.next().partitionId(entry.getKey()).term(entry.getValue());
}
}
bodyEncoder.putVersion(version, 0, version.capacity());
final int partitionHealthCount = partitionHealthStatuses.size();
final PartitionHealthEncoder partitionHealthEncoder = bodyEncoder.partitionHealthCount(partitionHealthCount);
if (partitionHealthCount > 0) {
for (final Entry<Integer, PartitionHealthStatus> entry : partitionHealthStatuses.entrySet()) {
partitionHealthEncoder.next().partitionId(entry.getKey()).healthStatus(entry.getValue());
}
}
}
use of io.camunda.zeebe.protocol.record.BrokerInfoEncoder.PartitionLeaderTermsEncoder in project zeebe by camunda-cloud.
the class BrokerInfo method write.
// TODO: This will be fixed in the https://github.com/zeebe-io/zeebe/issues/5640
@Override
public void write(final MutableDirectBuffer buffer, int offset) {
headerEncoder.wrap(buffer, offset).blockLength(bodyEncoder.sbeBlockLength()).templateId(bodyEncoder.sbeTemplateId()).schemaId(bodyEncoder.sbeSchemaId()).version(bodyEncoder.sbeSchemaVersion());
offset += headerEncoder.encodedLength();
bodyEncoder.wrap(buffer, offset).nodeId(nodeId).partitionsCount(partitionsCount).clusterSize(clusterSize).replicationFactor(replicationFactor);
final int addressesCount = addresses.size();
final AddressesEncoder addressesEncoder = bodyEncoder.addressesCount(addressesCount);
if (addressesCount > 0) {
for (final Entry<DirectBuffer, DirectBuffer> entry : addresses.entrySet()) {
final DirectBuffer apiName = entry.getKey();
final DirectBuffer address = entry.getValue();
addressesEncoder.next().putApiName(apiName, 0, apiName.capacity()).putAddress(address, 0, address.capacity());
}
}
final int partitionRolesCount = partitionRoles.size();
final PartitionRolesEncoder partitionRolesEncoder = bodyEncoder.partitionRolesCount(partitionRolesCount);
if (partitionRolesCount > 0) {
for (final Entry<Integer, PartitionRole> entry : partitionRoles.entrySet()) {
partitionRolesEncoder.next().partitionId(entry.getKey()).role(entry.getValue());
}
}
final int partitionLeaderTermsCount = partitionLeaderTerms.size();
final PartitionLeaderTermsEncoder partitionLeaderTermsEncoder = bodyEncoder.partitionLeaderTermsCount(partitionLeaderTermsCount);
if (partitionLeaderTermsCount > 0) {
for (final Entry<Integer, Long> entry : partitionLeaderTerms.entrySet()) {
partitionLeaderTermsEncoder.next().partitionId(entry.getKey()).term(entry.getValue());
}
}
bodyEncoder.putVersion(version, 0, version.capacity());
final int partitionHealthCount = partitionHealthStatuses.size();
final PartitionHealthEncoder partitionHealthEncoder = bodyEncoder.partitionHealthCount(partitionHealthCount);
if (partitionHealthCount > 0) {
for (final Entry<Integer, PartitionHealthStatus> entry : partitionHealthStatuses.entrySet()) {
partitionHealthEncoder.next().partitionId(entry.getKey()).healthStatus(entry.getValue());
}
}
}
use of io.camunda.zeebe.protocol.record.BrokerInfoEncoder.PartitionLeaderTermsEncoder in project zeebe by camunda.
the class BrokerInfo method write.
// TODO: This will be fixed in the https://github.com/zeebe-io/zeebe/issues/5640
@Override
public void write(final MutableDirectBuffer buffer, int offset) {
headerEncoder.wrap(buffer, offset).blockLength(bodyEncoder.sbeBlockLength()).templateId(bodyEncoder.sbeTemplateId()).schemaId(bodyEncoder.sbeSchemaId()).version(bodyEncoder.sbeSchemaVersion());
offset += headerEncoder.encodedLength();
bodyEncoder.wrap(buffer, offset).nodeId(nodeId).partitionsCount(partitionsCount).clusterSize(clusterSize).replicationFactor(replicationFactor);
final int addressesCount = addresses.size();
final AddressesEncoder addressesEncoder = bodyEncoder.addressesCount(addressesCount);
if (addressesCount > 0) {
for (final Entry<DirectBuffer, DirectBuffer> entry : addresses.entrySet()) {
final DirectBuffer apiName = entry.getKey();
final DirectBuffer address = entry.getValue();
addressesEncoder.next().putApiName(apiName, 0, apiName.capacity()).putAddress(address, 0, address.capacity());
}
}
final int partitionRolesCount = partitionRoles.size();
final PartitionRolesEncoder partitionRolesEncoder = bodyEncoder.partitionRolesCount(partitionRolesCount);
if (partitionRolesCount > 0) {
for (final Entry<Integer, PartitionRole> entry : partitionRoles.entrySet()) {
partitionRolesEncoder.next().partitionId(entry.getKey()).role(entry.getValue());
}
}
final int partitionLeaderTermsCount = partitionLeaderTerms.size();
final PartitionLeaderTermsEncoder partitionLeaderTermsEncoder = bodyEncoder.partitionLeaderTermsCount(partitionLeaderTermsCount);
if (partitionLeaderTermsCount > 0) {
for (final Entry<Integer, Long> entry : partitionLeaderTerms.entrySet()) {
partitionLeaderTermsEncoder.next().partitionId(entry.getKey()).term(entry.getValue());
}
}
bodyEncoder.putVersion(version, 0, version.capacity());
final int partitionHealthCount = partitionHealthStatuses.size();
final PartitionHealthEncoder partitionHealthEncoder = bodyEncoder.partitionHealthCount(partitionHealthCount);
if (partitionHealthCount > 0) {
for (final Entry<Integer, PartitionHealthStatus> entry : partitionHealthStatuses.entrySet()) {
partitionHealthEncoder.next().partitionId(entry.getKey()).healthStatus(entry.getValue());
}
}
}
Aggregations