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

Method WriteMeta

internal/utils/bfs/meta_file.go:101–117  ·  view source on GitHub ↗
(hash string, status int, expiresAt int64, expectedFileSize int64)

Source from the content-addressed store, hash-verified

99}
100
101func (this *MetaFile) WriteMeta(hash string, status int, expiresAt int64, expectedFileSize int64) error {
102
103 this.mu.Lock()
104 defer this.mu.Unlock()
105
106 this.headerMap[hash] = NewLazyFileHeader(&FileHeader{
107 Version: Version1,
108 ExpiresAt: expiresAt,
109 Status: status,
110 ExpiredBodySize: expectedFileSize,
111 IsWriting: true,
112 })
113
114 this.modifiedHashMap[hash] = zero.Zero{}
115
116 return nil
117}
118
119func (this *MetaFile) WriteHeaderBlockUnsafe(hash string, bOffsetFrom int64, bOffsetTo int64) error {
120 lazyHeader, ok := this.headerMap[hash]

Callers 4

TestNewFileWriterFunction · 0.45
TestFS_OpenFileWriterFunction · 0.45
TestMetaFile_WriteMetaFunction · 0.45

Calls 3

NewLazyFileHeaderFunction · 0.85
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 4

TestNewFileWriterFunction · 0.36
TestFS_OpenFileWriterFunction · 0.36
TestMetaFile_WriteMetaFunction · 0.36