Documentation ¶
Index ¶
- Variables
- func CalculateFileDigest(raw []byte) (string, []byte, error)
- func FetchByName(ctx context.Context, spec model.RepoSpec, fn FetchName, restoreId bool) (string, []byte, error, []*repos.RepoAccessError)
- func FetchByTMID(ctx context.Context, spec model.RepoSpec, tmid string, restoreId bool) (string, []byte, error, []*repos.RepoAccessError)
- func FetchByTMIDOrName(ctx context.Context, spec model.RepoSpec, idOrName string, restoreId bool) (string, []byte, error, []*repos.RepoAccessError)
- func List(ctx context.Context, rSpec model.RepoSpec, search *model.SearchParams) (model.SearchResult, error, []*repos.RepoAccessError)
- type DeleteCommand
- type FetchName
- type Now
- type PushCommand
- type VersionsCommand
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFetchName = errors.New("invalid fetch name")
var ErrTMNameTooLong = fmt.Errorf("TM name too long (max %d allowed)", maxNameLength)
Functions ¶
func CalculateFileDigest ¶
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
func FetchByName ¶
func FetchByTMID ¶
func FetchByTMIDOrName ¶
func List ¶
func List(ctx context.Context, rSpec model.RepoSpec, search *model.SearchParams) (model.SearchResult, error, []*repos.RepoAccessError)
Types ¶
type DeleteCommand ¶
type DeleteCommand struct { }
func NewDeleteCommand ¶
func NewDeleteCommand() *DeleteCommand
type FetchName ¶
func ParseAsTMIDOrFetchName ¶
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 ¶
type PushCommand ¶
type PushCommand struct {
// contains filtered or unexported fields
}
func NewPushCommand ¶
func NewPushCommand(now Now) *PushCommand
func (*PushCommand) PushFile ¶
func (c *PushCommand) PushFile(ctx context.Context, 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(ctx context.Context, spec model.RepoSpec, name string) ([]model.FoundVersion, error, []*repos.RepoAccessError)