Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyExists = errors.New("already exists")
ErrAlreadyExists returns the content exists.
TODO(weifu): move it into common pkg.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader interface { io.ReaderAt io.ReadCloser Size() int64 }
Reader extends io.ReadCloser interface with io.ReaderAt and reporting of Size.
type Store ¶
Store is a filesystem-like key/value storage.
Each key/value has committed and ingesting status. When OpenWriter returns ingestion transcation, the Store opens rootDir/ingest/$random file to receive value data. Once all the data is written, the Commit(ref) moves the file into rootDir/data/ref.
func (*Store) OpenReader ¶
OpenReader is to open committed content named by ref.
func (*Store) OpenWriter ¶
OpenWriter is to initiate a writing operation, ingestion transcation. A single ingestion transcation is to open temporary file and allow caller to write data into the temporary file. Once all the data is written, the caller should call Commit to complete ingestion transcation.
type Writer ¶
type Writer interface { // Close closes the writer. // // If the writer has not been committed, this allows aborting. // Calling Close on a closed writer will not error. io.WriteCloser // Commit commits data as file named by ref. // // Commit always close Writer. If ref already exists, it will return // error. Commit(ref string) error }
Writer handles writing of content into local store