Documentation
¶
Index ¶
- Constants
- Variables
- func FindLowestCommonAncestor(ctx context.Context, getter CommitGetter, ...) (*graveler.Commit, error)
- func ResolveRef(ctx context.Context, store Store, addressProvider ident.AddressProvider, ...) (graveler.Reference, error)
- type BranchIterator
- type BranchLocker
- type CommitGetter
- type CommitIterator
- type CommitWalker
- 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) 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) RevParse(ctx context.Context, repositoryID graveler.RepositoryID, ref graveler.Ref) (graveler.Reference, error)
- func (m *Manager) SetBranch(ctx context.Context, repositoryID graveler.RepositoryID, ...) error
- type OrderedCommitIterator
- type ParsedRev
- type RepositoryIterator
- type RevModType
- type RevModifier
- type Store
- type TagIterator
Constants ¶
const IteratorPrefetchSize = 1000
IteratorPrefetchSize is the amount of records to maybeFetch from PG
const MaxBatchDelay = time.Millisecond * 3
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 FindLowestCommonAncestor ¶
func FindLowestCommonAncestor(ctx context.Context, getter CommitGetter, addressProvider ident.AddressProvider, repositoryID graveler.RepositoryID, left, right graveler.CommitID) (*graveler.Commit, error)
func ResolveRef ¶
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) *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 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 CommitGetter interface {
GetCommit(ctx context.Context, repositoryID graveler.RepositoryID, commitID graveler.CommitID) (*graveler.Commit, error)
}
taken from history: https://github.com/treeverse/lakeFS/blob/606bf07969c14a569a60efe9c92831f424fa7f36/index/dag/commit_iterator.go
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 CommitWalker ¶
type CommitWalker struct {
// contains filtered or unexported fields
}
func NewCommitWalker ¶
func NewCommitWalker(ctx context.Context, getter CommitGetter, repositoryID graveler.RepositoryID, startID graveler.CommitID) *CommitWalker
func (*CommitWalker) Err ¶
func (w *CommitWalker) Err() error
func (*CommitWalker) Next ¶
func (w *CommitWalker) Next() bool
func (*CommitWalker) Value ¶
func (w *CommitWalker) Value() *graveler.Commit
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) 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)
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) (*OrderedCommitIterator, error)
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 ParsedRev ¶
type ParsedRev struct { BaseRev string Modifiers []RevModifier }
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 RevModifier ¶
type RevModifier struct { Type RevModType Value int }
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