Documentation ¶
Index ¶
- Constants
- Variables
- func FindMergeBase(ctx context.Context, getter CommitGetter, repositoryID graveler.RepositoryID, ...) (*graveler.Commit, error)
- func ParseRef(r graveler.Ref) (graveler.RawRef, error)
- func ResolveRawRef(ctx context.Context, store Store, addressProvider ident.AddressProvider, ...) (*graveler.ResolvedRef, error)
- type BranchIterator
- type BranchIteratorOption
- type BranchLocker
- type CommitGetter
- type CommitIterator
- type CommitsGenerationPriorityQueue
- type Manager
- func (m *Manager) AddCommit(ctx context.Context, repositoryID graveler.RepositoryID, ...) (graveler.CommitID, error)
- func (m *Manager) CreateBareRepository(ctx context.Context, repositoryID graveler.RepositoryID, ...) error
- func (m *Manager) CreateRepository(ctx context.Context, repositoryID graveler.RepositoryID, ...) error
- func (m *Manager) CreateTag(ctx context.Context, repositoryID graveler.RepositoryID, tagID graveler.TagID, ...) error
- func (m *Manager) DeleteBranch(ctx context.Context, repositoryID graveler.RepositoryID, ...) error
- func (m *Manager) DeleteRepository(ctx context.Context, repositoryID graveler.RepositoryID) error
- func (m *Manager) DeleteTag(ctx context.Context, repositoryID graveler.RepositoryID, tagID graveler.TagID) error
- func (m *Manager) FillGenerations(ctx context.Context, repositoryID graveler.RepositoryID) error
- func (m *Manager) FindMergeBase(ctx context.Context, repositoryID graveler.RepositoryID, ...) (*graveler.Commit, error)
- func (m *Manager) GetBranch(ctx context.Context, repositoryID graveler.RepositoryID, ...) (*graveler.Branch, error)
- func (m *Manager) GetCommit(ctx context.Context, repositoryID graveler.RepositoryID, ...) (*graveler.Commit, error)
- func (m *Manager) GetCommitByPrefix(ctx context.Context, repositoryID graveler.RepositoryID, ...) (*graveler.Commit, error)
- func (m *Manager) GetRepository(ctx context.Context, repositoryID graveler.RepositoryID) (*graveler.Repository, error)
- func (m *Manager) GetTag(ctx context.Context, repositoryID graveler.RepositoryID, tagID graveler.TagID) (*graveler.CommitID, error)
- func (m *Manager) ListBranches(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.BranchIterator, error)
- func (m *Manager) ListCommits(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.CommitIterator, error)
- func (m *Manager) ListRepositories(ctx context.Context) (graveler.RepositoryIterator, error)
- func (m *Manager) ListTags(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.TagIterator, error)
- func (m *Manager) Log(ctx context.Context, repositoryID graveler.RepositoryID, ...) (graveler.CommitIterator, error)
- func (m *Manager) ParseRef(ref graveler.Ref) (graveler.RawRef, error)
- func (m *Manager) ResolveRawRef(ctx context.Context, repositoryID graveler.RepositoryID, raw graveler.RawRef) (*graveler.ResolvedRef, error)
- func (m *Manager) SetBranch(ctx context.Context, repositoryID graveler.RepositoryID, ...) error
- type OrderedCommitIterator
- type OrderedCommitIteratorOption
- type RepositoryIterator
- type Store
- type TagIterator
Constants ¶
const IteratorPrefetchSize = 1000
IteratorPrefetchSize is the amount of records to maybeFetch from PG
const MaxBatchDelay = time.Millisecond * 3
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.
Variables ¶
var ErrIteratorClosed = errors.New("iterator already closed")
Functions ¶
func FindMergeBase ¶ added in v0.41.1
func FindMergeBase(ctx context.Context, getter CommitGetter, repositoryID graveler.RepositoryID, 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 ResolveRawRef ¶ added in v0.44.1
func ResolveRawRef(ctx context.Context, store Store, addressProvider ident.AddressProvider, repositoryID graveler.RepositoryID, rawRef graveler.RawRef) (*graveler.ResolvedRef, error)
Types ¶
type BranchIterator ¶
type BranchIterator struct {
// contains filtered or unexported fields
}
func NewBranchIterator ¶
func NewBranchIterator(ctx context.Context, db db.Database, repositoryID graveler.RepositoryID, prefetchSize int, opts ...BranchIteratorOption) *BranchIterator
func (*BranchIterator) Close ¶
func (ri *BranchIterator) Close()
func (*BranchIterator) Err ¶
func (ri *BranchIterator) Err() error
func (*BranchIterator) Next ¶
func (ri *BranchIterator) Next() bool
func (*BranchIterator) SeekGE ¶
func (ri *BranchIterator) SeekGE(id graveler.BranchID)
func (*BranchIterator) Value ¶
func (ri *BranchIterator) Value() *graveler.BranchRecord
type BranchIteratorOption ¶ added in v0.45.1
type BranchIteratorOption func(bi *BranchIterator)
func WithOrderBy ¶ added in v0.45.1
func WithOrderBy(orderByColumn string) BranchIteratorOption
type BranchLocker ¶
type BranchLocker struct {
// contains filtered or unexported fields
}
BranchLocker enforces the branch locking logic with Postgres advisory lock The lock can be held by an arbitrary number of Writers or a single MetadataUpdater.
func NewBranchLocker ¶
func NewBranchLocker(db db.Database) *BranchLocker
func (*BranchLocker) MetadataUpdater ¶
func (l *BranchLocker) MetadataUpdater(ctx context.Context, repositoryID graveler.RepositoryID, branchID graveler.BranchID, lockedFn graveler.BranchLockerFunc) (interface{}, error)
MetadataUpdater tries to lock as committer using a Postgres advisory lock for the span of calling `lockedFn`. It returns ErrLockNotAcquired if it fails to acquire the lock.
func (*BranchLocker) Writer ¶
func (l *BranchLocker) Writer(ctx context.Context, repositoryID graveler.RepositoryID, branchID graveler.BranchID, lockedFn graveler.BranchLockerFunc) (interface{}, error)
Writer tries to acquire a write lock using a Postgres advisory lock for the span of calling `lockedFn`. Returns ErrLockNotAcquired if it cannot acquire the lock.
type CommitGetter ¶
type CommitIterator ¶
type CommitIterator struct {
// contains filtered or unexported fields
}
func NewCommitIterator ¶
func NewCommitIterator(ctx context.Context, db db.Database, repositoryID graveler.RepositoryID, start graveler.CommitID) *CommitIterator
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 a new
The list of commit
func (*CommitIterator) Value ¶
func (ci *CommitIterator) Value() *graveler.CommitRecord
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 (c CommitsGenerationPriorityQueue) Len() int
func (CommitsGenerationPriorityQueue) Less ¶ added in v0.41.1
func (c CommitsGenerationPriorityQueue) Less(i, j int) bool
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 Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewPGRefManager ¶
func (*Manager) CreateBareRepository ¶
func (m *Manager) CreateBareRepository(ctx context.Context, repositoryID graveler.RepositoryID, repository graveler.Repository) error
func (*Manager) CreateRepository ¶
func (m *Manager) CreateRepository(ctx context.Context, repositoryID graveler.RepositoryID, repository graveler.Repository, token graveler.StagingToken) error
func (*Manager) DeleteBranch ¶
func (*Manager) DeleteRepository ¶
func (*Manager) FillGenerations ¶ added in v0.41.1
func (*Manager) FindMergeBase ¶
func (*Manager) GetCommitByPrefix ¶
func (*Manager) GetRepository ¶
func (m *Manager) GetRepository(ctx context.Context, repositoryID graveler.RepositoryID) (*graveler.Repository, error)
func (*Manager) ListBranches ¶
func (m *Manager) ListBranches(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.BranchIterator, error)
func (*Manager) ListCommits ¶
func (m *Manager) ListCommits(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.CommitIterator, error)
func (*Manager) ListRepositories ¶
func (*Manager) ListTags ¶
func (m *Manager) ListTags(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.TagIterator, error)
func (*Manager) Log ¶
func (m *Manager) Log(ctx context.Context, repositoryID graveler.RepositoryID, from graveler.CommitID) (graveler.CommitIterator, error)
func (*Manager) ResolveRawRef ¶ added in v0.44.1
func (m *Manager) ResolveRawRef(ctx context.Context, repositoryID graveler.RepositoryID, raw graveler.RawRef) (*graveler.ResolvedRef, error)
type OrderedCommitIterator ¶
type OrderedCommitIterator struct {
// contains filtered or unexported fields
}
func NewOrderedCommitIterator ¶
func NewOrderedCommitIterator(ctx context.Context, database db.Database, repositoryID graveler.RepositoryID, prefetchSize int, opts ...OrderedCommitIteratorOption) *OrderedCommitIterator
NewOrderedCommitIterator returns an iterator over all commits in the given repository. Ordering is based on the Commit ID value.
func (*OrderedCommitIterator) Close ¶
func (iter *OrderedCommitIterator) Close()
func (*OrderedCommitIterator) Err ¶
func (iter *OrderedCommitIterator) Err() error
func (*OrderedCommitIterator) Next ¶
func (iter *OrderedCommitIterator) Next() bool
func (*OrderedCommitIterator) SeekGE ¶
func (iter *OrderedCommitIterator) SeekGE(id graveler.CommitID)
func (*OrderedCommitIterator) Value ¶
func (iter *OrderedCommitIterator) Value() *graveler.CommitRecord
type OrderedCommitIteratorOption ¶ added in v0.45.1
type OrderedCommitIteratorOption func(oci *OrderedCommitIterator)
func WithOnlyAncestryLeaves ¶ added in v0.45.1
func WithOnlyAncestryLeaves() OrderedCommitIteratorOption
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.
type RepositoryIterator ¶
type RepositoryIterator struct {
// contains filtered or unexported fields
}
func NewRepositoryIterator ¶
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 ¶
func (ri *RepositoryIterator) Value() *graveler.RepositoryRecord
type Store ¶
type Store interface { GetBranch(ctx context.Context, repositoryID graveler.RepositoryID, branchID graveler.BranchID) (*graveler.Branch, error) GetTag(ctx context.Context, repositoryID graveler.RepositoryID, tagID graveler.TagID) (*graveler.CommitID, error) GetCommitByPrefix(ctx context.Context, repositoryID graveler.RepositoryID, prefix graveler.CommitID) (*graveler.Commit, error) GetCommit(ctx context.Context, repositoryID graveler.RepositoryID, prefix graveler.CommitID) (*graveler.Commit, error) }
type TagIterator ¶
type TagIterator struct {
// contains filtered or unexported fields
}
func NewTagIterator ¶
func NewTagIterator(ctx context.Context, db db.Database, repositoryID graveler.RepositoryID, fetchSize int) *TagIterator
func (*TagIterator) Close ¶
func (ri *TagIterator) Close()
func (*TagIterator) Err ¶
func (ri *TagIterator) Err() error
func (*TagIterator) Next ¶
func (ri *TagIterator) Next() bool
func (*TagIterator) SeekGE ¶
func (ri *TagIterator) SeekGE(id graveler.TagID)
func (*TagIterator) Value ¶
func (ri *TagIterator) Value() *graveler.TagRecord