ref

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 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

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 FindLowestCommonAncestor

func FindLowestCommonAncestor(ctx context.Context, getter CommitGetter, addressProvider ident.AddressProvider, repositoryID graveler.RepositoryID, left, right graveler.CommitID) (*graveler.Commit, error)

func ResolveRef

func ResolveRef(ctx context.Context, store Store, addressProvider ident.AddressProvider, repositoryID graveler.RepositoryID, ref graveler.Ref) (graveler.Reference, 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 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 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) 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) RevParse

func (m *Manager) RevParse(ctx context.Context, repositoryID graveler.RepositoryID, ref graveler.Ref) (graveler.Reference, 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 ParsedRev

type ParsedRev struct {
	BaseRev   string
	Modifiers []RevModifier
}

func RevParse

func RevParse(r graveler.Ref) (ParsedRev, error)

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 RevModType

type RevModType uint8
const (
	RevModTypeTilde RevModType = iota
	RevModTypeCaret
)

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

Jump to

Keyboard shortcuts

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