From cedcc2772c88b78bc62594afd06c44c7a7c244e4 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 26 Sep 2020 14:06:01 +0200 Subject: repo: smaller interfaces --- repository/repo.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/repository/repo.go b/repository/repo.go index 3deb6f1b..6349007b 100644 --- a/repository/repo.go +++ b/repository/repo.go @@ -22,6 +22,12 @@ type Repo interface { RepoData } +// ClockedRepo is a Repo that also has Lamport clocks +type ClockedRepo interface { + Repo + RepoClock +} + // RepoConfig access the configuration of a repository type RepoConfig interface { // LocalConfig give access to the repository scoped configuration @@ -103,10 +109,8 @@ type RepoData interface { ListCommits(ref string) ([]Hash, error) } -// ClockedRepo is a Repo that also has Lamport clocks -type ClockedRepo interface { - Repo - +// RepoClock give access to Lamport clocks +type RepoClock interface { // GetOrCreateClock return a Lamport clock stored in the Repo. // If the clock doesn't exist, it's created. GetOrCreateClock(name string) (lamport.Clock, error) @@ -127,7 +131,11 @@ type ClockLoader struct { // TestedRepo is an extended ClockedRepo with function for testing only type TestedRepo interface { ClockedRepo + repoTest +} +// repoTest give access to test only functions +type repoTest interface { // AddRemote add a new remote to the repository AddRemote(name string, url string) error } -- cgit