mvcc

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListEntriesMaxLimit        = 1000
	ListEntriesBranchBatchSize = 32
)
View Source
const (
	MergeBatchSize       = 256
	MergeBatchChanBuffer = 10
)
View Source
const (
	DBScannerDefaultBufferSize      = 4096
	BranchScannerMaxCommitsInFilter = 40
)
View Source
const (
	CommittedID                   CommitID = -1
	UncommittedID                 CommitID = 0
	MaxCommitID                   CommitID = 1_000_000_000_000_000_000
	MinCommitUncommittedIndicator          = MaxCommitID
	TombstoneCommitID             CommitID = 0

	CommittedSuffix = ":HEAD"
	CommitPrefix    = "~"

	InternalObjectRefSeparator = "$"
	InternalObjectRefFormat    = "int:pbm:%s"
	InternalObjectRefParts     = 3
)
View Source
const (
	DirectoryTerminationValue = utf8.MaxRune
	DirectoryTermination      = string(rune(DirectoryTerminationValue))
)
View Source
const DiffMaxLimit = 1000
View Source
const ListBranchesMaxLimit = 10000
View Source
const ListCommitsMaxLimit = 10000
View Source
const ListRepositoriesMaxLimit = 10000
View Source
const (
	MaxReadQueue = 10
)

Variables

View Source
var ErrMinCommitsMismatch = errors.New("MinCommits length mismatch")

Functions

func FormatBranchCommitMessage added in v0.21.1

func FormatBranchCommitMessage(name, source string) string

func IsNonEmptyString

func IsNonEmptyString(s string) bool

func IsValidBranchName

func IsValidBranchName(branch string) bool

func IsValidReference

func IsValidReference(reference string) bool

func IsValidRepositoryName

func IsValidRepositoryName(repository string) bool

func MakeReference

func MakeReference(branch string, commitID CommitID) string

func NewCataloger

func NewCataloger(db db.Database, options ...CatalogerOption) catalog.Cataloger

func ScanDBEntriesUntil

func ScanDBEntriesUntil(s DBScanner, p string) error

func Validate

func Validate(validators ValidateFields) error

Types

type Cache

type Cache interface {
	Repository(repository string, setFn GetRepositoryFn) (*catalog.Repository, error)
	RepositoryID(repository string, setFn GetRepositoryIDFn) (int, error)
	BranchID(repository string, branch string, setFn GetBranchIDFn) (int64, error)
}

type CacheConfig

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

type CatalogerOption

type CatalogerOption func(*cataloger)

func WithCacheEnabled

func WithCacheEnabled(b bool) CatalogerOption

func WithDedupReportChannel

func WithDedupReportChannel(b bool) CatalogerOption

func WithParams

func WithParams(p params.Catalog) CatalogerOption

type CommitID

type CommitID int64

type DBBranchScanner

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

func NewDBBranchScanner

func NewDBBranchScanner(tx db.Tx, branchID int64, commitID, minCommitID CommitID, opts DBScannerOptions) *DBBranchScanner

func (*DBBranchScanner) Err

func (s *DBBranchScanner) Err() error

func (*DBBranchScanner) Next

func (s *DBBranchScanner) Next() bool

func (*DBBranchScanner) SetAdditionalWhere

func (s *DBBranchScanner) SetAdditionalWhere(part sq.Sqlizer)

func (*DBBranchScanner) Value

func (s *DBBranchScanner) Value() *DBScannerEntry

type DBLineageScanner

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

func NewDBLineageScanner

func NewDBLineageScanner(tx db.Tx, branchID int64, commitID CommitID, opts DBLineageScannerOptions) *DBLineageScanner

func (*DBLineageScanner) Err

func (s *DBLineageScanner) Err() error

func (*DBLineageScanner) Next

func (s *DBLineageScanner) Next() bool

func (*DBLineageScanner) ReadLineage

func (s *DBLineageScanner) ReadLineage() ([]lineageCommit, error)

func (*DBLineageScanner) SetAdditionalWhere

func (s *DBLineageScanner) SetAdditionalWhere(part sq.Sqlizer)

func (*DBLineageScanner) Value

func (s *DBLineageScanner) Value() *DBScannerEntry

type DBLineageScannerOptions

type DBLineageScannerOptions struct {
	DBScannerOptions
	Lineage    []lineageCommit
	MinCommits []CommitID
}

type DBScanner

type DBScanner interface {
	Next() bool
	Value() *DBScannerEntry
	Err() error
	SetAdditionalWhere(s sq.Sqlizer)
}

type DBScannerEntry

type DBScannerEntry struct {
	BranchID int64  `db:"branch_id"`
	RowCtid  string `db:"ctid"`
	MinMaxCommit
	catalog.Entry
}

type DBScannerOptions

