| 99 | } |
| 100 | |
| 101 | func (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 | |
| 119 | func (this *MetaFile) WriteHeaderBlockUnsafe(hash string, bOffsetFrom int64, bOffsetTo int64) error { |
| 120 | lazyHeader, ok := this.headerMap[hash] |