MCPcopy
hub / github.com/grafana/tempo / CreateFile

Function CreateFile

pkg/util/atomicfs/fsync.go:93–103  ·  view source on GitHub ↗

CreateFile safely writes the contents of data to filePath, ensuring that all data has been fsynced as well as the containing directory of the file.

(filePath string, data io.Reader)

Source from the content-addressed store, hash-verified

91// CreateFile safely writes the contents of data to filePath, ensuring that all data
92// has been fsynced as well as the containing directory of the file.
93func CreateFile(filePath string, data io.Reader) error {
94 f, err := Create(filePath)
95 if err != nil {
96 return err
97 }
98
99 _, err = io.Copy(f, data)
100 merr := multierror.New(err)
101 merr.Add(f.Close())
102 return merr.Err()
103}

Callers 1

CreateFunction · 0.92

Calls 3

CreateFunction · 0.70
AddMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected