2017-05-15 21:51:35 +00:00
|
|
|
package odb
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
2017-05-16 21:29:03 +00:00
|
|
|
// storer implements a storage engine for reading, writing, and creating
|
2017-05-15 21:51:35 +00:00
|
|
|
// io.ReadWriters that can store information about loose objects
|
2017-05-16 21:29:03 +00:00
|
|
|
type storer interface {
|
2017-05-15 21:51:35 +00:00
|
|
|
// 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)
|
|
|
|
|
2017-05-16 21:02:37 +00:00
|
|
|
// Store copies the data given in "r" to the unique object path given by
|
|
|
|
// "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).
|
|
|
|
Store(sha []byte, r io.Reader) (n int64, err error)
|
2017-05-15 21:51:35 +00:00
|
|
|
}
|