()
| 275 | } |
| 276 | |
| 277 | func (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. |
| 295 | func (cfs CFS) newFileNode() *Node { |
no test coverage detected