MCPcopy
hub / github.com/google/codesearch / addName

Method addName

index/write.go:242–253  ·  view source on GitHub ↗

addName adds the file with the given name to the index. It returns the assigned file ID number.

(name string)

Source from the content-addressed store, hash-verified

240// addName adds the file with the given name to the index.
241// It returns the assigned file ID number.
242func (ix *IndexWriter) addName(name string) uint32 {
243 if strings.Contains(name, "\x00") {
244 log.Fatalf("%q: file has NUL byte in name", name)
245 }
246
247 ix.nameIndex.writeUint32(ix.nameData.offset())
248 ix.nameData.writeString(name)
249 ix.nameData.writeByte(0)
250 id := ix.numName
251 ix.numName++
252 return uint32(id)
253}
254
255// flushPost writes ix.post to a new temporary file and
256// clears the slice.

Callers 2

AddMethod · 0.95
FlushMethod · 0.95

Calls 4

writeUint32Method · 0.80
offsetMethod · 0.80
writeStringMethod · 0.80
writeByteMethod · 0.80

Tested by

no test coverage detected