MCPcopy Create free account
hub / github.com/Permify/permify / getPartitionOwnerInternal

Method getPartitionOwnerInternal

pkg/consistent/consistent.go:388–398  ·  view source on GitHub ↗

getPartitionOwnerInternal retrieves the owner of the specified partition without thread safety. This function assumes that synchronization has been handled by the caller.

(partitionID int)

Source from the content-addressed store, hash-verified

386// getPartitionOwnerInternal retrieves the owner of the specified partition without thread safety.
387// This function assumes that synchronization has been handled by the caller.
388func (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.

Callers 2

GetPartitionOwnerMethod · 0.95
closestNMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected