Help us shape the future of Go! Take the 2026 Go Developer Survey

pathkey

package
v0.49.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pathkey derives the storage-scoped cache key (a node's path_hash) that addresses rows in the nodes table. Every layer that touches the node cache — the sync worker, the DB drivers, DAV, the e2e ancestor walk and the HTTP handlers — must hash a path identically, or the same file would map to different rows and appear twice after the next sync run.

It deliberately imports nothing from internal/* (only the standard library) so both the low-level DB drivers (internal/db/...) and the high-level HTTP handlers can depend on it without creating an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(storageID int64, p string) string

Hash returns the hex-encoded MD5 of the cleaned path (leading slash, no trailing slash) followed by a NUL separator and the little-endian 4-byte storage ID.

The exact byte layout is load-bearing: it addresses path_hash values that already exist in the database, so it must never change. This is a verbatim move of the body that was previously copied across nine call sites.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL