blob: f327dcbb00596fac2f44813e8f14395937ed11b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package mountmanager
import (
"fmt"
"path/filepath"
"github.com/seaweedfs/seaweedfs/weed/util"
)
// DefaultSocketDir is the default directory for volume sockets.
const DefaultSocketDir = "/var/lib/seaweedfs-mount"
// LocalSocketPath returns the unix socket path used to communicate with the weed mount process.
// The baseDir parameter should be the directory where sockets are stored (e.g., derived from mountEndpoint).
func LocalSocketPath(baseDir, volumeID string) string {
if baseDir == "" {
baseDir = DefaultSocketDir
}
hash := util.HashToInt32([]byte(volumeID))
if hash < 0 {
hash = -hash
}
return filepath.Join(baseDir, fmt.Sprintf("seaweedfs-mount-%d.sock", hash))
}
|