aboutsummaryrefslogtreecommitdiff
path: root/repo.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2025-11-16 00:00:00 +0000
committerGravatar Runxi Yu2025-11-16 00:00:00 +0000
commit5c15542025c98f89d65331ff01b28daa389cf2a6 (patch)
tree18a4cf7eb79ef81d63b9c658dc42b21e69e1282e /repo.go
parentrepo is thread safe (diff)
signature
Fix some docs and API types
Diffstat (limited to 'repo.go')
-rw-r--r--repo.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/repo.go b/repo.go
index 05473252..0fdfa5dd 100644
--- a/repo.go
+++ b/repo.go
@@ -16,6 +16,9 @@ import (
//
// It is safe to access the same Repository from multiple goroutines
// without additional synchronization.
+//
+// Objects derived from a Repository must not be used after the Repository
+// has been closed.
type Repository struct {
rootPath string
hashSize int
@@ -82,6 +85,13 @@ func OpenRepository(path string) (*Repository, error) {
return &Repository{rootPath: path, hashSize: hashSize}, nil
}
+// Close closes the repository, releasing any resources associated with it.
+//
+// It is safe to call Close multiple times; subsequent calls will have no
+// effect.
+//
+// Close invalidates any objects derived from the Repository as it;
+// using them may cause segmentation faults or other undefined behavior.
func (repo *Repository) Close() error {
var closeErr error
repo.closeOnce.Do(func() {