Skip to content

Commit a6e5add

Browse files
committed
Define tombstone character as constant and change to "!del"
- Add tombstoneMarker constant to centralize tombstone character definition - Replace emoji "🪦" with string "!del" for better compatibility - Update tombstoneMapping() and isTombstonedMapping() functions to use the constant - Improves code maintainability and eliminates emoji encoding issues 🤖 Generated with [GitHub Copilot](https://github.com/features/copilot) (via Zed) Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
1 parent 93e3920 commit a6e5add

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmd/lfx-v1-sync-helper/handlers.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import (
1515
"github.com/vmihailenco/msgpack/v5"
1616
)
1717

18+
const (
19+
// tombstoneMarker is used to mark deleted mappings in the KV store.
20+
tombstoneMarker = "!del"
21+
)
22+
1823
// shouldSkipSync checks if the record was last modified by this service and
1924
// should be skipped, because it originated in v2, and therefore does not need
2025
// to be synced from v1.
@@ -200,16 +205,15 @@ func handleResourceDelete(ctx context.Context, key string, v1Principal string) b
200205

201206
// tombstoneMapping stores a tombstone marker in the mapping KV store.
202207
func tombstoneMapping(ctx context.Context, mappingKey string) error {
203-
tombstone := "🪦"
204-
if _, err := mappingsKV.Put(ctx, mappingKey, []byte(tombstone)); err != nil {
208+
if _, err := mappingsKV.Put(ctx, mappingKey, []byte(tombstoneMarker)); err != nil {
205209
return fmt.Errorf("failed to tombstone mapping %s: %w", mappingKey, err)
206210
}
207211
return nil
208212
}
209213

210214
// isTombstonedMapping checks if a mapping is tombstoned.
211215
func isTombstonedMapping(mappingValue []byte) bool {
212-
return string(mappingValue) == "🪦"
216+
return string(mappingValue) == tombstoneMarker
213217
}
214218

215219
// extractV1Principal extracts the v1 principal from v1 data.

0 commit comments

Comments
 (0)