commands

package
v0.0.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFetchName = errors.New("invalid fetch name")

Functions

func CalculateFileDigest

func CalculateFileDigest(raw []byte) (string, []byte, error)

CalculateFileDigest calculates the hash string for TM version. Returns the 12-char hash string, the file contents that were hashed, and an error. The contents that were hashed may differ from the input. The changes to the contents are made to make the hashing reliable and idempotent: normalizing line endings, and setting 'id' to empty string If the file is not a valid json, the function is not guaranteed to return with an error

Types

type DeleteCommand

type DeleteCommand struct {
}

func NewDeleteCommand

func NewDeleteCommand() *DeleteCommand

func (*DeleteCommand) Delete

func (c *DeleteCommand) Delete(rSpec model.RepoSpec, id string) error

type FetchCommand

type FetchCommand struct {
}

func NewFetchCommand

func NewFetchCommand() *FetchCommand

func (*FetchCommand) FetchByName

func (c *FetchCommand) FetchByName(spec model.RepoSpec, fn FetchName, restoreId bool) (string, []byte, error, []*repos.RepoAccessError)

func (*FetchCommand) FetchByTMID

func (c *FetchCommand) FetchByTMID(spec model.RepoSpec, tmid string, restoreId bool) (string, []byte, error, []*repos.RepoAccessError)

func (*FetchCommand) FetchByTMIDOrName

func (c *FetchCommand) FetchByTMIDOrName(spec model.RepoSpec, idOrName string, restoreId bool) (string, []byte, error, []*repos.RepoAccessError)

type FetchName

type FetchName struct {
	Name   string
	Semver string
}

func ParseAsTMIDOrFetchName

func ParseAsTMIDOrFetchName(idOrName string) (*model.TMID, *FetchName, error)

ParseAsTMIDOrFetchName parses idOrName as model.TMID. If that fails, parses it as FetchName. Returns error is idOrName is not valid as either. Only one of returned pointers may be not nil

func ParseFetchName

func ParseFetchName(fetchName string) (FetchName, error)

type Now

type Now func() time.Time

type PushCommand

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

func NewPushCommand

func NewPushCommand(now Now) *PushCommand

func (*PushCommand) PushFile

func (c *PushCommand) PushFile(raw []byte, repo repos.Repo, optPath string) (string, error)

PushFile prepares file contents for pushing (generates id if necessary, etc.) and pushes to repo. Returns the ID that the TM has been stored under, and error. If the repo already contains the same TM, returns the id of the existing TM and an instance of repos.ErrTMIDConflict

type VersionsCommand

type VersionsCommand struct {
}

func NewVersionsCommand

func NewVersionsCommand() *VersionsCommand

func (*VersionsCommand) ListVersions

func (c *VersionsCommand) ListVersions(spec model.RepoSpec, name string) ([]model.FoundVersion, error, []*repos.RepoAccessError)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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