diff options
-rw-r--r-- | plumbing/format/packfile/fsobject.go (renamed from plumbing/format/packfile/disk_object.go) | 26 | ||||
-rw-r--r-- | plumbing/format/packfile/packfile.go | 4 |
2 files changed, 15 insertions, 15 deletions
diff --git a/plumbing/format/packfile/disk_object.go b/plumbing/format/packfile/fsobject.go index d3e8520..d63127e 100644 --- a/plumbing/format/packfile/disk_object.go +++ b/plumbing/format/packfile/fsobject.go @@ -6,8 +6,8 @@ import ( "gopkg.in/src-d/go-git.v4/plumbing" ) -// DiskObject is an object from the packfile on disk. -type DiskObject struct { +// FSObject is an object from the packfile on the filesystem. +type FSObject struct { hash plumbing.Hash h *ObjectHeader offset int64 @@ -16,15 +16,15 @@ type DiskObject struct { packfile *Packfile } -// NewDiskObject creates a new disk object. -func NewDiskObject( +// NewFSObject creates a new filesystem object. +func NewFSObject( hash plumbing.Hash, finalType plumbing.ObjectType, offset int64, contentSize int64, packfile *Packfile, -) *DiskObject { - return &DiskObject{ +) *FSObject { + return &FSObject{ hash: hash, offset: offset, size: contentSize, @@ -34,31 +34,31 @@ func NewDiskObject( } // Reader implements the plumbing.EncodedObject interface. -func (o *DiskObject) Reader() (io.ReadCloser, error) { +func (o *FSObject) Reader() (io.ReadCloser, error) { return o.packfile.getObjectContent(o.offset) } // SetSize implements the plumbing.EncodedObject interface. This method // is a noop. -func (o *DiskObject) SetSize(int64) {} +func (o *FSObject) SetSize(int64) {} // SetType implements the plumbing.EncodedObject interface. This method is // a noop. -func (o *DiskObject) SetType(plumbing.ObjectType) {} +func (o *FSObject) SetType(plumbing.ObjectType) {} // Hash implements the plumbing.EncodedObject interface. -func (o *DiskObject) Hash() plumbing.Hash { return o.hash } +func (o *FSObject) Hash() plumbing.Hash { return o.hash } // Size implements the plumbing.EncodedObject interface. -func (o *DiskObject) Size() int64 { return o.size } +func (o *FSObject) Size() int64 { return o.size } // Type implements the plumbing.EncodedObject interface. -func (o *DiskObject) Type() plumbing.ObjectType { +func (o *FSObject) Type() plumbing.ObjectType { return o.typ } // Writer implements the plumbing.EncodedObject interface. This method always // returns a nil writer. -func (o *DiskObject) Writer() (io.WriteCloser, error) { +func (o *FSObject) Writer() (io.WriteCloser, error) { return nil, nil } diff --git a/plumbing/format/packfile/packfile.go b/plumbing/format/packfile/packfile.go index 37743ba..df8a3d4 100644 --- a/plumbing/format/packfile/packfile.go +++ b/plumbing/format/packfile/packfile.go @@ -232,7 +232,7 @@ func (p *Packfile) nextObject() (plumbing.EncodedObject, error) { p.offsetToType[h.Offset] = typ - return NewDiskObject(hash, typ, h.Offset, size, p), nil + return NewFSObject(hash, typ, h.Offset, size, p), nil } func (p *Packfile) getObjectContent(offset int64) (io.ReadCloser, error) { @@ -410,7 +410,7 @@ func (p *Packfile) Close() error { return closer.Close() } -// MemoryObjectFromDisk converts a DiskObject to a MemoryObject. +// MemoryObjectFromDisk converts a FSObject to a MemoryObject. func MemoryObjectFromDisk(obj plumbing.EncodedObject) (plumbing.EncodedObject, error) { o2 := new(plumbing.MemoryObject) o2.SetType(obj.Type()) |