(hash string)
| 210 | } |
| 211 | |
| 212 | func (this *MetaFile) RemoveFile(hash string) error { |
| 213 | this.mu.Lock() |
| 214 | defer this.mu.Unlock() |
| 215 | |
| 216 | _, ok := this.headerMap[hash] |
| 217 | if ok { |
| 218 | delete(this.headerMap, hash) |
| 219 | } |
| 220 | |
| 221 | if ok { |
| 222 | blockBytes, err := EncodeMetaBlock(MetaActionRemove, hash, nil) |
| 223 | if err != nil { |
| 224 | return err |
| 225 | } |
| 226 | |
| 227 | AckWriteThread() |
| 228 | _, err = this.fp.Write(blockBytes) |
| 229 | ReleaseWriteThread() |
| 230 | if err != nil { |
| 231 | return err |
| 232 | } |
| 233 | this.isModified = true |
| 234 | } |
| 235 | |
| 236 | return nil |
| 237 | } |
| 238 | |
| 239 | func (this *MetaFile) FileHeader(hash string) (header *FileHeader, ok bool) { |
| 240 | this.mu.RLock() |
nothing calls this directly
no test coverage detected