go-git-annex-external

module
v0.0.0-...-4cd60ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2020 License: MIT

README

#######################
 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
**************************

-  `API documentation <remote-docs_>`_
-  `protocol documentation <remote-protocol_>`_

See the ``cmd/git-annex-remote-local`` subdirectory for a functioning example.
Here's a minimal compilable skeleton:

.. code:: go

   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
*******************

-  `API documentation <backend-docs_>`_
-  `protocol documentation <backend-protocol_>`_

See the ``cmd/git-annex-backend-XSHORTHASH`` subdirectory for a functioning
example. Here's a minimal compilable skeleton:

.. code:: go

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

.. _api documentation: https://pkg.go.dev/github.com/dzhu/go-git-annex-external

.. _async extension: https://git-annex.branchable.com/design/external_special_remote_protocol/async_appendix/

.. _backend-docs: https://pkg.go.dev/github.com/dzhu/go-git-annex-external/backend

.. _backend-protocol: https://git-annex.branchable.com/design/external_backend_protocol/

.. _backends: https://git-annex.branchable.com/backends/

.. _git-annex: https://git-annex.branchable.com

.. _remote-docs: https://pkg.go.dev/github.com/dzhu/go-git-annex-external/remote

.. _remote-protocol: https://git-annex.branchable.com/design/external_special_remote_protocol/

.. _simple export interface: https://git-annex.branchable.com/design/external_special_remote_protocol/export_and_import_appendix/

.. _special remotes: https://git-annex.branchable.com/special_remotes/

Directories

Path Synopsis
Package backend implements the git-annex external backend protocol.
Package backend implements the git-annex external backend protocol.
cmd
git-annex-backend-XSHORTHASH
Command git-annex-backend-XSHORTHASH is an external backend for git-annex that computes keys using a short prefix of the SHA512 hash of a file.
Command git-annex-backend-XSHORTHASH is an external backend for git-annex that computes keys using a short prefix of the SHA512 hash of a file.
git-annex-remote-local
Command git-annex-remote-local is a simple file-based external special remote for git-annex.
Command git-annex-remote-local is a simple file-based external special remote for git-annex.
Package remote implements the git-annex external special remote protocol.
Package remote implements the git-annex external special remote protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL