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

Method Write

tempodb/backend/cache/cache.go:139–152  ·  tempodb/backend/cache/cache.go::readerWriter.Write

Write implements backend.Writer

(ctx context.Context, name string, keypath backend.KeyPath, data io.Reader, size int64, cacheInfo *backend.CacheInfo)

Source from the content-addressed store, hash-verified

137
138// Write implements backend.Writer
139func (r *readerWriter) Write(ctx context.Context, name string, keypath backend.KeyPath, data io.Reader, size int64, cacheInfo *backend.CacheInfo) error {
140 b, err := tempo_io.ReadAllWithEstimate(data, size)
141 if err != nil {
142 return err
143 }
144
145 if cache := r.cacheFor(cacheInfo); cache != nil {
146 cache.Store(ctx, []string{key(keypath, name)}, [][]byte{b})
147 }
148
149 // previous implemenation always passed false forward for "shouldCache" so we are matching that behavior by passing nil for cacheInfo
150 // todo: reevaluate. should we pass the cacheInfo forward?
151 return r.nextWriter.Write(ctx, name, keypath, bytes.NewReader(b), int64(len(b)), nil)
152}
153
154// Append implements backend.Writer
155func (r *readerWriter) Append(ctx context.Context, name string, keypath backend.KeyPath, tracker backend.AppendTracker, buffer []byte) (backend.AppendTracker, error) {

Callers

nothing calls this directly

Calls 4

cacheForMethod · 0.95
keyFunction · 0.85
StoreMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected