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

Method WriteBodyAt

internal/utils/bfs/file_writer.go:63–79  ·  view source on GitHub ↗
(b []byte, offset int64)

Source from the content-addressed store, hash-verified

61}
62
63func (this *FileWriter) WriteBodyAt(b []byte, offset int64) (n int, err error) {
64 if !this.hasMeta {
65 err = errors.New("no meta found")
66 return
67 }
68
69 if !this.isPartial {
70 err = errors.New("can not write body at specified offset: it is not a partial file")
71 return
72 }
73
74 // still 'Write()' NOT 'WriteAt()'
75 this.originOffset = offset
76 n, err = this.bFile.Write(this.hash, BlockTypeBody, b, offset)
77 this.originOffset += int64(n)
78 return
79}
80
81func (this *FileWriter) Close() error {
82 defer func() {

Callers 1

Calls 1

WriteMethod · 0.65

Tested by 1