Example #1
0
func (odb *Odb) OpenWStream(size int, form ObjectType) (*OdbStream, error) {
	stream := new(OdbStream)
	ecode := C.git_odb_open_wstream(&stream.git_odb_stream, odb.git_odb, C.size_t(size), C.git_otype(form))
	if ecode != git_SUCCESS {
		return nil, gitError()
	}
	return stream, nil
}
Example #2
0
// NewWriteStream opens a write stream to the ODB, which allows you to
// create a new object in the database. The size and type must be
// known in advance
func (v *Odb) NewWriteStream(size int, otype ObjectType) (*OdbWriteStream, error) {
	stream := new(OdbWriteStream)
	ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.size_t(size), C.git_otype(otype))
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	runtime.SetFinalizer(stream, (*OdbWriteStream).Free)
	return stream, nil
}