ref

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxBatchDelay - 3ms was chosen as a max delay time for critical path queries.
	// It trades off amount of queries per second (and thus effectiveness of the batching mechanism) with added latency.
	// Since reducing # of expensive operations is only beneficial when there are a lot of concurrent requests,
	//
	//	the sweet spot is probably between 1-5 milliseconds (representing 200-1000 requests/second to the data store).
	//
	// 3ms of delay with ~300 requests/second per resource sounds like a reasonable tradeoff.
	MaxBatchDelay = 3 * time.Millisecond

	// LinkAddressTime the time address is valid from get to link
	LinkAddressTime = 6 * time.Hour
	// ImportExpiryTime Expiry time to remove imports from ref-store
	ImportExpiryTime = 24 * time.Hour
)

Variables

View Source
var ErrIteratorClosed = errors.New("iterator already closed")

Functions

func CommitDataToCommitRecord added in v0.70.0

func CommitDataToCommitRecord(c *graveler.CommitData) *graveler.CommitRecord

func FindMergeBase added in v0.41.1

func FindMergeBase(ctx context.Context, getter CommitGetter, repository *graveler.RepositoryRecord, leftID, rightID graveler.CommitID) (*graveler.Commit, error)

FindMergeBase finds the best common ancestor according to the definition in the git-merge-base documentation: https://git-scm.com/docs/git-merge-base One common ancestor is better than another common ancestor if the latter is an ancestor of the former.

func ParseRef added in v0.44.1

func ParseRef(r graveler.Ref) (graveler.RawRef, error)

func ResolveRawRef added in v0.44.1

func ResolveRawRef(ctx context.Context, store Store, addressProvider ident.AddressProvider, repository *graveler.RepositoryRecord, rawRef graveler.RawRef) (*graveler.ResolvedRef, error)

Types

type BranchByCommitIterator added in v0.70.0

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

BranchByCommitIterator iterates over repository's branches ordered by Commit ID. Currently, implemented as in-mem iterator

func NewBranchByCommitIterator added in v0.70.0

func NewBranchByCommitIterator(ctx context.Context, store kv.Store, repo *graveler.RepositoryRecord) (*BranchByCommitIterator, error)

func (*BranchByCommitIterator) Close added in v0.70.0

func (b *BranchByCommitIterator) Close()

func (*BranchByCommitIterator) Err added in v0.70.0

func (b *BranchByCommitIterator) Err() error

func (*BranchByCommitIterator) Next added in v0.70.0

func (b *BranchByCommitIterator) Next() bool

func (*BranchByCommitIterator) SeekGE added in v0.70.0

func (*BranchByCommitIterator) SortByCommitID added in v0.70.0

func (b *BranchByCommitIterator) SortByCommitID(i, j int) bool

func (*BranchByCommitIterator) Value added in v0.70.0

type BranchSimpleIterator added in v0.70.0

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

BranchSimpleIterator Iterates over repository's branches in a sorted way, since the branches are already sorted in DB according to BranchID

func NewBranchSimpleIterator added in v0.70.0

func NewBranchSimpleIterator(ctx context.Context, store kv.Store, repo *graveler.RepositoryRecord) (*BranchSimpleIterator, error)

func (*BranchSimpleIterator) Close added in v0.70.0

func (bi *BranchSimpleIterator) Close()

func (*BranchSimpleIterator) Err added in v0.70.0

func (bi *BranchSimpleIterator) Err() error

func (*BranchSimpleIterator) Next added in v0.70.0

func (bi *BranchSimpleIterator) Next() bool

func (*BranchSimpleIterator) SeekGE added in v0.70.0

func (bi *BranchSimpleIterator) SeekGE(id graveler.BranchID)

func (*BranchSimpleIterator) Value added in v0.70.0

type CacheConfig added in v0.84.0

type CacheConfig struct {
	Size   int
	Expiry time.Duration
	Jitter time.Duration
}

type CommitGetter

type CommitGetter interface {
	GetCommit(ctx context.Context, repository *graveler.RepositoryRecord, commitID graveler.CommitID) (*graveler.Commit, error)
}

type CommitIterator

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

func NewCommitIterator

func NewCommitIterator(ctx context.Context, config *CommitIteratorConfig) *CommitIterator

