(fileHash string, bodySize int64, isPartial bool)
| 143 | } |
| 144 | |
| 145 | func (this *BlocksFile) OpenFileWriter(fileHash string, bodySize int64, isPartial bool) (writer *FileWriter, err error) { |
| 146 | err = CheckHashErr(fileHash) |
| 147 | if err != nil { |
| 148 | return nil, err |
| 149 | } |
| 150 | |
| 151 | this.mu.Lock() |
| 152 | defer this.mu.Unlock() |
| 153 | |
| 154 | _, isWriting := this.writingFileMap[fileHash] |
| 155 | if isWriting { |
| 156 | err = ErrFileIsWriting |
| 157 | return |
| 158 | } |
| 159 | this.writingFileMap[fileHash] = zero.Zero{} |
| 160 | |
| 161 | err = this.checkStatus() |
| 162 | if err != nil { |
| 163 | return |
| 164 | } |
| 165 | |
| 166 | return NewFileWriter(this, fileHash, bodySize, isPartial) |
| 167 | } |
| 168 | |
| 169 | func (this *BlocksFile) OpenFileReader(fileHash string, isPartial bool) (*FileReader, error) { |
| 170 | err := CheckHashErr(fileHash) |
nothing calls this directly
no test coverage detected