ref

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const IteratorPrefetchSize = 1000

IteratorPrefetchSize is the amount of records to maybeFetch from PG

View Source
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

View Source
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 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, 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) *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)
}

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 (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 Manager

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

func NewPGRefManager

func NewPGRefManager(executor batch.Batcher, db db.Database, addressProvider ident.AddressProvider) *Manager

func (*Manager) AddCommit

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

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) CreateTag

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

func (*Manager) DeleteBranch

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

func (*Manager) DeleteRepository

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

func (*Manager) DeleteTag

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

func (*Manager) FillGenerations added in v0.41.1

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

func (*Manager) FindMergeBase

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

func (*Manager) GetBranch

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

func (*Manager) GetCommit

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

func (*Manager) GetCommitByPrefix

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

func (*Manager) GetRepository

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

func (*Manager) GetTag

func (m *Manager) GetTag(ctx context.Context, repositoryID graveler.RepositoryID, tagID graveler.TagID) (*graveler.CommitID, 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 (m *Manager) ListRepositories(ctx context.Context) (graveler.RepositoryIterator, error)

func (*Manager) ListTags

func (m *Manager) ListTags(ctx context.Context, repositoryID graveler.RepositoryID) (graveler.TagIterator, error)

func (*Manager) Log

func (*Manager) ParseRef added in v0.44.1

func (m *Manager) ParseRef(ref graveler.Ref) (graveler.RawRef, 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)

func (*Manager) SetBranch

func (m *Manager) SetBranch(ctx context.Context, repositoryID graveler.RepositoryID, branchID graveler.BranchID, branch graveler.Branch) 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

type RepositoryIterator

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

func NewRepositoryIterator

func NewRepositoryIterator(ctx context.Context, db db.Database, fetchSize int) *RepositoryIterator

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, 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

Jump to

Keyboard shortcuts

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