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

Function createWALBlock

tempodb/encoding/vparquet3/wal_block.go:152–184  ·  view source on GitHub ↗

createWALBlock creates a new appendable block

(meta *backend.BlockMeta, filepath, dataEncoding string, ingestionSlack time.Duration)

Source from the content-addressed store, hash-verified

150
151// createWALBlock creates a new appendable block
152func createWALBlock(meta *backend.BlockMeta, filepath, dataEncoding string, ingestionSlack time.Duration) (*walBlock, error) {
153 newMeta := &backend.BlockMeta{
154 Version: VersionString,
155 BlockID: meta.BlockID,
156 TenantID: meta.TenantID,
157 ReplicationFactor: meta.ReplicationFactor,
158 // remove ignored attributes from dedicated columns
159 DedicatedColumns: filterDedicatedColumns(meta.DedicatedColumns),
160 }
161
162 b := &walBlock{
163 meta: newMeta,
164 path: filepath,
165 ids: common.NewIDMap[int64](0),
166 ingestionSlack: ingestionSlack,
167 }
168
169 // build folder
170 err := os.MkdirAll(b.walPath(), 0o700)
171 if err != nil {
172 return nil, err
173 }
174
175 dec, err := model.NewObjectDecoder(dataEncoding)
176 if err != nil {
177 return nil, err
178 }
179 b.decoder = dec
180
181 err = b.openWriter()
182
183 return b, err
184}
185
186func ownsWALBlock(entry fs.DirEntry) bool {
187 // all vParquet wal blocks are folders

Callers 7

CreateWALBlockMethod · 0.70
TestPartialReplayFunction · 0.70
TestWalBlockMetaSnapshotFunction · 0.70
TestWalBlockTombstoneFunction · 0.70
testWalBlockFunction · 0.70

Calls 4

walPathMethod · 0.95
openWriterMethod · 0.95
NewObjectDecoderFunction · 0.92
filterDedicatedColumnsFunction · 0.70

Tested by 6

TestPartialReplayFunction · 0.56
TestWalBlockMetaSnapshotFunction · 0.56
TestWalBlockTombstoneFunction · 0.56
testWalBlockFunction · 0.56