MCPcopy Create free account
hub / github.com/libgit2/git2go / NewWriteStream

Method NewWriteStream

odb.go:300–314  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

298// create a new object in the database. The size and type must be
299// known in advance
300func (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

Callers 2

TestOdbStreamFunction · 0.80
TestOdbBackendLooseFunction · 0.80

Calls 1

MakeGitErrorFunction · 0.85

Tested by 2

TestOdbStreamFunction · 0.64
TestOdbBackendLooseFunction · 0.64