storage

package
v1.15.1-0...-ab84f35 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 15 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(entries map[string][]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(workspace Workspace) error

Callback is location callback

type LocalStorage

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

LocalStorage is local build artifact storage

func NewLocalStorage

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

NewLocalStorage constructs new local storage

func (LocalStorage) Clean

func (s LocalStorage) Clean(ctx context.Context) error

Clean implements' builder.Cleaner interface.

func (LocalStorage) CleanJobName

func (s LocalStorage) CleanJobName() string

CleanJobName implements builder.Cleaner interface.

func (LocalStorage) CreateWorkspace

func (s LocalStorage) CreateWorkspace(id ArtifactID, files map[string][]byte) (*Workspace, error)

CreateWorkspace implements storage interface

func (LocalStorage) GetItem

func (s LocalStorage) GetItem(id ArtifactID) (ReadCloseSizer, error)

GetItem implements storage interface

func (LocalStorage) HasItem

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

HasItem implements storage interface

type ReadCloseSizer

type ReadCloseSizer interface {
	io.ReadCloser

	Size() int64
}

type StoreProvider

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

	// GetItem returns item by id
	GetItem(id ArtifactID) (ReadCloseSizer, error)

	// CreateWorkspace creates workspace entry in storage
	CreateWorkspace(id ArtifactID, files map[string][]byte) (*Workspace, error)

	// Clean truncates storage contents
	Clean(ctx context.Context) error
}

StoreProvider is abstract artifact storage

type Workspace

type Workspace struct {
	// WorkDir is workspace directory
	WorkDir string

	// BinaryPath is absolute path for output binary file.
	BinaryPath string

	// Files is list of files in workspace
	Files []string
}

Jump to

Keyboard shortcuts

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