nodeservice

package
v0.0.0-...-6f8bca6 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIKeyHeader = "x-api-key"
)

Variables

View Source
var (
	ErrNotFound = fmt.Errorf("not found")
)

Functions

func DownloadFromURL

func DownloadFromURL(digest utils.Digest, url string) ([]byte, error)

Types

type IndexClient

type IndexClient struct {
	BaseURL string
}

func (IndexClient) Get

func (c IndexClient) Get(ctx context.Context, digest utils.Digest) ([]byte, error)

func (IndexClient) Has

func (c IndexClient) Has(ctx context.Context, h utils.Digest) (bool, error)

type Inner

type Inner struct {
	Name         string
	ObjectGetter ObjectGetter
}

func NewRemote

func NewRemote(name string, url string, apiKey string) Inner

type ObjectGetter

type ObjectGetter interface {
	Get(ctx context.Context, h utils.Digest) ([]byte, error)
	// TODO: GetMetadata
	Has(ctx context.Context, h utils.Digest) (bool, error)
}

type ObjectStore

type ObjectStore interface {
	ObjectGetter
	Put(ctx context.Context, b []byte) (utils.Digest, error)
}

type Remote

type Remote struct {
	APIURL string
	APIKey string
	GRPC   pb.EntClient
}

func (Remote) Get

func (s Remote) Get(ctx context.Context, digest utils.Digest) ([]byte, error)

func (Remote) Has

func (s Remote) Has(ctx context.Context, digest utils.Digest) (bool, error)

func (Remote) Put

func (s Remote) Put(ctx context.Context, size uint64, r io.Reader) (utils.Digest, error)

type Sequence

type Sequence struct {
	Inner []Inner
}

func (Sequence) Get

func (s Sequence) Get(ctx context.Context, digest utils.Digest) ([]byte, error)

func (Sequence) Has

func (s Sequence) Has(ctx context.Context, digest utils.Digest) (bool, error)

func (Sequence) Put

func (s Sequence) Put(ctx context.Context, b []byte) (utils.Digest, error)

Jump to

Keyboard shortcuts

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