MCPcopy Create free account
hub / github.com/AdRoll/baker / openSplit

Function openSplit

pkg/splitwriter/split_writer.go:59–74  ·  view source on GitHub ↗

openSplit opens or creates the last split corresponding to fname and returns it. The last split can be fname itself.

(fname string)

Source from the content-addressed store, hash-verified

57// openSplit opens or creates the last split corresponding to fname
58// and returns it. The last split can be fname itself.
59func openSplit(fname string) (*os.File, error) {
60 for {
61 next, _, err := nextSplit(fname)
62 if err != nil {
63 return nil, err
64 }
65
66 if !fileExists(next) {
67 break
68 }
69
70 fname = next
71 }
72
73 return open(fname)
74}
75
76func (w *splitWriter) Write(p []byte) (n int, err error) {
77 return w.f.Write(p)

Callers 1

NewFunction · 0.85

Calls 3

nextSplitFunction · 0.85
fileExistsFunction · 0.85
openFunction · 0.85

Tested by

no test coverage detected