Skip to content

A library for creating git-annex external special remotes and backends using Go

License

Notifications You must be signed in to change notification settings

dzhu/go-git-annex-external

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-git-annex-external

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.

External special remotes

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{})
}

External backends

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{})
}

About

A library for creating git-annex external special remotes and backends using Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages