diff options
| author | 2026-03-07 19:06:11 +0800 | |
|---|---|---|
| committer | 2026-03-07 19:06:45 +0800 | |
| commit | 3d71db8702f58182f1f7eda3446a2c474443c7f2 (patch) | |
| tree | 7d89b915f93a54fe2034b87aa57a280aaeabcecd /refstore/batch.go | |
| parent | refstore/files: Accept timeout instead of reading from config (diff) | |
| signature | No signature | |
refstore: Add non-transactional store and rw store
Diffstat (limited to 'refstore/batch.go')
| -rw-r--r-- | refstore/batch.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/refstore/batch.go b/refstore/batch.go new file mode 100644 index 00000000..05e0f1cb --- /dev/null +++ b/refstore/batch.go @@ -0,0 +1,38 @@ +package refstore + +import "codeberg.org/lindenii/furgit/objectid" + +// Batch applies reference operations immediately, one operation at a time. +// +// Unlike Transaction, Batch does not stage changes for one atomic commit. +// Each method attempts its update immediately and returns that operation's +// error, if any. +type Batch interface { + // Create creates one detached reference, requiring that the logical + // reference does not already exist. + Create(name string, newID objectid.ObjectID) error + // Update updates one detached reference, requiring that the current logical + // reference value matches oldID. + Update(name string, newID, oldID objectid.ObjectID) error + // Delete deletes one detached reference, requiring that the current logical + // reference value matches oldID. + Delete(name string, oldID objectid.ObjectID) error + // Verify verifies that the current logical reference value matches oldID. + Verify(name string, oldID objectid.ObjectID) error + + // CreateSymbolic creates one symbolic reference, requiring that the named + // reference does not already exist. + CreateSymbolic(name, newTarget string) error + // UpdateSymbolic updates one symbolic reference directly, requiring that its + // current target matches oldTarget. + UpdateSymbolic(name, newTarget, oldTarget string) error + // DeleteSymbolic deletes one symbolic reference directly, requiring that its + // current target matches oldTarget. + DeleteSymbolic(name, oldTarget string) error + // VerifySymbolic verifies that the named symbolic reference currently points + // at oldTarget. + VerifySymbolic(name, oldTarget string) error + + // Close releases any resources associated with the batch. + Close() error +} |
