(ctx context.Context, w backend.Writer, meta *backend.BlockMeta, bloom *common.ShardedBloomFilter, index *index)
| 72 | } |
| 73 | |
| 74 | func writeBlockMeta(ctx context.Context, w backend.Writer, meta *backend.BlockMeta, bloom *common.ShardedBloomFilter, index *index) error { |
| 75 | // bloom |
| 76 | blooms, err := bloom.Marshal() |
| 77 | if err != nil { |
| 78 | return err |
| 79 | } |
| 80 | |
| 81 | cacheInfo := &backend.CacheInfo{ |
| 82 | Meta: meta, |
| 83 | Role: cache.RoleBloom, |
| 84 | } |
| 85 | for i, bloom := range blooms { |
| 86 | nameBloom := common.BloomName(i) |
| 87 | err := w.Write(ctx, nameBloom, (uuid.UUID)(meta.BlockID), meta.TenantID, bloom, cacheInfo) |
| 88 | if err != nil { |
| 89 | return fmt.Errorf("unexpected error writing bloom-%d: %w", i, err) |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // Index |
| 94 | i, err := index.Marshal() |
| 95 | if err != nil { |
| 96 | return err |
| 97 | } |
| 98 | err = w.Write(ctx, common.NameIndex, (uuid.UUID)(meta.BlockID), meta.TenantID, i, &backend.CacheInfo{ |
| 99 | Meta: meta, |
| 100 | Role: cache.RoleTraceIDIdx, |
| 101 | }) |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | |
| 106 | // meta |
| 107 | err = w.WriteBlockMeta(ctx, meta) |
| 108 | if err != nil { |
| 109 | return fmt.Errorf("unexpected error writing meta: %w", err) |
| 110 | } |
| 111 | |
| 112 | return nil |
| 113 | } |
no test coverage detected