Documentation
¶
Index ¶
- Variables
- func AttachmentFetch(ctx context.Context, spec model.RepoSpec, ref model.AttachmentContainerRef, ...) ([]byte, error)
- func CalculateFileDigest(raw []byte) (string, []byte, error)
- func Delete(ctx context.Context, rSpec model.RepoSpec, id string) error
- func DeleteAttachment(ctx context.Context, spec model.RepoSpec, ref model.AttachmentContainerRef, ...) error
- func FetchByName(ctx context.Context, spec model.RepoSpec, fn model.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 GetTMMetadata(ctx context.Context, spec model.RepoSpec, tmID string) ([]model.FoundVersion, error, []*repos.RepoAccessError)
- func ImportAttachment(ctx context.Context, spec model.RepoSpec, ref model.AttachmentContainerRef, ...) error
- func List(ctx context.Context, rSpec model.RepoSpec, search *model.SearchParams) (model.SearchResult, error, []*repos.RepoAccessError)
- func ResolveFetchName(ctx context.Context, spec model.RepoSpec, fn model.FetchName) (string, model.RepoSpec, error, []*repos.RepoAccessError)
- type ImportCommand
- type Now
- type VersionsCommand
Constants ¶
This section is empty.
Variables ¶
var ErrTMNameTooLong = fmt.Errorf("TM name too long (max %d allowed)", maxNameLength)
Functions ¶
func AttachmentFetch ¶
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 DeleteAttachment ¶
func FetchByName ¶
func FetchByTMID ¶
func FetchByTMIDOrName ¶
func GetTMMetadata ¶
func GetTMMetadata(ctx context.Context, spec model.RepoSpec, tmID string) ([]model.FoundVersion, error, []*repos.RepoAccessError)
func ImportAttachment ¶
func List ¶
func List(ctx context.Context, rSpec model.RepoSpec, search *model.SearchParams) (model.SearchResult, error, []*repos.RepoAccessError)
Types ¶
type ImportCommand ¶
type ImportCommand struct {
// contains filtered or unexported fields
}
func NewImportCommand ¶
func NewImportCommand(now Now) *ImportCommand
func (*ImportCommand) ImportFile ¶
func (c *ImportCommand) ImportFile(ctx context.Context, raw []byte, repo repos.Repo, opts repos.ImportOptions) (repos.ImportResult, error)
ImportFile prepares file contents for importing (generates id if necessary, etc.) and imports to repo. Returns ImportResult which includes the ID that the TM has been stored under, and error. If the repo already contains the same TM, the error will be 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)