2015-02-11 01:41:09 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2015-02-12 00:49:49 +00:00
|
|
|
"github.com/docker/distribution"
|
2015-02-11 01:41:09 +00:00
|
|
|
"github.com/docker/distribution/digest"
|
|
|
|
)
|
|
|
|
|
|
|
|
// layerReadSeeker implements Layer and provides facilities for reading and
|
|
|
|
// seeking.
|
|
|
|
type layerReader struct {
|
|
|
|
fileReader
|
|
|
|
|
|
|
|
name string // repo name of this layer
|
|
|
|
digest digest.Digest
|
|
|
|
}
|
|
|
|
|
2015-02-12 00:49:49 +00:00
|
|
|
var _ distribution.Layer = &layerReader{}
|
2015-02-11 01:41:09 +00:00
|
|
|
|
|
|
|
func (lrs *layerReader) Name() string {
|
|
|
|
return lrs.name
|
|
|
|
}
|
|
|
|
|
|
|
|
func (lrs *layerReader) Digest() digest.Digest {
|
|
|
|
return lrs.digest
|
|
|
|
}
|
|
|
|
|
|
|
|
func (lrs *layerReader) CreatedAt() time.Time {
|
|
|
|
return lrs.modtime
|
|
|
|
}
|
2015-02-12 00:49:49 +00:00
|
|
|
|
|
|
|
// Close the layer. Should be called when the resource is no longer needed.
|
|
|
|
func (lrs *layerReader) Close() error {
|
|
|
|
return lrs.closeWithErr(distribution.ErrLayerClosed)
|
|
|
|
}
|