MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / Write

Method Write

internal/caches/writer_file.go:76–101  ·  view source on GitHub ↗

Write 写入数据

(data []byte)

Source from the content-addressed store, hash-verified

74
75// Write 写入数据
76func (this *FileWriter) Write(data []byte) (n int, err error) {
77 // split LARGE data
78 var l = len(data)
79 if l > (2 << 20) {
80 var offset = 0
81 const bufferSize = 64 << 10
82 for {
83 var end = offset + bufferSize
84 if end > l {
85 end = l
86 }
87 n1, err1 := this.write(data[offset:end])
88 n += n1
89 if err1 != nil {
90 return n, err1
91 }
92 if end >= l {
93 return n, nil
94 }
95 offset = end
96 }
97 }
98
99 // write NORMAL size data
100 return this.write(data)
101}
102
103// WriteAt 在指定位置写入数据
104func (this *FileWriter) WriteAt(offset int64, data []byte) error {

Callers

nothing calls this directly

Calls 1

writeMethod · 0.95

Tested by

no test coverage detected