diff options
Diffstat (limited to 'ref')
| -rw-r--r-- | ref/store/files/batch.go | 1 | ||||
| -rw-r--r-- | ref/store/files/batch_abort.go | 1 | ||||
| -rw-r--r-- | ref/store/files/batch_apply.go | 1 | ||||
| -rw-r--r-- | ref/store/files/batch_queue_ops.go | 8 | ||||
| -rw-r--r-- | ref/store/files/close.go | 5 | ||||
| -rw-r--r-- | ref/store/files/new.go | 2 | ||||
| -rw-r--r-- | ref/store/files/store.go | 3 | ||||
| -rw-r--r-- | ref/store/files/transaction.go | 1 | ||||
| -rw-r--r-- | ref/store/files/transaction_abort.go | 1 | ||||
| -rw-r--r-- | ref/store/files/transaction_commit.go | 1 | ||||
| -rw-r--r-- | ref/store/files/transaction_queue_ops.go | 8 |
11 files changed, 25 insertions, 7 deletions
diff --git a/ref/store/files/batch.go b/ref/store/files/batch.go index 1d396bd5..d8037bbb 100644 --- a/ref/store/files/batch.go +++ b/ref/store/files/batch.go @@ -2,6 +2,7 @@ package files import refstore "codeberg.org/lindenii/furgit/ref/store" +// Batch stages files-store updates for one non-atomic apply. type Batch struct { store *Store ops []queuedUpdate diff --git a/ref/store/files/batch_abort.go b/ref/store/files/batch_abort.go index 0cbd1651..c229ca06 100644 --- a/ref/store/files/batch_abort.go +++ b/ref/store/files/batch_abort.go @@ -1,5 +1,6 @@ package files +// Abort abandons the queued updates. func (batch *Batch) Abort() error { return nil } diff --git a/ref/store/files/batch_apply.go b/ref/store/files/batch_apply.go index 138026a3..b4be9079 100644 --- a/ref/store/files/batch_apply.go +++ b/ref/store/files/batch_apply.go @@ -2,6 +2,7 @@ package files import refstore "codeberg.org/lindenii/furgit/ref/store" +// Apply validates and applies the queued updates. func (batch *Batch) Apply() ([]refstore.BatchResult, error) { results := make([]refstore.BatchResult, len(batch.ops)) remainingIdx := make([]int, 0, len(batch.ops)) diff --git a/ref/store/files/batch_queue_ops.go b/ref/store/files/batch_queue_ops.go index 7434b0c3..a99b3c89 100644 --- a/ref/store/files/batch_queue_ops.go +++ b/ref/store/files/batch_queue_ops.go @@ -2,34 +2,42 @@ package files import objectid "codeberg.org/lindenii/furgit/object/id" +// Create queues a detached reference creation. func (batch *Batch) Create(name string, newID objectid.ObjectID) { batch.queue(queuedUpdate{name: name, kind: updateCreate, newID: newID}) } +// Update queues a detached reference update. func (batch *Batch) Update(name string, newID, oldID objectid.ObjectID) { batch.queue(queuedUpdate{name: name, kind: updateReplace, newID: newID, oldID: oldID}) } +// Delete queues a detached reference deletion. func (batch *Batch) Delete(name string, oldID objectid.ObjectID) { batch.queue(queuedUpdate{name: name, kind: updateDelete, oldID: oldID}) } +// Verify queues a detached reference verification. func (batch *Batch) Verify(name string, oldID objectid.ObjectID) { batch.queue(queuedUpdate{name: name, kind: updateVerify, oldID: oldID}) } +// CreateSymbolic queues a symbolic reference creation. func (batch *Batch) CreateSymbolic(name, newTarget string) { batch.queue(queuedUpdate{name: name, kind: updateCreateSymbolic, newTarget: newTarget}) } +// UpdateSymbolic queues a symbolic reference update. func (batch *Batch) UpdateSymbolic(name, newTarget, oldTarget string) { batch.queue(queuedUpdate{name: name, kind: updateReplaceSymbolic, newTarget: newTarget, oldTarget: oldTarget}) } +// DeleteSymbolic queues a symbolic reference deletion. func (batch *Batch) DeleteSymbolic(name, oldTarget string) { batch.queue(queuedUpdate{name: name, kind: updateDeleteSymbolic, oldTarget: oldTarget}) } +// VerifySymbolic queues a symbolic reference verification. func (batch *Batch) VerifySymbolic(name, oldTarget string) { batch.queue(queuedUpdate{name: name, kind: updateVerifySymbolic, oldTarget: oldTarget}) } diff --git a/ref/store/files/close.go b/ref/store/files/close.go index 58f400a5..0e5212d0 100644 --- a/ref/store/files/close.go +++ b/ref/store/files/close.go @@ -1,11 +1,6 @@ package files // Close releases resources associated with the store. -// -// Store borrows gitRoot, so Close does not close it. -// Transactions and batches borrowing the store are invalid after Close. -// -// Repeated calls to Close are undefined behavior. func (store *Store) Close() error { return store.commonRoot.Close() } diff --git a/ref/store/files/new.go b/ref/store/files/new.go index bca3a491..3c754968 100644 --- a/ref/store/files/new.go +++ b/ref/store/files/new.go @@ -9,6 +9,8 @@ import ( ) // New creates one files ref store rooted at one repository gitdir. +// +// Labels: Deps-Borrowed. func New(root *os.Root, algo objectid.Algorithm, packedRefsTimeout time.Duration) (*Store, error) { if algo.Size() == 0 { return nil, objectid.ErrInvalidAlgorithm diff --git a/ref/store/files/store.go b/ref/store/files/store.go index 7c3f07af..9e548af5 100644 --- a/ref/store/files/store.go +++ b/ref/store/files/store.go @@ -14,8 +14,7 @@ import ( // Store reads and writes one Git files ref namespace rooted at one repository // gitdir plus its commondir. // -// Store borrows gitRoot and owns commonRoot. Close releases only resources -// opened by the store itself. +// Labels: Close-Caller. type Store struct { gitRoot *os.Root commonRoot *os.Root diff --git a/ref/store/files/transaction.go b/ref/store/files/transaction.go index ede2d483..fec43e1d 100644 --- a/ref/store/files/transaction.go +++ b/ref/store/files/transaction.go @@ -4,6 +4,7 @@ import ( refstore "codeberg.org/lindenii/furgit/ref/store" ) +// Transaction stages files-store updates for one atomic commit. type Transaction struct { store *Store ops []queuedUpdate diff --git a/ref/store/files/transaction_abort.go b/ref/store/files/transaction_abort.go index cb82e4bf..4f8fed05 100644 --- a/ref/store/files/transaction_abort.go +++ b/ref/store/files/transaction_abort.go @@ -1,3 +1,4 @@ package files +// Abort abandons the queued updates. func (tx *Transaction) Abort() error { return nil } diff --git a/ref/store/files/transaction_commit.go b/ref/store/files/transaction_commit.go index 76bcb195..aeea497e 100644 --- a/ref/store/files/transaction_commit.go +++ b/ref/store/files/transaction_commit.go @@ -1,5 +1,6 @@ package files +// Commit validates and applies the queued updates atomically. func (tx *Transaction) Commit() error { executor := &refUpdateExecutor{store: tx.store} diff --git a/ref/store/files/transaction_queue_ops.go b/ref/store/files/transaction_queue_ops.go index 047518c4..63f48254 100644 --- a/ref/store/files/transaction_queue_ops.go +++ b/ref/store/files/transaction_queue_ops.go @@ -2,34 +2,42 @@ package files import objectid "codeberg.org/lindenii/furgit/object/id" +// Create queues a detached reference creation. func (tx *Transaction) Create(name string, newID objectid.ObjectID) error { return tx.queue(queuedUpdate{name: name, kind: updateCreate, newID: newID}) } +// Update queues a detached reference update. func (tx *Transaction) Update(name string, newID, oldID objectid.ObjectID) error { return tx.queue(queuedUpdate{name: name, kind: updateReplace, newID: newID, oldID: oldID}) } +// Delete queues a detached reference deletion. func (tx *Transaction) Delete(name string, oldID objectid.ObjectID) error { return tx.queue(queuedUpdate{name: name, kind: updateDelete, oldID: oldID}) } +// Verify queues a detached reference verification. func (tx *Transaction) Verify(name string, oldID objectid.ObjectID) error { return tx.queue(queuedUpdate{name: name, kind: updateVerify, oldID: oldID}) } +// CreateSymbolic queues a symbolic reference creation. func (tx *Transaction) CreateSymbolic(name, newTarget string) error { return tx.queue(queuedUpdate{name: name, kind: updateCreateSymbolic, newTarget: newTarget}) } +// UpdateSymbolic queues a symbolic reference update. func (tx *Transaction) UpdateSymbolic(name, newTarget, oldTarget string) error { return tx.queue(queuedUpdate{name: name, kind: updateReplaceSymbolic, newTarget: newTarget, oldTarget: oldTarget}) } +// DeleteSymbolic queues a symbolic reference deletion. func (tx *Transaction) DeleteSymbolic(name, oldTarget string) error { return tx.queue(queuedUpdate{name: name, kind: updateDeleteSymbolic, oldTarget: oldTarget}) } +// VerifySymbolic queues a symbolic reference verification. func (tx *Transaction) VerifySymbolic(name, oldTarget string) error { return tx.queue(queuedUpdate{name: name, kind: updateVerifySymbolic, oldTarget: oldTarget}) } |