NewCommitIterator returns an iterator over all commits in the given repository. Ordering is based on the Commit Creation Date.

func (*CommitIterator) Close

func (ci *CommitIterator) Close()

func (*CommitIterator) Err

func (ci *CommitIterator) Err() error

func (*CommitIterator) Next

func (ci *CommitIterator) Next() bool

func (*CommitIterator) SeekGE

func (ci *CommitIterator) SeekGE(id graveler.CommitID)

SeekGE skip under the point of 'id' commit ID based on a new

The list of commit

func (*CommitIterator) Value

func (ci *CommitIterator) Value() *graveler.CommitRecord

type CommitIteratorConfig added in v0.100.0

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

type CommitsGenerationPriorityQueue added in v0.41.1

type CommitsGenerationPriorityQueue []*graveler.CommitRecord

CommitsGenerationPriorityQueue implements heap.Interface such that the commit with the greatest Generation value is at the root of the heap.

func NewCommitsGenerationPriorityQueue added in v0.41.1

func NewCommitsGenerationPriorityQueue() CommitsGenerationPriorityQueue

func (CommitsGenerationPriorityQueue) Len added in v0.41.1

func (CommitsGenerationPriorityQueue) Less added in v0.41.1

func (*CommitsGenerationPriorityQueue) Pop added in v0.41.1

func (c *CommitsGenerationPriorityQueue) Pop() interface{}

func (*CommitsGenerationPriorityQueue) Push added in v0.41.1

func (c *CommitsGenerationPriorityQueue) Push(x interface{})

func (CommitsGenerationPriorityQueue) Swap added in v0.41.1

func (c CommitsGenerationPriorityQueue) Swap(i, j int)

type CompareFunc added in v0.70.0

type CompareFunc func(i, j int) bool

CompareFunc type used for sorting in InMemIterator, it is a strictly bigger comparison function required for the sort.Slice algorithm, implementors need to decide how to handle equal values

type LinkAddressIterator added in v0.112.0

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

LinkAddressIterator Iterates over repository's link addresses

func NewLinkAddressIterator added in v0.112.0

func NewLinkAddressIterator(ctx context.Context, store kv.Store, repo *graveler.RepositoryRecord) (*LinkAddressIterator, error)

func (*LinkAddressIterator) Close added in v0.112.0

func (i *LinkAddressIterator) Close()

func (*LinkAddressIterator) Err added in v0.112.0

func (i *LinkAddressIterator) Err() error

func (*LinkAddressIterator) Next added in v0.112.0

func (i *LinkAddressIterator) Next() bool

func (*LinkAddressIterator) SeekGE added in v0.112.0

func (i *LinkAddressIterator) SeekGE(address string)

func (*LinkAddressIterator) Value added in v0.112.0

type Manager

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

func NewRefManager added in v0.89.0

func NewRefManager(cfg ManagerConfig) *Manager

func (*Manager) AddCommit

func (m *Manager) AddCommit(ctx context.Context, repository *graveler.RepositoryRecord, commit graveler.Commit) (graveler.CommitID, error)

func (*Manager) BranchUpdate added in v0.89.0

func (m *Manager) BranchUpdate(ctx context.Context, repository *graveler.RepositoryRecord, branchID graveler.BranchID, f graveler.BranchUpdateFunc) error

func (*Manager) CreateBareRepository

func (m *Manager) CreateBareRepository(ctx context.Context, repositoryID graveler.RepositoryID, repository graveler.Repository) (*graveler.RepositoryRecord, error)

func (*Manager) CreateBranch added in v0.54.0

func (m *Manager) CreateBranch(ctx context.Context, repository *graveler.RepositoryRecord, branchID graveler.BranchID, branch graveler.Branch) error

func (*Manager) CreateCommitRecord added in v1.9.0

func (m *Manager) CreateCommitRecord(ctx context.Context, repository *graveler.RepositoryRecord, commitID graveler.CommitID, commit graveler.Commit) error

func (*Manager) CreateRepository

func (m *Manager) CreateRepository(ctx context.Context, repositoryID graveler.RepositoryID, repository graveler.Repository) (*graveler.RepositoryRecord, error)

func (*Manager) CreateTag

func (m *Manager) CreateTag(ctx context.Context, repository *graveler.RepositoryRecord, tagID graveler.TagID, commitID graveler.CommitID) error

