MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / newUniqueID

Method newUniqueID

cmd/cql-fuse/fs.go:277–292  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

275}
276
277func (cfs CFS) newUniqueID() (id uint64) {
278 // cockroach's unique_rowid() Contains time and space (node ID) components
279 // https://www.cockroachlabs.com/docs/stable/sql-faqs.html#\
280 // what-are-the-differences-between-uuid-sequences-and-unique_rowid
281 // So, we just build one in the same way.
282 var idRand uint32
283 nodeIDBytes, err := kms.GetLocalNodeIDBytes()
284 if err == nil {
285 idRand = hash.FNVHash32uint(nodeIDBytes)
286 }
287 return uint64(time.Now().UnixNano()) + uint64(idRand)<<32
288 //if err := cfs.db.QueryRow(`SELECT unique_rowid()`).Scan(&id); err != nil {
289 // panic(err)
290 //}
291 //return
292}
293
294// newFileNode returns a new node struct corresponding to a file.
295func (cfs CFS) newFileNode() *Node {

Callers 4

GenerateInodeMethod · 0.95
newFileNodeMethod · 0.95
newDirNodeMethod · 0.95
newSymlinkNodeMethod · 0.95

Calls 2

GetLocalNodeIDBytesFunction · 0.92
FNVHash32uintFunction · 0.92

Tested by

no test coverage detected