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

Method WriteHeaderBlockUnsafe

internal/utils/bfs/meta_file.go:119–139  ·  view source on GitHub ↗
(hash string, bOffsetFrom int64, bOffsetTo int64)

Source from the content-addressed store, hash-verified

117}
118
119func (this *MetaFile) WriteHeaderBlockUnsafe(hash string, bOffsetFrom int64, bOffsetTo int64) error {
120 lazyHeader, ok := this.headerMap[hash]
121 if !ok {
122 return nil
123 }
124
125 header, err := lazyHeader.FileHeaderUnsafe()
126 if err != nil {
127 return err
128 }
129
130 // TODO 合并相邻block
131 header.HeaderBlocks = append(header.HeaderBlocks, BlockInfo{
132 BFileOffsetFrom: bOffsetFrom,
133 BFileOffsetTo: bOffsetTo,
134 })
135
136 this.modifiedHashMap[hash] = zero.Zero{}
137
138 return nil
139}
140
141func (this *MetaFile) WriteBodyBlockUnsafe(hash string, bOffsetFrom int64, bOffsetTo int64, originOffsetFrom int64, originOffsetTo int64) error {
142 lazyHeader, ok := this.headerMap[hash]

Callers 2

TestMetaFile_WriteMetaFunction · 0.80
WriteMethod · 0.80

Calls 1

FileHeaderUnsafeMethod · 0.45

Tested by 1

TestMetaFile_WriteMetaFunction · 0.64