storage

package
Version: v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExtWasm is wasm file extension
	ExtWasm = "wasm"
	// ExtGo is go file extension
	ExtGo = "go"
)

Variables

View Source
var ErrNotExists = errors.New("item not exists")

ErrNotExists is item not found error

Functions

This section is empty.

Types

type ArtifactID

type ArtifactID string

ArtifactID represents artifact ID

func GetArtifactID

func GetArtifactID(data []byte) (ArtifactID, error)

GetArtifactID generates new artifact ID from contents

func (ArtifactID) Ext

func (a ArtifactID) Ext(ext string) string

Ext returns string with artifact ID and extension

func (ArtifactID) String

func (a ArtifactID) String() string

String returns string

type Callback

type Callback = func(wasmLocation, sourceLocation string) error

Callback is location callback

type LocalStorage

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

LocalStorage is local build artigact storage

func NewLocalStorage

func NewLocalStorage(log *zap.SugaredLogger, baseDir string) (ls *LocalStorage, err error)

NewLocalStorage constructs new local storage

func (LocalStorage) CreateLocationAndDo

func (s LocalStorage) CreateLocationAndDo(id ArtifactID, data []byte, cb Callback) error

CreateLocationAndDo implements storage interface

func (LocalStorage) GetItem

func (s LocalStorage) GetItem(id ArtifactID) (io.ReadCloser, error)

GetItem implements storage interface

func (LocalStorage) HasItem

func (s LocalStorage) HasItem(id ArtifactID) (bool, error)

HasItem implements storage interface

func (LocalStorage) StartCleaner

func (s LocalStorage) StartCleaner(ctx context.Context, interval time.Duration, wg *sync.WaitGroup)

StartCleaner implements storage interface

type StoreProvider

type StoreProvider interface {
	// HasItem checks if item exists
	HasItem(id ArtifactID) (bool, error)

	// GetItem returns item by id
	GetItem(id ArtifactID) (io.ReadCloser, error)

	// CreateLocationAndDo creates entry in storage and runs specified callback with new location
	CreateLocationAndDo(id ArtifactID, data []byte, cb Callback) error
}

StoreProvider is abstract artifact storage

Jump to

Keyboard shortcuts

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