MCPcopy Create free account
hub / github.com/bufbuild/buf / PutPath

Function PutPath

private/pkg/storage/util.go:44–54  ·  view source on GitHub ↗

PutPath puts the data at the path.

(ctx context.Context, writeBucket WriteBucket, path string, data []byte, options ...PutOption)

Source from the content-addressed store, hash-verified

42
43// PutPath puts the data at the path.
44func PutPath(ctx context.Context, writeBucket WriteBucket, path string, data []byte, options ...PutOption) (retErr error) {
45 writeObjectCloser, err := writeBucket.Put(ctx, path, options...)
46 if err != nil {
47 return err
48 }
49 defer func() {
50 retErr = errors.Join(retErr, writeObjectCloser.Close())
51 }()
52 _, err = writeObjectCloser.Write(data)
53 return err
54}
55
56// ForReadObject gets a ReadObjectCloser at the given path, calls f on it, and then closes the ReadObjectCloser.
57func ForReadObject(ctx context.Context, readBucket ReadBucket, path string, f func(ReadObject) error) (retErr error) {

Callers 13

createZipFromDirFunction · 0.92
RunTestSuiteFunction · 0.92
WriteResponseMethod · 0.92
applyInsertionPointFunction · 0.92
writeZipMethod · 0.92
copySkipUnchangedMethod · 0.92
putCommitMethod · 0.92
putModuleDataMethod · 0.92
testModuleDataStoreFunction · 0.92
putPolicyDataMethod · 0.92

Calls 3

PutMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65

Tested by 4

createZipFromDirFunction · 0.74
testModuleDataStoreFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…