celestiaorg / celestiaorg/go-header

store: use Txn instead of Batch

Open
#307 2 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Go
Stars
21
Forks
33
Avg merge
5d 20h
Merged PRs (30d)
7

Description

Methods like `DeleteTo` do multiple deletions underneath that have to be done atomically. This is currently done via Batching, however, Batches [do not guarantee](https://github.com/ipfs/go-datastore/blob/bee84ceeb277b14249d1ac4297860fa7e52556f4/datastore.go#L97-L103) atomicity while transactions do.

Basically, the issue is to identify other places like above where the transaction should be used instead and make it so

Contributor guide

Open the contributing guide

Research direction

Start by locating DeleteTo and other datastore operations that perform multiple deletions or writes through Batching. Compare those call sites with the datastore transaction API, then verify that every operation requiring atomicity uses Txn rather than Batch and preserves its existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.