34890c9195
Change-Id: I57b98b5e1406e7b38edf3bc65907d9796a1a663b
31 lines
615 B
Go
31 lines
615 B
Go
// Copyright (C) 2021 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package ulfs
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
"storj.io/storj/cmd/uplinkng/ulloc"
|
|
)
|
|
|
|
//
|
|
// read handles
|
|
//
|
|
|
|
// osMultiReadHandle implements MultiReadHandle for *os.Files.
|
|
func newOSMultiReadHandle(fh *os.File) (MultiReadHandle, error) {
|
|
fi, err := fh.Stat()
|
|
if err != nil {
|
|
return nil, errs.Wrap(err)
|
|
}
|
|
return NewGenericMultiReadHandle(fh, ObjectInfo{
|
|
Loc: ulloc.NewLocal(fh.Name()),
|
|
IsPrefix: false,
|
|
Created: fi.ModTime(), // TODO: os specific crtime
|
|
ContentLength: fi.Size(),
|
|
}), nil
|
|
}
|