getPartitionOwnerInternal retrieves the owner of the specified partition without thread safety. This function assumes that synchronization has been handled by the caller.
(partitionID int)
| 386 | // getPartitionOwnerInternal retrieves the owner of the specified partition without thread safety. |
| 387 | // This function assumes that synchronization has been handled by the caller. |
| 388 | func (c *Consistent) getPartitionOwnerInternal(partitionID int) Member { |
| 389 | // Lookup the member associated with the given partition ID. |
| 390 | member, exists := c.partitions[partitionID] |
| 391 | if !exists { |
| 392 | // If the partition ID does not exist, return a nil Member. |
| 393 | return nil |
| 394 | } |
| 395 | |
| 396 | // Return a copy of the member to ensure thread safety. |
| 397 | return *member |
| 398 | } |
| 399 | |
| 400 | // LocateKey determines the owner of the partition corresponding to the given key. |
| 401 | // It calculates the partition ID for the key and retrieves the associated member in a thread-safe manner. |
no outgoing calls
no test coverage detected