Open opens the file for read. Call Close() on the returned io.ReadCloser
(ctx context.Context, options ...fs.OpenOption)
| 186 | |
| 187 | // Open opens the file for read. Call Close() on the returned io.ReadCloser |
| 188 | func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error) { |
| 189 | // Need some sort of locking to prevent multiple downloads |
| 190 | o.writebackMu.Lock() |
| 191 | defer o.writebackMu.Unlock() |
| 192 | |
| 193 | // FIXME what if correct object is already in o.co |
| 194 | |
| 195 | newObj, err := o.Object.Writeback(ctx) |
| 196 | if err != nil { |
| 197 | return nil, err |
| 198 | } |
| 199 | if newObj != nil { |
| 200 | o.Object = newObj |
| 201 | o.co = append(o.co, newObj) // FIXME should this append or overwrite or update? |
| 202 | } |
| 203 | return o.Object.Object.Open(ctx, options...) |
| 204 | } |
| 205 | |
| 206 | // ModTime returns the modification date of the directory |
| 207 | // It returns the latest ModTime of all candidates |