type DBScannerOptions struct {
	BufferSize       int
	After            string
	AdditionalFields []string
	AdditionalWhere  sq.Sqlizer
}

type DiffScanner

type DiffScanner struct {
	Relation RelationType
	// contains filtered or unexported fields
}

func NewDiffScanner

func NewDiffScanner(tx db.Tx, params doDiffParams) (*DiffScanner, error)

func (*DiffScanner) Error

func (s *DiffScanner) Error() error

func (*DiffScanner) Next

func (s *DiffScanner) Next() bool

func (*DiffScanner) Value

func (s *DiffScanner) Value() *catalog.DiffResultRecord

type DummyCache

type DummyCache struct{}

func (*DummyCache) BranchID

func (c *DummyCache) BranchID(repository string, branch string, setFn GetBranchIDFn) (int64, error)

func (*DummyCache) Repository

func (c *DummyCache) Repository(repository string, setFn GetRepositoryFn) (*catalog.Repository, error)

func (*DummyCache) RepositoryID

func (c *DummyCache) RepositoryID(repository string, setFn GetRepositoryIDFn) (int, error)

type GetBranchIDFn

type GetBranchIDFn func(repository string, branch string) (int64, error)

type GetRepositoryFn

type GetRepositoryFn func(repository string) (*catalog.Repository, error)

type GetRepositoryIDFn

type GetRepositoryIDFn func(repository string) (int, error)

type InternalObjectRef

type InternalObjectRef struct {
	BranchID  int64
	MinCommit CommitID
	Path      string
}

InternalObjectRef provides information that uniquely identifies an object between transactions. It might be invalidated by some database changes.

func ParseInternalObjectRef

func ParseInternalObjectRef(refString string) (InternalObjectRef, error)

func (*InternalObjectRef) String

func (sor *InternalObjectRef) String() string

type LRUCache

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

func NewLRUCache

func NewLRUCache(size int, expiry, jitter time.Duration) *LRUCache

func (*LRUCache) BranchID

func (c *LRUCache) BranchID(repository string, branch string, setFn GetBranchIDFn) (int64, error)

func (*LRUCache) Repository

func (c *LRUCache) Repository(repository string, setFn GetRepositoryFn) (*catalog.Repository, error)

func (*LRUCache) RepositoryID

func (c *LRUCache) RepositoryID(repository string, setFn GetRepositoryIDFn) (int, error)

type LockType

type LockType int
const (
	LockTypeNone LockType = iota
	LockTypeShare
	LockTypeUpdate
)

type MinMaxCommit

type MinMaxCommit struct {
	MinCommit CommitID `db:"min_commit"`
	MaxCommit CommitID `db:"max_commit"`
}

func (MinMaxCommit) ChangedAfterCommit

func (m MinMaxCommit) ChangedAfterCommit(commitID CommitID) bool

func (MinMaxCommit) IsCommitted

func (m MinMaxCommit) IsCommitted() bool

func (MinMaxCommit) IsDeleted

func (m MinMaxCommit) IsDeleted() bool

func (MinMaxCommit) IsTombstone

func (m MinMaxCommit) IsTombstone() bool

type Ref

type Ref struct {
	Branch   string
	CommitID CommitID
}

func ParseRef

func ParseRef(ref string) (*Ref, error)

func (Ref) String

func (r Ref) String() string

type RelationType

type RelationType string
const (
	RelationTypeNone       RelationType = "none"
	RelationTypeFromParent RelationType = "from_parent"
	RelationTypeFromChild  RelationType = "from_child"
	RelationTypeNotDirect  RelationType = "non_direct"
	RelationTypeSame       RelationType = "same"
)

type StringRows

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

func (*StringRows) Close

func (s *StringRows) Close()

func (*StringRows) Err

func (s *StringRows) Err() error

func (*StringRows) Next

func (s *StringRows) Next() bool

func (*StringRows) Read

func (s *StringRows) Read() (string, error)

type ValidateField

type ValidateField struct {
	Name    string
	IsValid ValidateFunc
}

type ValidateFields

type ValidateFields []ValidateField

type ValidateFunc

type ValidateFunc func() bool

func ValidateBranchName

func ValidateBranchName(branch string) ValidateFunc

func ValidateCommitMessage

func ValidateCommitMessage(message string) ValidateFunc

func ValidateCommitter

func ValidateCommitter(name string) ValidateFunc

func ValidateOptionalString

func ValidateOptionalString(s string, validator func(string) bool) ValidateFunc

func ValidatePath

func ValidatePath(name string) ValidateFunc

func ValidatePhysicalAddress

func ValidatePhysicalAddress(addr string) ValidateFunc

func ValidateReference

func ValidateReference(reference string) ValidateFunc

func ValidateRepositoryName

func ValidateRepositoryName(repository string) ValidateFunc

func ValidateStorageNamespace

func ValidateStorageNamespace(storageNamespace string) ValidateFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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