Documentation ¶
Index ¶
- Constants
- Variables
- type AddOptions
- type CloneOptions
- type Commit
- func (c *Commit) Comment() string
- func (c *Commit) CreatedBy() string
- func (c *Commit) CreationDate() *time.Time
- func (c *Commit) ID() string
- func (c *Commit) Operation() CommitOperation
- func (c *Commit) Parent() *Commit
- func (c *Commit) Size() int64
- func (c *Commit) Tags() []string
- func (c *Commit) WasCreatedByOcitree() bool
- type CommitOperation
- type CommitOptions
- type Commits
- type ExecOptions
- type FetchOptions
- type Manager
- func (m *Manager) Clone(remoteRef reference.RemoteRef, options CloneOptions) error
- func (m *Manager) Fetch(remoteRef reference.RemoteRef, options FetchOptions) error
- func (m *Manager) LocalRepositoryExist(name reference.Name) bool
- func (m *Manager) Repositories() ([]*Repository, error)
- func (m *Manager) Repository(name reference.Name) (*Repository, error)
- func (m *Manager) ResolveRelativeReference(ref reference.Relative) (reference.Reference, error)
- type PullOptions
- type RebaseChoice
- type RebaseCommit
- type RebaseCommits
- type RebaseSession
- type Repository
- func (r *Repository) Add(dest string, options AddOptions, sources ...string) error
- func (r *Repository) AddTag(tag reference.Tag) error
- func (r *Repository) Checkout(ref reference.Reference) error
- func (r *Repository) Commits() (Commits, error)
- func (r *Repository) Exec(options ExecOptions, cmd string, args ...string) error
- func (r *Repository) HeadRef() reference.LocalRef
- func (r *Repository) ID() string
- func (r *Repository) Mount() (string, error)
- func (r *Repository) Name() reference.Name
- func (r *Repository) OtherHeadTags() []reference.Tag
- func (r *Repository) OtherTags() ([]reference.Tag, error)
- func (r *Repository) RebaseSession(ref reference.Reference) (*RebaseSession, error)
- func (r *Repository) RebaseSessionByImage(baseImage *libimage.Image) (*RebaseSession, error)
- func (r *Repository) ReloadHead() error
- func (r *Repository) RemoveTag(tag reference.Tag) error
- func (r *Repository) Unmount() error
Constants ¶
const CommitPrefix = "/bin/sh -c #(ocitree) "
Variables ¶
var ( ErrLocalRepositoryAlreadyExist = errors.New("local repository with the same name already exist") ErrLocalRepositoryUnknown = errors.New("unknown local repository") ErrRelativeReferenceOffsetOutOfBounds = errors.New("relative reference offset is out of bounds") ErrCommitHasNoImageAssociated = errors.New("commit has no image associated") )
var ( ErrUnknownRebaseChoice = errors.New("unknown rebase choice") ErrInvalidRebaseCommitID = errors.New("invalid rebase commit id") ErrDuplicateRebaseCommit = errors.New("rebase commit line already parsed") )
var ( ErrRepositoryInvalidNoName = errors.New("invalid repository, no valid name") ErrImageNotPartOfRepository = errors.New("image is not part of repository") )
var ( ErrRebaseNothingToRebase = errors.New("nothing to rebase") ErrRebaseUnknownInstruction = errors.New("unknown instruction") ErrRebaseImageNotPartOfRepo = errors.New("rebase image not part of repository") )
var (
ErrUnknownCommitOperation = errors.New("unknown commit operation")
)
Functions ¶
This section is empty.
Types ¶
type AddOptions ¶ added in v0.0.3
type AddOptions struct { //Chmod sets the access permissions of the destination content. Chmod string // Chown is a spec for the user who should be given ownership over the // newly-added content, potentially overriding permissions which would // otherwise be set to 0:0. Chown string Message string ReportWriter io.Writer }
AddOptions holds option to Manager.Add method.
type CloneOptions ¶ added in v0.0.4
type CloneOptions struct {
PullOptions
}
CloneOptions holds clone options.
type Commit ¶
type Commit struct {
// contains filtered or unexported fields
}
Commit define the history of a single layer.
func (*Commit) CreationDate ¶
CreationDate returns the creation date of the commit.
func (*Commit) Operation ¶ added in v0.1.0
func (c *Commit) Operation() CommitOperation
Operation returns the operation used to create this commit
func (*Commit) WasCreatedByOcitree ¶ added in v0.1.0
IsCreatedByOCITree returns true if the commit was made using libocitree.
type CommitOperation ¶ added in v0.1.0
type CommitOperation uint
const ( UnknownCommitOperation CommitOperation = iota ExecCommitOperation AddCommitOperation )
func (CommitOperation) String ¶ added in v0.1.0
func (co CommitOperation) String() string
String implements fmt.Stringer.
type CommitOptions ¶ added in v0.0.4
CommitOptions contains options to add a commit to repository.
type ExecOptions ¶ added in v0.0.4
type ExecOptions struct { Stdin io.Reader Stdout io.Writer Stderr io.Writer Message string ReportWriter io.Writer }
ExecOptions holds options for Manager.Exec method.
type FetchOptions ¶ added in v0.0.4
type FetchOptions struct {
PullOptions
}
FetchOptions holds fetch options.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager defines a repositories manager.
func NewManagerFromStore ¶
NewManagerFromStore returns a new Manager using the given store. An error is returned if libimage.Runtime can't be created using the given store and system context. Call Destroy() once you're done with the manager.
func (*Manager) Clone ¶
func (m *Manager) Clone(remoteRef reference.RemoteRef, options CloneOptions) error
Clone clones remote repository with the given name to local storage.
func (*Manager) Fetch ¶ added in v0.0.2
func (m *Manager) Fetch(remoteRef reference.RemoteRef, options FetchOptions) error
Fetch fetches multiple version of the given repository reference. It starts by updating every HEAD tags and then finally, it downloads the given remote reference.
func (*Manager) LocalRepositoryExist ¶ added in v0.0.4
LocalRepositoryExist returns true if a local repository with the given name exist.
func (*Manager) Repositories ¶
func (m *Manager) Repositories() ([]*Repository, error)
Repositories returns the list of repositories
func (*Manager) Repository ¶
func (m *Manager) Repository(name reference.Name) (*Repository, error)
Repository returns the repository associated with the given name. An error is returned if local repository is missing or corrupted.
type PullOptions ¶ added in v0.0.4
PullOptions holds configuration options for pulling operations.
type RebaseChoice ¶ added in v0.1.0
type RebaseChoice uint
const ( PickRebaseChoice RebaseChoice = iota DropRebaseChoice UnknownRebaseChoice )
func (RebaseChoice) String ¶ added in v0.1.0
func (rc RebaseChoice) String() string
String implements fmt.Stringer.
type RebaseCommit ¶ added in v0.1.0
type RebaseCommit struct { Commit Choice RebaseChoice // contains filtered or unexported fields }
RebaseCommit correspond to a commit and a rebase choice.
type RebaseCommits ¶ added in v0.1.0
type RebaseCommits struct {
// contains filtered or unexported fields
}
RebaseCommits define a read only wrapper over a slice of RebaseCommit. Commits are initially sorted from newer to older.
func (RebaseCommits) Get ¶ added in v0.1.0
func (rc RebaseCommits) Get(i int) *RebaseCommit
Get returns the RebaseCommit at the given index.
func (RebaseCommits) GetByID ¶ added in v0.2.0
func (rc RebaseCommits) GetByID(idprefix string) (*RebaseCommit, int)
GetById returns the RebaseCommit with the given ID prefix.
func (RebaseCommits) Len ¶ added in v0.1.0
func (rc RebaseCommits) Len() int
Len returns length of underlying RebaseCommit slice.
func (RebaseCommits) ParseChoices ¶ added in v0.2.0
func (rc RebaseCommits) ParseChoices(choices string) error
ParseChoices parses a multiline strnig where each line contains a choice and a commit ID separated by a space. Empty lines and lines starting with # are ignored.
func (RebaseCommits) String ¶ added in v0.1.0
func (rc RebaseCommits) String() string
String implements fmt.Stringer.
func (RebaseCommits) Swap ¶ added in v0.2.0
func (rc RebaseCommits) Swap(i, j int)
Swap swaps commit at index i and j
type RebaseSession ¶ added in v0.1.0
type RebaseSession struct {
// contains filtered or unexported fields
}
RebaseSession define a rebase session of a repository.
func (*RebaseSession) Apply ¶ added in v0.1.0
func (rs *RebaseSession) Apply() error
Apply applies rebase choice. RebaseSession must no be used after this method has been called.
func (*RebaseSession) BaseImage ¶ added in v0.1.0
func (rs *RebaseSession) BaseImage() *libimage.Image
BaseImage returns the rebase target image.
func (*RebaseSession) Commits ¶ added in v0.1.0
func (rs *RebaseSession) Commits() RebaseCommits
Commits returns the RebaseCommits part of this session.
func (*RebaseSession) InteractiveEdit ¶ added in v0.1.0
func (rs *RebaseSession) InteractiveEdit() error
InteractiveEdit starts an interactive session
func (*RebaseSession) RebaseHead ¶ added in v0.1.0
func (rs *RebaseSession) RebaseHead() reference.LocalRef
RebaseHead returns reference to rebase head.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is an object holding the history of a rootfs (OCI/Docker image).
func (*Repository) Add ¶ added in v0.0.4
func (r *Repository) Add(dest string, options AddOptions, sources ...string) error
Add commits the given source files to HEAD.
func (*Repository) AddTag ¶ added in v0.0.4
func (r *Repository) AddTag(tag reference.Tag) error
AddTag adds the given tag to HEAD.
func (*Repository) Checkout ¶ added in v0.0.4
func (r *Repository) Checkout(ref reference.Reference) error
Checkout to commit with the given Identifier.
func (*Repository) Commits ¶
func (r *Repository) Commits() (Commits, error)
Commits returns the commits history of this repository. Commits are ordered from newer to older commits.
func (*Repository) Exec ¶ added in v0.0.4
func (r *Repository) Exec(options ExecOptions, cmd string, args ...string) error
func (*Repository) HeadRef ¶ added in v0.0.4
func (r *Repository) HeadRef() reference.LocalRef
NameRef returns the underlying HEAD reference.
func (*Repository) Mount ¶ added in v0.0.2
func (r *Repository) Mount() (string, error)
Mount mounts the repository and returns the mountpoint.
func (*Repository) Name ¶
func (r *Repository) Name() reference.Name
Name returns the name of the repository.
func (*Repository) OtherHeadTags ¶ added in v0.2.0
func (r *Repository) OtherHeadTags() []reference.Tag
OtherHeadRefs returns other reference to HEAD.
func (*Repository) OtherTags ¶ added in v0.0.4
func (r *Repository) OtherTags() ([]reference.Tag, error)
OtherTags returns tags associated to this repository but not pointing to HEAD.
func (*Repository) RebaseSession ¶ added in v0.1.0
func (r *Repository) RebaseSession(ref reference.Reference) (*RebaseSession, error)
RebaseSession starts and returns a new RebaseSession with the given tag as base reference.
func (*Repository) RebaseSessionByImage ¶ added in v0.2.0
func (r *Repository) RebaseSessionByImage(baseImage *libimage.Image) (*RebaseSession, error)
RebaseSessionByImage starts and returns a new RebaseSession with the given image as new base. An error is returned if the image is not part of the repository.
func (*Repository) ReloadHead ¶ added in v0.0.4
func (r *Repository) ReloadHead() error
ReloadHead reloads underlying HEAD image.
func (*Repository) RemoveTag ¶ added in v0.0.4
func (r *Repository) RemoveTag(tag reference.Tag) error
RemoveTag returns the given tag from HEAD.
func (*Repository) Unmount ¶ added in v0.0.2
func (r *Repository) Unmount() error
Unmount unmount the repository.