Package io.aeron.cluster.service
Class ClusterCounters
java.lang.Object
io.aeron.cluster.service.ClusterCounters
For allocating and finding cluster associated counters identified by
ClusteredServiceContainer.Context.clusterId().-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSuffix for `clusterId` in the counter label. -
Method Summary
Modifier and TypeMethodDescriptionstatic Counterallocate(Aeron aeron, MutableDirectBuffer tempBuffer, String name, int typeId, int clusterId) Allocate a counter to represent component state within a cluster.static CounterallocateServiceCounter(Aeron aeron, MutableDirectBuffer tempBuffer, String name, int typeId, int clusterId, int serviceId) Allocate a counter to represent component state within a cluster.static CounterallocateVersioned(Aeron aeron, MutableDirectBuffer tempBuffer, String name, int typeId, int clusterId, String version, String commitHashCode) Allocate a counter to represent component state within a cluster and append a version info to its label.static intfind(CountersReader counters, int typeId, int clusterId) Find the counter id for a type of counter in a cluster.
-
Field Details
-
CLUSTER_ID_LABEL_SUFFIX
Suffix for `clusterId` in the counter label.- See Also:
-
-
Method Details
-
allocate
public static Counter allocate(Aeron aeron, MutableDirectBuffer tempBuffer, String name, int typeId, int clusterId) Allocate a counter to represent component state within a cluster.- Parameters:
aeron- to allocate the counter.tempBuffer- temporary storage to create label and metadata.name- of the counter for the label.typeId- for the counter.clusterId- to which the allocated counter belongs.- Returns:
- the new
Counter.
-
allocateVersioned
public static Counter allocateVersioned(Aeron aeron, MutableDirectBuffer tempBuffer, String name, int typeId, int clusterId, String version, String commitHashCode) Allocate a counter to represent component state within a cluster and append a version info to its label.- Parameters:
aeron- to allocate the counter.tempBuffer- temporary storage to create label and metadata.name- of the counter for the label.typeId- for the counter.clusterId- to which the allocated counter belongs.version- of the component.commitHashCode- Git commit SHA of the component.- Returns:
- the new
Counter.
-
find
Find the counter id for a type of counter in a cluster.- Parameters:
counters- to search within.typeId- of the counter.clusterId- to which the allocated counter belongs.- Returns:
- the matching counter id or
Aeron.NULL_VALUEif not found.
-
allocateServiceCounter
public static Counter allocateServiceCounter(Aeron aeron, MutableDirectBuffer tempBuffer, String name, int typeId, int clusterId, int serviceId) Allocate a counter to represent component state within a cluster.- Parameters:
aeron- to allocate the counter.tempBuffer- temporary storage to create label and metadata.name- of the counter for the label.typeId- for the counter.clusterId- to which the allocated counter belongs.serviceId- to which the allocated counter belongs.- Returns:
- the
Counterfor the commit position.
-