git/odb: introduce odb.Storer interface

This commit is contained in:
Taylor Blau 2017-05-15 15:51:35 -06:00
parent 4ab0286874
commit c86d50a47c

16
git/odb/storer.go Normal file

@ -0,0 +1,16 @@
package odb
import "io"
// Storer implements a storage engine for reading, writing, and creating
// io.ReadWriters that can store information about loose objects
type Storer interface {
// Open returns a handle on an existing object keyed by the given SHA.
// It returns an error if that file does not already exist.
Open(sha []byte) (f io.ReadWriteCloser, err error)
// Create returns a handle on a new object keyed by the given SHA. It
// returns an error if that file already exists (acting as if the
// `os.O_EXCL` mode is given in a bitmask to os.Open.
Create(sha []byte) (f io.ReadWriteCloser, err error)
}