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
(size int64, otype ObjectType)
| 298 | // create a new object in the database. The size and type must be |
| 299 | // known in advance |
| 300 | func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, error) { |
| 301 | stream := new(OdbWriteStream) |
| 302 | |
| 303 | runtime.LockOSThread() |
| 304 | defer runtime.UnlockOSThread() |
| 305 | |
| 306 | ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_object_size_t(size), C.git_object_t(otype)) |
| 307 | runtime.KeepAlive(v) |
| 308 | if ret < 0 { |
| 309 | return nil, MakeGitError(ret) |
| 310 | } |
| 311 | |
| 312 | runtime.SetFinalizer(stream, (*OdbWriteStream).Free) |
| 313 | return stream, nil |
| 314 | } |
| 315 | |
| 316 | // NewWritePack opens a stream for writing a pack file to the ODB. If the ODB |
| 317 | // layer understands pack files, then the given packfile will likely be |