core

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RefLocal  = "__local__"
	RefLatest = "latest"
)

Variables

View Source
var (
	ErrWorkspaceNotFound = errors.New("not a workspace")
	ErrEmptyRepository   = errors.New("no commit is found in the repository. please push data to repository first")
)

Functions

func InitWorkspace

func InitWorkspace(baseDir, repo string) error

func MakeCommitMetadata

func MakeCommitMetadata(commit *Commit) ([]byte, string)

func MakeCommitPath

func MakeCommitPath(hash string) string

func MakeObjectPath

func MakeObjectPath(hash string) string

func MakeRefPath

func MakeRefPath(ref string) string

func MakeTagPath

func MakeTagPath(ref string) string

func Sha1Sum

func Sha1Sum(content []byte) string

func Sha1SumFromFile

func Sha1SumFromFile(path string) (string, error)

Types

type ArtConfig

type ArtConfig struct {
	MetadataDir string
	BaseDir     string
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(dir string) (ArtConfig, error)

func NewConfig

func NewConfig(baseDir, metadataDir, repoUrl string) ArtConfig

func (*ArtConfig) Get

func (config *ArtConfig) Get(path string) interface{}

func (*ArtConfig) GetString

func (config *ArtConfig) GetString(path string) string

func (*ArtConfig) Print

func (config *ArtConfig) Print()

func (*ArtConfig) RepoUrl

func (config *ArtConfig) RepoUrl() string

func (*ArtConfig) Save

func (config *ArtConfig) Save() error

func (*ArtConfig) Set

func (config *ArtConfig) Set(path string, value interface{})

func (*ArtConfig) SetRepoUrl

func (config *ArtConfig) SetRepoUrl(repoUrl string)

type ArtifactManager

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

func NewArtifactManager

func NewArtifactManager(config ArtConfig) (*ArtifactManager, error)

func (*ArtifactManager) AddRef

func (mngr *ArtifactManager) AddRef(ref string, commit string) error

func (*ArtifactManager) AddTag

func (mngr *ArtifactManager) AddTag(refOrCommit, tag string) error

func (*ArtifactManager) Commit

func (mngr *ArtifactManager) Commit(commit Commit) error

func (*ArtifactManager) DeleteRef

func (mngr *ArtifactManager) DeleteRef(ref string) error

func (*ArtifactManager) DeleteTag

func (mngr *ArtifactManager) DeleteTag(tag string) error

func (*ArtifactManager) Diff

func (mngr *ArtifactManager) Diff(option DiffOptions) (DiffResult, error)

func (*ArtifactManager) Download

func (mngr *ArtifactManager) Download(repoPath, localPath, tmpDir string, meter *repository.Meter) error

func (*ArtifactManager) DownloadBlob

func (mngr *ArtifactManager) DownloadBlob(localPath, hash string, meter *repository.Meter) (BlobDownloadResult, error)

func (*ArtifactManager) Fetch

func (mngr *ArtifactManager) Fetch() error

Fetch downloads all the metadata from repository

func (*ArtifactManager) FindCommitOrReference

func (mngr *ArtifactManager) FindCommitOrReference(refOrCommit string) (string, error)

func (*ArtifactManager) GetCommit

func (mngr *ArtifactManager) GetCommit(hash string) (*Commit, error)

func (*ArtifactManager) GetRef

func (mngr *ArtifactManager) GetRef(ref string) (string, error)

func (*ArtifactManager) List

func (mngr *ArtifactManager) List(refOrCommit string) error

func (*ArtifactManager) ListTags

func (mngr *ArtifactManager) ListTags() error

func (*ArtifactManager) Log

func (mngr *ArtifactManager) Log(refOrCommit string) error

func (*ArtifactManager) MakeEmptyCommit

func (mngr *ArtifactManager) MakeEmptyCommit() *Commit

func (*ArtifactManager) MakeWorkspaceCommit

func (mngr *ArtifactManager) MakeWorkspaceCommit(parent string, message *string, filter func(path string) bool) (*Commit, error)

func (*ArtifactManager) Pull

func (mngr *ArtifactManager) Pull(options PullOptions) error

func (*ArtifactManager) Push

func (mngr *ArtifactManager) Push(options PushOptions) error

func (*ArtifactManager) Status

func (mngr *ArtifactManager) Status() (DiffResult, error)

func (*ArtifactManager) Upload added in v0.7.0

func (mngr *ArtifactManager) Upload(localPath, repoPath string, meter *repository.Meter) error

func (*ArtifactManager) UploadBlob

func (mngr *ArtifactManager) UploadBlob(localPath, hash string, meter *repository.Meter, checkSkip bool) (BlobUploadResult, error)

type AvcIgnore

type AvcIgnore = gitignore.GitIgnore

func NewAvcIgnore

func NewAvcIgnore(dir string) (*AvcIgnore, error)

type AvcInclude

type AvcInclude = gitignore.GitIgnore

func NewAvcInclude

func NewAvcInclude(filePath []string) *AvcInclude

type BlobDownloadResult

type BlobDownloadResult struct {
	// File not changed. Skip the download
	Skip bool
}

type BlobMetaData

type BlobMetaData struct {
	Path string      `json:"path"`
	Hash string      `json:"hash,omitempty"`
	Link string      `json:"link,omitempty"`
	Mode fs.FileMode `json:"mode"`
	Size int64       `json:"size"`
}

func MakeBlobMetadata

func MakeBlobMetadata(baseDir string, path string) (BlobMetaData, error)

type BlobUploadResult

type BlobUploadResult struct {
	// Blob exists in ther repo. Skip the upload
	Skip bool
}

type ChangeMode

type ChangeMode int

type Commit

type Commit struct {
	CreatedAt time.Time      `json:"createdAt"`
	Parent    string         `json:"parent,omitempty"`
	Message   *string        `json:"messaage,omitempty"`
	Blobs     []BlobMetaData `json:"blobs"`
}

type DiffOptions

type DiffOptions struct {
	LeftRef       string
	LeftCommit    *Commit
	RightRef      string
	RightCommit   *Commit
	AddFilter     PathFilter
	ChangeFilter  PathFilter
	DeleteFilter  PathFilter
	IncludeFilter PathFilter
	NoDelete      bool
}

type DiffRecord

type DiffRecord struct {
	Type    DiffType
	Hash    string
	Link    string
	Path    string
	Size    int64
	Mode    fs.FileMode
	OldPath string
	OldLink string
	OldHash string
	OldSize int64
	OldMode fs.FileMode
}

type DiffResult

type DiffResult struct {
	Records []DiffRecord
}

func (DiffResult) IsAppendOnly

func (result DiffResult) IsAppendOnly() bool

func (DiffResult) IsChanged

func (result DiffResult) IsChanged() bool

func (*DiffResult) Print

func (result *DiffResult) Print(verbose bool)

type DiffType

type DiffType int
const (
	DiffTypeAdd DiffType = iota
	DiffTypeDelete
	DiffTypeChange
	DiffTypeRename
)

type PathFilter

type PathFilter func(path string) bool

type PullOptions

type PullOptions struct {
	DryRun      bool
	NoFetch     bool
	Delete      bool
	RefOrCommit *string
	FileFilter  PathFilter
}

type PushOptions

type PushOptions struct {
	DryRun  bool
	Message *string
	Tag     *string
}

type ReferenceNotFoundError

type ReferenceNotFoundError struct {
	Ref string
	Err error
}

func (ReferenceNotFoundError) Error

func (err ReferenceNotFoundError) Error() string

Jump to

Keyboard shortcuts

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