Interface RaftGroupManagerApi
- All Known Implementing Classes:
RaftGroupManager
public interface RaftGroupManagerApi
Narrow interface for routing operations to per-key or per-name Raft groups.
Consumers that only need to resolve a RaftNodeApi for a given key or group name
depend on this interface rather than on the concrete RaftGroupManager. Tests
substitute a Mockito mock of this interface; mocking the concrete RaftGroupManager
is forbidden by the project testing policy.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the configured upper bound for Raft group IDs.Gets the default group ("raft-0").getGroupForKey(String key) Routes a key to its Raft group via consistent hashing.@Nullable RaftNodeApigetGroupIfExists(String groupName) Gets a specific Raft group by name, ornullif it has not been instantiated yet.getOrCreateGroup(String groupName) Gets or creates a Raft group by name.booleanReturnstrueif a group with the given name has already been instantiated.
-
Method Details
-
getOrCreateGroup
Gets or creates a Raft group by name. Thread-safe; lazy creation. -
getGroupForKey
Routes a key to its Raft group via consistent hashing. Same key always routes to the same group. -
getDefaultGroup
RaftNodeApi getDefaultGroup()Gets the default group ("raft-0"). -
getGroupIfExists
Gets a specific Raft group by name, ornullif it has not been instantiated yet. -
hasGroup
Returnstrueif a group with the given name has already been instantiated. -
configuredGroupCount
default int configuredGroupCount()Returns the configured upper bound for Raft group IDs.Implementations that do not expose a fixed group count may return
Integer.MAX_VALUE, which preserves permissive validation for tests and custom managers.
-