aboutsummaryrefslogtreecommitdiffstats
path: root/repository/repo.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-12-08 15:17:22 +0100
committerGitHub <noreply@github.com>2020-12-08 15:17:22 +0100
commitbf476f98d1656850e2f3fd349adea504007a8313 (patch)
tree595f3875590c89fe1c5a30e2e732f8aee9b35361 /repository/repo.go
parent54d123c6753d053df8400beea316e13690c851f4 (diff)
parent8128bb79b0db9023a98c356e4e173d846057c577 (diff)
downloadgit-bug-bf476f98d1656850e2f3fd349adea504007a8313.tar.gz
Merge pull request #510 from MichaelMure/repo-rework
Repo rework
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
}