Documentation ¶
Index ¶
- Variables
- type ObjectPool
- func Create(ctx context.Context, locator storage.Locator, gitCmdFactory git.CommandFactory, ...) (*ObjectPool, error)
- func FromProto(locator storage.Locator, gitCmdFactory git.CommandFactory, ...) (*ObjectPool, error)
- func FromRepo(locator storage.Locator, gitCmdFactory git.CommandFactory, ...) (*ObjectPool, error)
- func (o *ObjectPool) Exists() bool
- func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *localrepo.Repo) error
- func (o *ObjectPool) IsValid() bool
- func (o *ObjectPool) Link(ctx context.Context, repo *localrepo.Repo) (returnedErr error)
- func (o *ObjectPool) LinkedToRepository(repo *localrepo.Repo) (bool, error)
- func (o *ObjectPool) Remove(ctx context.Context) (err error)
- func (o *ObjectPool) ToProto() *gitalypb.ObjectPool
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidPoolDir is returned when the object pool relative path is malformed. ErrInvalidPoolDir = errors.New("invalid object pool directory") // ErrInvalidPoolRepository indicates the directory the alternates file points to is not a valid git repository ErrInvalidPoolRepository = errors.New("object pool is not a valid git repository") // ErrAlternateObjectDirNotExist indicates a repository does not have an alternates file ErrAlternateObjectDirNotExist = errors.New("no alternates directory exists") )
Functions ¶
This section is empty.
Types ¶
type ObjectPool ¶
ObjectPool are a way to de-dupe objects between repositories, where the objects live in a pool in a distinct repository which is used as an alternate object store for other repositories.
func Create ¶ added in v15.7.0
func Create( ctx context.Context, locator storage.Locator, gitCmdFactory git.CommandFactory, catfileCache catfile.Cache, txManager transaction.Manager, housekeepingManager housekeeping.Manager, proto *gitalypb.ObjectPool, sourceRepo *localrepo.Repo, ) (*ObjectPool, error)
Create creates an object pool for the given source repository. This is done by creating a local clone of the source repository where source and target repository will then have the same references afterwards.
The source repository will not join the object pool. Thus, its objects won't get deduplicated.
func FromProto ¶
func FromProto( locator storage.Locator, gitCmdFactory git.CommandFactory, catfileCache catfile.Cache, txManager transaction.Manager, housekeepingManager housekeeping.Manager, proto *gitalypb.ObjectPool, ) (*ObjectPool, error)
FromProto returns an object pool object from its Protobuf representation. This function verifies that the object pool exists and is a valid pool repository.
func FromRepo ¶
func FromRepo( locator storage.Locator, gitCmdFactory git.CommandFactory, catfileCache catfile.Cache, txManager transaction.Manager, housekeepingManager housekeeping.Manager, repo *localrepo.Repo, ) (*ObjectPool, error)
FromRepo returns an instance of ObjectPool that the repository points to
func (*ObjectPool) Exists ¶
func (o *ObjectPool) Exists() bool
Exists will return true if the pool path exists and is a directory
func (*ObjectPool) FetchFromOrigin ¶
FetchFromOrigin initializes the pool and fetches the objects from its origin repository
func (*ObjectPool) IsValid ¶
func (o *ObjectPool) IsValid() bool
IsValid checks if a repository exists, and if its valid.
func (*ObjectPool) Link ¶
Link will link the given repository to the object pool. This is done by writing the object pool's path relative to the repository into the repository's "alternates" file. This does not trigger deduplication, which is the responsibility of the caller.
func (*ObjectPool) LinkedToRepository ¶
func (o *ObjectPool) LinkedToRepository(repo *localrepo.Repo) (bool, error)
LinkedToRepository tests if a repository is linked to an object pool
func (*ObjectPool) Remove ¶
func (o *ObjectPool) Remove(ctx context.Context) (err error)
Remove will remove the pool, and all its contents without preparing and/or updating the repositories depending on this object pool Subdirectories will remain to exist, and will never be cleaned up, even when these are empty.
func (*ObjectPool) ToProto ¶
func (o *ObjectPool) ToProto() *gitalypb.ObjectPool
ToProto returns a new struct that is the protobuf definition of the ObjectPool