github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/core/fqn.go (about) 1 // Package core provides core metadata and in-cluster API 2 /* 3 * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. 4 */ 5 package core 6 7 import ( 8 "github.com/NVIDIA/aistore/cmn" 9 "github.com/NVIDIA/aistore/fs" 10 ) 11 12 func ResolveFQN(fqn string, parsed *fs.ParsedFQN) (hrwFQN string, err error) { 13 if err = parsed.Init(fqn); err != nil { 14 return 15 } 16 17 // NOTE: _misplaced_ hrwFQN != fqn is checked elsewhere - see lom.IsHRW() 18 19 var digest uint64 20 hrwFQN, digest, err = HrwFQN(&parsed.Bck, parsed.ContentType, parsed.ObjName) 21 if err != nil { 22 return 23 } 24 parsed.Digest = digest 25 return 26 } 27 28 func HrwFQN(bck *cmn.Bck, contentType, objName string) (fqn string, digest uint64, err error) { 29 var ( 30 mi *fs.Mountpath 31 uname = bck.MakeUname(objName) 32 ) 33 if mi, digest, err = fs.Hrw(uname); err == nil { 34 fqn = mi.MakePathFQN(bck, contentType, objName) 35 } 36 return 37 }