destination

package
v0.0.0-...-27ce57f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination interface {
	Hash(ctx context.Context, i item.Item) (string, error)
	Create(ctx context.Context, i item.Item) error
	Update(ctx context.Context, i item.Item, hash string) error
	Delete(ctx context.Context, i item.Item, hash string) error
}

Destination stores Items.

type File

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

File takes a directory in the filesystem as destination.

func NewFile

func NewFile(root string) *File

NewFile returns a new File destination.

func (*File) Create

func (f *File) Create(ctx context.Context, i item.Item) error

Create adds a new Item to the Destination.

func (*File) Delete

func (f *File) Delete(ctx context.Context, i item.Item, hash string) error

Delete removes an Item from the Destination.

func (*File) Hash

func (f *File) Hash(ctx context.Context, i item.Item) (string, error)

Hash returns the SHA1 for the item.

func (*File) Update

func (f *File) Update(ctx context.Context, i item.Item, hash string) error

Update overwrites an Item in the Destination.

type GithubAPI

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

GithubAPI stores files using github API.

func NewGihubAPI

func NewGihubAPI(ctx context.Context, client *github.Client, config RepoCfg) *GithubAPI

NewGihubAPI returns a new GithubAPI destination.

func (*GithubAPI) Create

func (g *GithubAPI) Create(ctx context.Context, i item.Item) error

Create adds a new Item to the Destination.

func (*GithubAPI) Delete

func (g *GithubAPI) Delete(ctx context.Context, i item.Item, hash string) error

Delete removes an Item from the Destination.

func (*GithubAPI) Hash

func (g *GithubAPI) Hash(ctx context.Context, i item.Item) (string, error)

Hash returns file hash using Github API.

func (*GithubAPI) Update

func (g *GithubAPI) Update(ctx context.Context, i item.Item, hash string) error

Update overwrites an Item in the Destination.

type Memory

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

Memory is a static Destination.

func (*Memory) Create

func (m *Memory) Create(ctx context.Context, i item.Item) error

Create adds a new Item.

func (*Memory) Delete

func (m *Memory) Delete(ctx context.Context, i item.Item, hash string) error

Delete removes an existing Item.

func (*Memory) Hash

func (m *Memory) Hash(ctx context.Context, i item.Item) (string, error)

Hash returns the SHA1 for the item.

func (*Memory) Update

func (m *Memory) Update(ctx context.Context, i item.Item, hash string) error

Update writes an existing Item.

type RepoCfg

type RepoCfg struct {
	Owner  string
	Repo   string
	Branch string
}

RepoCfg specifies the Repo used by GithubAPI

Jump to

Keyboard shortcuts

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