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

Method WriteBodyLength

internal/caches/writer_file.go:111–128  ·  view source on GitHub ↗

WriteBodyLength 写入Body长度数据

(bodyLength int64)

Source from the content-addressed store, hash-verified

109
110// WriteBodyLength 写入Body长度数据
111func (this *FileWriter) WriteBodyLength(bodyLength int64) error {
112 if this.metaBodySize >= 0 && bodyLength == this.metaBodySize {
113 return nil
114 }
115 var bytes8 = make([]byte, 8)
116 binary.BigEndian.PutUint64(bytes8, uint64(bodyLength))
117 _, err := this.rawWriter.Seek(SizeExpiresAt+SizeStatus+SizeURLLength+SizeHeaderLength, io.SeekStart)
118 if err != nil {
119 _ = this.Discard()
120 return err
121 }
122 _, err = this.rawWriter.Write(bytes8)
123 if err != nil {
124 _ = this.Discard()
125 return err
126 }
127 return nil
128}
129
130// Close 关闭
131func (this *FileWriter) Close() error {

Callers 1

CloseMethod · 0.95

Calls 3

DiscardMethod · 0.95
SeekMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected