func NewFilesystemRepoStore(dir string) *FilesystemRepoStore {
	return &FilesystemRepoStore{
		datadir: dir,
		m:       map[string]*Repository{},
	}
}
NewFilesystemRepoStore instantiates a new repo store
package repository
import (
	"errors"
	"os"
	"path/filepath"
	"sync"
)
var (
	ErrNotFound = errors.New("not found")
	ErrExists   = errors.New("exists")
)
type RepositoryStore interface {
	GetRepo(string) (*Repository, error)
	CreateRepo(*Repository) error
	UpdateRepo(*Repository) error
	RemoveRepo(string) error
}
type MemRepoStore struct {
	mu sync.Mutex
	m  map[string]*Repository
}
func NewMemRepoStore() *MemRepoStore {
	return &MemRepoStore{m: map[string]*Repository{}}
}
func (mrs *MemRepoStore) GetRepo(id string) (*Repository, error) {
	if v, ok := mrs.m[id]; ok {
		return v, nil
	}
	return nil, ErrNotFound
}
func (mrs *MemRepoStore) CreateRepo(repo *Repository) error {
	mrs.mu.Lock()
	defer mrs.mu.Unlock()
	if _, ok := mrs.m[repo.ID]; ok {
		return ErrExists
	}
	mrs.m[repo.ID] = repo
	return nil
}
func (mrs *MemRepoStore) UpdateRepo(repo *Repository) error {
	mrs.mu.Lock()
	defer mrs.mu.Unlock()
	if _, ok := mrs.m[repo.ID]; ok {
		mrs.m[repo.ID] = repo
		return nil
	}
	return ErrNotFound
}
func (mrs *MemRepoStore) RemoveRepo(id string) error {
	mrs.mu.Lock()
	defer mrs.mu.Unlock()
	if _, ok := mrs.m[id]; ok {
		delete(mrs.m, id)
		return nil
	}
	return ErrNotFound
}
type FilesystemRepoStore struct {
	mu      sync.Mutex
	m       map[string]*Repository
	datadir string
}