2014-11-18 01:29:42 +01:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2014-11-19 23:39:32 +01:00
|
|
|
|
2015-02-12 01:49:49 +01:00
|
|
|
"github.com/docker/distribution"
|
2014-12-24 01:01:38 +01:00
|
|
|
"github.com/docker/distribution/digest"
|
2014-11-18 01:29:42 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// layerReadSeeker implements Layer and provides facilities for reading and
|
|
|
|
// seeking.
|
|
|
|
type layerReader struct {
|
2014-11-21 02:49:35 +01:00
|
|
|
fileReader
|
2014-11-18 01:29:42 +01:00
|
|
|
|
2014-12-05 05:55:59 +01:00
|
|
|
digest digest.Digest
|
2014-11-18 01:29:42 +01:00
|
|
|
}
|
|
|
|
|
2015-02-12 01:49:49 +01:00
|
|
|
var _ distribution.Layer = &layerReader{}
|
2014-11-18 01:29:42 +01:00
|
|
|
|
2014-11-19 23:39:32 +01:00
|
|
|
func (lrs *layerReader) Digest() digest.Digest {
|
|
|
|
return lrs.digest
|
2014-11-18 01:29:42 +01:00
|
|
|
}
|
|
|
|
|
2015-03-05 05:57:14 +01:00
|
|
|
func (lrs *layerReader) Length() int64 {
|
|
|
|
return lrs.size
|
|
|
|
}
|
|
|
|
|
2014-11-18 01:29:42 +01:00
|
|
|
func (lrs *layerReader) CreatedAt() time.Time {
|
2014-12-05 05:55:59 +01:00
|
|
|
return lrs.modtime
|
2014-11-18 01:29:42 +01:00
|
|
|
}
|
2015-02-12 01:49:49 +01:00
|
|
|
|
|
|
|
// Close the layer. Should be called when the resource is no longer needed.
|
|
|
|
func (lrs *layerReader) Close() error {
|
|
|
|
return lrs.closeWithErr(distribution.ErrLayerClosed)
|
|
|
|
}
|