func (*Manager) DeleteBranch

func (m *Manager) DeleteBranch(ctx context.Context, repository *graveler.RepositoryRecord, branchID graveler.BranchID) error

func (*Manager) DeleteExpiredImports added in v0.102.0

func (m *Manager) DeleteExpiredImports(ctx context.Context, repository *graveler.RepositoryRecord) error

func (*Manager) DeleteExpiredLinkAddresses added in v0.90.0

func (m *Manager) DeleteExpiredLinkAddresses(ctx context.Context, repository *graveler.RepositoryRecord) error

DeleteExpiredLinkAddresses delete expired link addresses from kv store. This call uses limiter to access kv, assuming the call does in the background.

func (*Manager) DeleteRepository

func (m *Manager) DeleteRepository(ctx context.Context, repositoryID graveler.RepositoryID, opts ...graveler.SetOptionsFunc) error

func (*Manager) DeleteTag

func (m *Manager) DeleteTag(ctx context.Context, repository *graveler.RepositoryRecord, tagID graveler.TagID) error

func (*Manager) FindMergeBase

func (m *Manager) FindMergeBase(ctx context.Context, repository *graveler.RepositoryRecord, commitIDs ...graveler.CommitID) (*graveler.Commit, error)

func (*Manager) GCBranchIterator added in v0.89.0

func (m *Manager) GCBranchIterator(ctx context.Context, repository *graveler.RepositoryRecord) (graveler.BranchIterator, error)

func (*Manager) GCCommitIterator added in v0.89.0

func (m *Manager) GCCommitIterator(ctx context.Context, repository *graveler.RepositoryRecord) (graveler.CommitIterator, error)

func (*Manager) GetBranch

func (m *Manager) GetBranch(ctx context.Context, repository *graveler.RepositoryRecord, branchID graveler.BranchID) (*graveler.Branch, error)

func (*Manager) GetCommit

func (m *Manager) GetCommit(ctx context.Context, repository *graveler.RepositoryRecord, commitID graveler.CommitID) (*graveler.Commit, error)

func (*Manager) GetCommitByPrefix

func (m *Manager) GetCommitByPrefix(ctx context.Context, repository *graveler.RepositoryRecord, prefix graveler.CommitID) (*graveler.Commit, error)

func (*Manager) GetRepository

func (m *Manager) GetRepository(ctx context.Context, repositoryID graveler.RepositoryID) (*graveler.RepositoryRecord, error)

func (*Manager) GetRepositoryMetadata added in v0.104.0

func (m *Manager) GetRepositoryMetadata(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.RepositoryMetadata, error)

func (*Manager) GetTag

func (m *Manager) GetTag(ctx context.Context, repository *graveler.RepositoryRecord, tagID graveler.TagID) (*graveler.CommitID, error)

func (*Manager) IsLinkAddressExpired added in v0.90.0

func (m *Manager) IsLinkAddressExpired(linkAddress *graveler.LinkAddressData) (bool, error)

func (*Manager) ListBranches

func (m *Manager) ListBranches(ctx context.Context, repository *graveler.RepositoryRecord) (graveler.BranchIterator, error)

func (*Manager) ListCommits

func (m *Manager) ListCommits(ctx context.Context, repository *graveler.RepositoryRecord) (graveler.CommitIterator, error)

func (*Manager) ListLinkAddresses added in v0.90.0

func (m *Manager) ListLinkAddresses(ctx context.Context, repository *graveler.RepositoryRecord) (graveler.LinkAddressIterator, error)

func (*Manager) ListRepositories

func (m *Manager) ListRepositories(ctx context.Context) (graveler.RepositoryIterator, error)

func (*Manager) ListTags

func (m *Manager) ListTags(ctx context.Context, repository *graveler.RepositoryRecord) (graveler.TagIterator, error)

func (*Manager) Log

func (m *Manager) Log(ctx context.Context, repository *graveler.RepositoryRecord, from graveler.CommitID, firstParent bool, since *time.Time) (graveler.CommitIterator, error)

func (*Manager) ParseRef added in v0.44.1

func (m *Manager) ParseRef(ref graveler.Ref) (graveler.RawRef, error)

func (*Manager) RemoveCommit added in v0.89.0

func (m *Manager) RemoveCommit(ctx context.Context, repository *graveler.RepositoryRecord, commitID graveler.CommitID) error

func (*Manager) ResolveRawRef added in v0.44.1

func (m *Manager) ResolveRawRef(ctx context.Context, repository *graveler.RepositoryRecord, raw graveler.RawRef) (*graveler.ResolvedRef, error)

func (*Manager) SetBranch

func (m *Manager) SetBranch(ctx context.Context, repository *graveler.RepositoryRecord, branchID graveler.BranchID, branch graveler.Branch) error

func (*Manager) SetLinkAddress added in v0.90.0

func (m *Manager) SetLinkAddress(ctx context.Context, repository *graveler.RepositoryRecord, physicalAddress string) error

func (*Manager) SetRepositoryMetadata added in v0.104.0

func (m *Manager) SetRepositoryMetadata(ctx context.Context, repo *graveler.RepositoryRecord, updateFunc graveler.RepoMetadataUpdateFunc) error

func (*Manager) VerifyLinkAddress added in v0.90.0

func (m *Manager) VerifyLinkAddress(ctx context.Context, repository *graveler.RepositoryRecord, physicalAddress string) error

type ManagerConfig added in v0.84.0

type ManagerConfig struct {
	Executor              batch.Batcher
	KVStore               kv.Store
	KVStoreLimited        kv.Store
	AddressProvider       ident.AddressProvider
	RepositoryCacheConfig CacheConfig
	CommitCacheConfig     CacheConfig
}

type OrderedCommitIterator

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

func NewOrderedCommitIterator

func NewOrderedCommitIterator(ctx context.Context, store kv.Store, repo *graveler.RepositoryRecord, onlyAncestryLeaves bool) (*OrderedCommitIterator, error)

NewOrderedCommitIterator returns an iterator over all commits in the given repository. Ordering is based on the Commit ID value. WithOnlyAncestryLeaves causes the iterator to return only commits which are not the first parent of any other commit. Consider a commit graph where all non-first-parent edges are removed. This graph is a tree, and ancestry leaves are its leaves.

func (*OrderedCommitIterator) Close

func (i *OrderedCommitIterator) Close()

func (*OrderedCommitIterator) Err

func (i *OrderedCommitIterator) Err() error

func (*OrderedCommitIterator) Next

func (i *OrderedCommitIterator) Next() bool

func (*OrderedCommitIterator) SeekGE

func (i *OrderedCommitIterator) SeekGE(id graveler.CommitID)

func (*OrderedCommitIterator) Value

type RepositoryIterator

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

func NewRepositoryIterator

func NewRepositoryIterator(ctx context.Context, store kv.Store) (*RepositoryIterator, error)

func (*RepositoryIterator) Close

func (ri *RepositoryIterator) Close()

func (*RepositoryIterator) Err

func (ri *RepositoryIterator) Err() error

func (*RepositoryIterator) Next

func (ri *RepositoryIterator) Next() bool

func (*RepositoryIterator) SeekGE

func (ri *RepositoryIterator) SeekGE(id graveler.RepositoryID)

func (*RepositoryIterator) Value

type Store

type Store interface {
	GetBranch(ctx context.Context, repository *graveler.RepositoryRecord, branchID graveler.BranchID) (*graveler.Branch, error)
	GetTag(ctx context.Context, repository *graveler.RepositoryRecord, tagID graveler.TagID) (*graveler.CommitID, error)
	GetCommitByPrefix(ctx context.Context, repository *graveler.RepositoryRecord, prefix graveler.CommitID) (*graveler.Commit, error)
	GetCommit(ctx context.Context, repository *graveler.RepositoryRecord, prefix graveler.CommitID) (*graveler.Commit, error)
}

type TagIterator

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

func NewTagIterator

func NewTagIterator(ctx context.Context, store kv.Store, repo *graveler.RepositoryRecord) (*TagIterator, error)

func (*TagIterator) Close

func (i *TagIterator) Close()

func (*TagIterator) Err

func (i *TagIterator) Err() error

func (*TagIterator) Next

func (i *TagIterator) Next() bool

func (*TagIterator) SeekGE

func (i *TagIterator) SeekGE(id graveler.TagID)

func (*TagIterator) Value

func (i *TagIterator) Value() *graveler.TagRecord

Jump to

Keyboard shortcuts

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