go-git-annex-external is a library for creating git-annex external special remotes and external backends using Go. Clients of the library are insulated from the specifics of the communication protocols and only need to implement individual operations (fulfilling particular Go interfaces) to produce external remotes and backends.
Both protocols as they stand at the time of writing are fully supported, including (for external special remotes) the info extension, the async extension, and the simple export interface.
See the cmd/git-annex-remote-local
subdirectory for a functioning example.
Here's a minimal compilable skeleton:
package main
import "github.com/dzhu/go-git-annex-external/remote"
type minimalRemote struct{}
func (*minimalRemote) Init(a remote.Annex) error { return nil }
func (*minimalRemote) Prepare(a remote.Annex) error { return nil }
func (*minimalRemote) Store(a remote.Annex, key, file string) error { return nil }
func (*minimalRemote) Retrieve(a remote.Annex, key, file string) error { return nil }
func (*minimalRemote) Present(a remote.Annex, key string) (bool, error) { return false, nil }
func (*minimalRemote) Remove(a remote.Annex, key string) error { return nil }
func main() {
remote.Run(&minimalRemote{})
}
See the cmd/git-annex-backend-XSHORTHASH
subdirectory for a functioning
example. Here's a minimal compilable skeleton:
package main
import "github.com/dzhu/go-git-annex-external/backend"
type minimalBackend struct{}
func (*minimalBackend) GenKey(a backend.Annex, file string) (string, bool, error) {
return "", false, nil
}
func (*minimalBackend) IsStable(a backend.Annex) bool { return false }
func main() {
backend.Run(&minimalBackend{})
}