MCPcopy Index your code
hub / github.com/modelcontextprotocol/registry / hashServerName

Function hashServerName

internal/database/postgres.go:781–792  ·  view source on GitHub ↗

hashServerName creates a consistent hash of the server name for advisory locking We use FNV-1a hash and mask to 63 bits to fit in PostgreSQL's bigint range

(name string)

Source from the content-addressed store, hash-verified

779// hashServerName creates a consistent hash of the server name for advisory locking
780// We use FNV-1a hash and mask to 63 bits to fit in PostgreSQL's bigint range
781func hashServerName(name string) int64 {
782 const (
783 offset64 = 14695981039346656037
784 prime64 = 1099511628211
785 )
786 hash := uint64(offset64)
787 for i := 0; i < len(name); i++ {
788 hash ^= uint64(name[i])
789 hash *= prime64
790 }
791 return int64(hash & 0x7FFFFFFFFFFFFFFF)
792}
793
794// GetCurrentLatestVersion retrieves the current latest version of a server by server name
795func (db *PostgreSQL) GetCurrentLatestVersion(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error) {

Callers 1

AcquirePublishLockMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…