aboutsummaryrefslogtreecommitdiffstats
path: root/repository/repo.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/repo.go')
-rw-r--r--repository/repo.go36
1 files changed, 33 insertions, 3 deletions
diff --git a/repository/repo.go b/repository/repo.go
index 4b45a1c5..eb9296d4 100644
--- a/repository/repo.go
+++ b/repository/repo.go
@@ -4,6 +4,9 @@ package repository
import (
"errors"
+ "github.com/blevesearch/bleve"
+ "github.com/go-git/go-billy/v5"
+
"github.com/MichaelMure/git-bug/util/lamport"
)
@@ -20,6 +23,15 @@ type Repo interface {
RepoKeyring
RepoCommon
RepoData
+ RepoStorage
+ RepoBleve
+
+ Close() error
+}
+
+type RepoCommonStorage interface {
+ RepoCommon
+ RepoStorage
}
// ClockedRepo is a Repo that also has Lamport clocks
@@ -48,9 +60,6 @@ type RepoKeyring interface {
// RepoCommon represent the common function the we want all the repo to implement
type RepoCommon interface {
- // GetPath returns the path to the repo.
- GetPath() string
-
// GetUserName returns the name the the user has used to configure git
GetUserName() (string, error)
@@ -64,6 +73,21 @@ type RepoCommon interface {
GetRemotes() (map[string]string, error)
}
+// RepoStorage give access to the filesystem
+type RepoStorage interface {
+ // LocalStorage return a billy.Filesystem giving access to $RepoPath/.git/git-bug
+ LocalStorage() billy.Filesystem
+}
+
+// RepoBleve give access to Bleve to implement full-text search indexes.
+type RepoBleve interface {
+ // GetBleveIndex return a bleve.Index that can be used to index documents
+ GetBleveIndex(name string) (bleve.Index, error)
+
+ // ClearBleveIndex will wipe the given index
+ ClearBleveIndex(name string) error
+}
+
// RepoData give access to the git data storage
type RepoData interface {
// FetchRefs fetch git refs from a remote
@@ -145,4 +169,10 @@ type TestedRepo interface {
type repoTest interface {
// AddRemote add a new remote to the repository
AddRemote(name string, url string) error
+
+ // GetLocalRemote return the URL to use to add this repo as a local remote
+ GetLocalRemote() string
+
+ // EraseFromDisk delete this repository entirely from the disk
+ EraseFromDisk() error
}