core

package
v0.0.0-...-53f6ecd Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotProvided = errors.New("block not provided")

Functions

func CidFromHex

func CidFromHex(sha string) (cid.Cid, error)

func GetLocalDir

func GetLocalDir() (string, error)

func HexFromCid

func HexFromCid(cid cid.Cid) (string, error)

Types

type Fetch

type Fetch struct {
	// contains filtered or unexported fields
}

func NewFetch

func NewFetch(gitDir string, tracker *Tracker) *Fetch

func (*Fetch) FetchHash

func (f *Fetch) FetchHash(base string, remote *Remote) error

type Object

type Object struct {
	// contains filtered or unexported fields
}

type ObjectProvider

type ObjectProvider func(cid string, tracker *Tracker) ([]byte, error)

type Push

type Push struct {
	// contains filtered or unexported fields
}

func NewPush

func NewPush(gitDir string, tracker *Tracker, repo *git.Repository) *Push

func (*Push) PushHash

func (p *Push) PushHash(hash string, remote *Remote) (string, error)

type Remote

type Remote struct {
	Log *log.Logger

	Repo    *git.Repository
	Tracker *Tracker

	Handler RemoteHandler
	// contains filtered or unexported fields
}

func NewRemote

func NewRemote(handler RemoteHandler, reader io.Reader, writer io.Writer) (*Remote, error)

func (*Remote) Close

func (r *Remote) Close() error

func (*Remote) NewFetch

func (r *Remote) NewFetch() *Fetch

func (*Remote) NewPush

func (r *Remote) NewPush() *Push

func (*Remote) Printf

func (r *Remote) Printf(format string, a ...interface{}) (n int, err error)

func (*Remote) ProcessCommands

func (r *Remote) ProcessCommands() error

type RemoteHandler

type RemoteHandler interface {
	List(remote *Remote, forPush bool) ([]string, error)
	Push(remote *Remote, localRef string, remoteRef string) (string, error)

	GetRemoteName() string

	Initialize(remote *Remote) error
	Finish(remote *Remote) error
}

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker tracks which hashes are published in IPLD

func NewTracker

func NewTracker(gitPath string) (*Tracker, error)

func (*Tracker) AddEntry

func (t *Tracker) AddEntry(hash string, c string) error

func (*Tracker) Close

func (t *Tracker) Close() error

func (*Tracker) Entry

func (t *Tracker) Entry(hash string) (string, error)

Jump to

Keyboard shortcuts

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