MCPcopy
hub / github.com/grafana/tempo / getAttributes

Method getAttributes

tempodb/backend/azure/compactor.go:130–153  ·  view source on GitHub ↗

getAttributes returns information about the specified blob using its name.

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

128
129// getAttributes returns information about the specified blob using its name.
130func (rw *Azure) getAttributes(ctx context.Context, name string) (BlobAttributes, error) {
131 blobClient, err := getBlobClient(ctx, rw.cfg, name)
132 if err != nil {
133 return BlobAttributes{}, fmt.Errorf("cannot get Azure blob client, name: %s: %w", name, err)
134 }
135
136 props, err := blobClient.GetProperties(ctx, &blob.GetPropertiesOptions{})
137 if err != nil {
138 return BlobAttributes{}, err
139 }
140
141 if props.ContentLength == nil {
142 return BlobAttributes{}, fmt.Errorf("expected content length but got none for blob %s: %w", name, err)
143 }
144
145 if props.LastModified == nil {
146 return BlobAttributes{}, fmt.Errorf("expected last modified but got none for blob %s: %w", name, err)
147 }
148
149 return BlobAttributes{
150 Size: *props.ContentLength,
151 LastModified: *props.LastModified,
152 }, nil
153}

Callers 1

readAllWithModTimeMethod · 0.95

Calls 1

getBlobClientFunction · 0.85

Tested by

no test coverage detected