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

Function GetDocStorageReadBucket

private/bufpkg/bufmodule/module_read_bucket.go:231–246  ·  view source on GitHub ↗

GetDocStorageReadBucket gets a storage.ReadBucket that just contains the documentation file(s). This is needed for i.e. using RootToExcludes in NewWorkspaceForBucket.

(ctx context.Context, bucket storage.ReadBucket)

Source from the content-addressed store, hash-verified

229//
230// This is needed for i.e. using RootToExcludes in NewWorkspaceForBucket.
231func GetDocStorageReadBucket(ctx context.Context, bucket storage.ReadBucket) (storage.ReadBucket, error) {
232 // Store the documentation file in a new memory bucket for performance reasons.
233 docFilePath := getDocFilePathForStorageReadBucket(ctx, bucket)
234 if docFilePath == "" {
235 return storage.MultiReadBucket(), nil // nop bucket
236 }
237 content, err := storage.ReadPath(ctx, bucket, docFilePath)
238 if err != nil {
239 return nil, err
240 }
241 return storagemem.NewReadBucket(
242 map[string][]byte{
243 docFilePath: content,
244 },
245 )
246}
247
248// GetLicenseStorageReadBucket gets a storage.ReadBucket that just contains the license file(s).
249//

Calls 4

MultiReadBucketFunction · 0.92
ReadPathFunction · 0.92
NewReadBucketFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…