GetPartitionOwner retrieves the owner of the specified partition in a thread-safe manner. It ensures that the access to shared resources is synchronized.
(partitionID int)
| 375 | // GetPartitionOwner retrieves the owner of the specified partition in a thread-safe manner. |
| 376 | // It ensures that the access to shared resources is synchronized. |
| 377 | func (c *Consistent) GetPartitionOwner(partitionID int) Member { |
| 378 | // Acquire a read lock to ensure thread-safe access to the partitions map. |
| 379 | c.mu.RLock() |
| 380 | defer c.mu.RUnlock() |
| 381 | |
| 382 | // Delegate the actual lookup to the non-thread-safe internal helper function. |
| 383 | return c.getPartitionOwnerInternal(partitionID) |
| 384 | } |
| 385 | |
| 386 | // getPartitionOwnerInternal retrieves the owner of the specified partition without thread safety. |
| 387 | // This function assumes that synchronization has been handled by the caller. |
no test coverage detected