checkout

package
v2.4.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCheckoutAlreadyExists = errors.New("A checkout with this ID already exists")
	ErrInvalidCheckoutID     = errors.New("The Checkout ID is invalid")
)

Errors returned by the Checkout Manager.

Functions

This section is empty.

Types

type DefinitionLine

type DefinitionLine struct {
	Checksum string
	FileSize int64
	FilePath string
}

DefinitionLine is a single line in a checkout definition file.

type DefinitionReader

type DefinitionReader struct {
	Err        error
	LineNumber int
	// contains filtered or unexported fields
}

DefinitionReader reads and parses a checkout definition

func NewDefinitionReader

func NewDefinitionReader(ctx context.Context, reader io.Reader) *DefinitionReader

NewDefinitionReader creates a new DefinitionReader for the given reader.

func (*DefinitionReader) Read

func (fr *DefinitionReader) Read() <-chan *DefinitionLine

Read spins up a new goroutine for parsing the checkout definition. The returned channel will receive definition lines.

type FileInvalidError

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

FileInvalidError is returned when there is an invalid line in a checkout definition file.

func (FileInvalidError) Error

func (cfie FileInvalidError) Error() string

type Manager

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

Manager creates checkouts and provides info about missing files.

func NewManager

func NewManager(conf config.Config, fileStore filestore.Storage) *Manager

NewManager creates and returns a new Checkout Manager.

func (*Manager) AddRoutes

func (m *Manager) AddRoutes(router *mux.Router, auther jwtauth.Authenticator)

AddRoutes adds HTTP routes to the muxer.

func (*Manager) Close

func (m *Manager) Close()

Close waits for still-running touch() calls to finish, then returns.

func (*Manager) EraseCheckout

func (m *Manager) EraseCheckout(checkoutID string) error

EraseCheckout removes the checkout directory structure identified by the ID.

func (*Manager) PrepareCheckout

func (m *Manager) PrepareCheckout(checkoutID string) (ResolvedCheckoutInfo, error)

PrepareCheckout creates the root directory for a specific checkout. Returns the path relative to the checkout root directory.

func (*Manager) SymlinkToCheckout

func (m *Manager) SymlinkToCheckout(blobPath, checkoutPath, symlinkRelativePath string) error

SymlinkToCheckout creates a symlink at symlinkPath to blobPath. It does *not* do any validation of the validity of the paths!

type ResolvedCheckoutInfo

type ResolvedCheckoutInfo struct {

	// The path relative to the Manager.checkoutBasePath. This is what is
	// sent back to the client.
	RelativePath string
	// contains filtered or unexported fields
}

ResolvedCheckoutInfo contains the result of validating the Checkout ID and parsing it into a final path.

Jump to

Keyboard shortcuts

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