MCPcopy
hub / github.com/cloudflare/tableflip / AddFile

Method AddFile

fds.go:382–396  ·  view source on GitHub ↗

AddFile adds a file.

(name string, file *os.File)

Source from the content-addressed store, hash-verified

380
381// AddFile adds a file.
382func (f *Fds) AddFile(name string, file *os.File) error {
383 key := fileName{fdKind, name}
384
385 dup, err := dupConn(file, key)
386 if err != nil {
387 return err
388 }
389
390 f.mu.Lock()
391 defer f.mu.Unlock()
392
393 delete(f.inherited, key)
394 f.used[key] = dup
395 return nil
396}
397
398func (f *Fds) copy() map[fileName]*file {
399 f.mu.Lock()

Callers 4

TestUpgraderOnOSFunction · 0.45
BenchmarkUpgradeFunction · 0.45
TestFdsFileFunction · 0.45
TestFdsFilesFunction · 0.45

Calls 1

dupConnFunction · 0.85

Tested by 4

TestUpgraderOnOSFunction · 0.36
BenchmarkUpgradeFunction · 0.36
TestFdsFileFunction · 0.36
TestFdsFilesFunction · 0.36