graveler

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BranchUpdateMaxInterval = 5 * time.Second
	BranchUpdateMaxTries    = 10

	DeleteKeysMaxSize = 1000

	// BranchWriteMaxTries is the number of times to repeat the set operation if the staging token changed
	BranchWriteMaxTries = 3

	RepoMetadataUpdateMaxInterval    = 5 * time.Second
	RepoMetadataUpdateMaxElapsedTime = 15 * time.Second
	RepoMetadataUpdateRandomFactor   = 0.5
)
View Source
const (
	MergeStrategyNone MergeStrategy = iota
	MergeStrategyDest
	MergeStrategySrc
	MergeStrategyNoneStr     = "default"
	MergeStrategyDestWinsStr = "dest-wins"
	MergeStrategySrcWinsStr  = "source-wins"

	MergeStrategyMetadataKey = ".lakefs.merge.strategy"
)
View Source
const (
	EntityTypeKey    = "entity"
	EntityTypeCommit = "commit"
	EntityTypeBranch = "branch"
	EntityTypeTag    = "tag"

	EntitySchemaKey    = "schema_name"
	EntitySchemaCommit = "io.treeverse.lakefs.graveler.CommitData"
	EntitySchemaBranch = "io.treeverse.lakefs.graveler.BranchData"
	EntitySchemaTag    = "io.treeverse.lakefs.graveler.TagData"

	EntitySchemaDefinitionKey = "schema_definition"
)
View Source
const FirstCommitMsg = "Repository created"

FirstCommitMsg is the message of the first (zero) commit of a lakeFS repository

View Source
const MetadataKeyLastImportTimeStamp = ".lakefs.last.import.timestamp"

Variables

View Source
var (
	// ErrUserVisible is base error for "user-visible" errors, which should not be wrapped with internal debug info.
	ErrUserVisible = errors.New("")

	ErrNotFound                     = wrapError(ErrUserVisible, "not found")
	ErrNotUnique                    = wrapError(ErrUserVisible, "not unique")
	ErrPreconditionFailed           = errors.New("precondition failed")
	ErrProtectedBranch              = errors.New("protected branch")
	ErrWriteToProtectedBranch       = wrapError(ErrProtectedBranch, "cannot write to protected branch")
	ErrReadingFromStore             = errors.New("cannot read from store")
	ErrCommitToProtectedBranch      = wrapError(ErrProtectedBranch, "cannot commit to protected branch")
	ErrInvalidValue                 = fmt.Errorf("invalid value: %w", ErrInvalid)
	ErrInvalidMergeBase             = fmt.Errorf("only 2 commits allowed in FindMergeBase: %w", ErrInvalidValue)
	ErrNoCommitGeneration           = errors.New("no commit generation")
	ErrNoMergeBase                  = errors.New("no merge base")
	ErrInvalidMergeStrategy         = wrapError(ErrUserVisible, "invalid merge strategy")
	ErrInvalidRef                   = fmt.Errorf("ref: %w", ErrInvalidValue)
	ErrInvalidCommitID              = fmt.Errorf("commit id: %w", ErrInvalidValue)
	ErrInvalidBranchID              = fmt.Errorf("branch id: %w", ErrInvalidValue)
	ErrInvalidTagID                 = fmt.Errorf("tag id: %w", ErrInvalidValue)
	ErrInvalid                      = errors.New("validation error")
	ErrInvalidType                  = fmt.Errorf("invalid type: %w", ErrInvalid)
	ErrInvalidRepositoryID          = fmt.Errorf("repository id: %w", ErrInvalidValue)
	ErrRequiredValue                = fmt.Errorf("required value: %w", ErrInvalid)
	ErrCommitNotFound               = fmt.Errorf("commit %w", ErrNotFound)
	ErrCreateBranchNoCommit         = fmt.Errorf("can't create a branch without commit")
	ErrRepositoryNotFound           = fmt.Errorf("repository %w", ErrNotFound)
	ErrRepositoryInDeletion         = errors.New("repository in deletion")
	ErrBranchNotFound               = fmt.Errorf("branch %w", ErrNotFound)
	ErrTagNotFound                  = fmt.Errorf("tag %w", ErrNotFound)
	ErrNoChanges                    = wrapError(ErrUserVisible, "no changes")
	ErrConflictFound                = wrapError(ErrUserVisible, "conflict found")
	ErrBranchExists                 = fmt.Errorf("branch already exists: %w", ErrNotUnique)
	ErrTagAlreadyExists             = fmt.Errorf("tag already exists: %w", ErrNotUnique)
	ErrLinkAddressAlreadyExists     = fmt.Errorf("address token already exists: %w", ErrNotUnique)
	ErrCommitAlreadyExists          = fmt.Errorf("commit already exists: %w", ErrNotUnique)
	ErrLinkAddressNotFound          = fmt.Errorf("address token %w", ErrNotFound)
	ErrLinkAddressExpired           = errors.New("address token has expired")
	ErrDirtyBranch                  = wrapError(ErrUserVisible, "uncommitted changes (dirty branch)")
	ErrMetaRangeNotFound            = errors.New("metarange not found")
	ErrLockNotAcquired              = errors.New("lock not acquired")
	ErrRevertMergeNoParent          = wrapError(ErrUserVisible, "must specify 1-based parent number for reverting merge commit")
	ErrCherryPickMergeNoParent      = wrapError(ErrUserVisible, "must specify 1-based parent number for cherry-picking merge commit")
	ErrAddCommitNoParent            = errors.New("added commit must have a parent")
	ErrMultipleParents              = errors.New("cannot have more than a single parent")
	ErrParentOutOfRange             = errors.New("given commit does not have the given parent number")
	ErrDereferenceCommitWithStaging = wrapError(ErrUserVisible, "reference to staging area with $ is not a commit")
	ErrDeleteDefaultBranch          = wrapError(ErrUserVisible, "cannot delete repository default branch")
	ErrCommitMetaRangeDirtyBranch   = wrapError(ErrUserVisible, "cannot use source MetaRange on a branch with uncommitted changes")
	ErrTooManyTries                 = errors.New("too many tries")
	ErrSkipValueUpdate              = errors.New("skip value update")
	ErrImport                       = wrapError(ErrUserVisible, "import error")
	ErrReadOnlyRepository           = wrapError(ErrUserVisible, "read-only repository")
)

Define errors we raise from this package - do not convert underlying errors, optionally wrap if needed to consolidate

View Source
var (
	RepositoryState_name = map[int32]string{
		0: "ACTIVE",
		1: "IN_DELETION",
	}
	RepositoryState_value = map[string]int32{
		"ACTIVE":      0,
		"IN_DELETION": 1,
	}
)

Enum value maps for RepositoryState.

View Source
var (
	BranchProtectionBlockedAction_name = map[int32]string{
		0: "STAGING_WRITE",
		1: "COMMIT",
	}
	BranchProtectionBlockedAction_value = map[string]int32{
		"STAGING_WRITE": 0,
		"COMMIT":        1,
	}
)

Enum value maps for BranchProtectionBlockedAction.

View Source
var File_graveler_graveler_proto protoreflect.FileDescriptor

Functions

func BranchPath added in v0.70.0

func BranchPath(branchID BranchID) string

func CleanupTokensPartition added in v0.70.1

func CleanupTokensPartition() string

func CommitExists added in v0.70.0

func CommitExists(ctx context.Context, repository *RepositoryRecord, commitID CommitID, manager RefManager) (bool, error)

func CommitPath added in v0.70.0

func CommitPath(commitID CommitID) string

func ImportsPath added in v0.102.0

func ImportsPath(key string) string

func LinkedAddressPath added in v0.90.0

func LinkedAddressPath(key string) string

func NewMapDeleteErrors added in v0.82.0

func NewMapDeleteErrors(err error) map[string]error

NewMapDeleteErrors map multi error holding DeleteError to a map of object key -> error

func NewRepoInstanceID added in v0.70.0

func NewRepoInstanceID() string

NewRepoInstanceID Returns a new unique identifier for the repository instance

func NewRunID

func NewRunID() string

func RepoMetadataPath added in v0.104.0

func RepoMetadataPath() string

func RepoPartition added in v0.70.0

func RepoPartition(repo *RepositoryRecord) string

RepoPartition - The partition under which all the repository's entities (branched, commits, tags) The Repository object itself is found under the common RepositoriesPartition, as it is needed to generate this partition

func RepoPath added in v0.70.0

func RepoPath(repoID RepositoryID) string

func RepositoriesPartition added in v0.70.0

func RepositoriesPartition() string

RepositoriesPartition - The common partition under which all repositories exist

func SettingsPath added in v0.70.1

func SettingsPath(key string) string

func StagingTokenPartition added in v0.70.0

func StagingTokenPartition(token StagingToken) string

func TagPath added in v0.69.1

func TagPath(tagID TagID) string

func UpperBoundForPrefix

func UpperBoundForPrefix(prefix []byte) []byte

UpperBoundForPrefix returns, given a prefix `p`, a slice 'q' such that a byte slice `s` starts with `p` if and only if p <= s < q. Namely, it returns an exclusive upper bound for the set of all byte arrays that start with this prefix. It returns nil if there is no such byte slice because all bytes of `p` are maximal.

func ValidateBranchID added in v0.58.1

func ValidateBranchID(v interface{}) error

func ValidateRef added in v0.58.1

func ValidateRef(v interface{}) error

func ValidateRepositoryID added in v0.58.1

func ValidateRepositoryID(v interface{}) error

func ValidateRequiredStrategy added in v0.61.0

func ValidateRequiredStrategy(v interface{}) error

func ValidateStorageNamespace added in v0.58.1

func ValidateStorageNamespace(v interface{}) error

func ValidateTagID added in v0.58.1

func ValidateTagID(v interface{}) error

Types

type Branch

type Branch struct {
	CommitID     CommitID
	StagingToken StagingToken
	// SealedTokens - Staging tokens are appended to the front, this allows building the diff iterator easily
	SealedTokens []StagingToken
}

Branch is a pointer to a commit

type BranchData

type BranchData struct {
	Id           string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CommitId     string   `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
	StagingToken string   `protobuf:"bytes,3,opt,name=staging_token,json=stagingToken,proto3" json:"staging_token,omitempty"`
	SealedTokens []string `protobuf:"bytes,4,rep,name=sealed_tokens,json=sealedTokens,proto3" json:"sealed_tokens,omitempty"`
	// contains filtered or unexported fields
}

func (*BranchData) Descriptor deprecated

func (*BranchData) Descriptor() ([]byte, []int)

Deprecated: Use BranchData.ProtoReflect.Descriptor instead.

func (*BranchData) GetCommitId

func (x *BranchData) GetCommitId() string

func (*BranchData) GetId

func (x *BranchData) GetId() string

func (*BranchData) GetSealedTokens added in v0.70.0

func (x *BranchData) GetSealedTokens() []string

func (*BranchData) GetStagingToken added in v0.70.0

func (x *BranchData) GetStagingToken() string

func (*BranchData) ProtoMessage

func (*BranchData) ProtoMessage()

func (*BranchData) ProtoReflect

func (x *BranchData) ProtoReflect() protoreflect.Message

func (*BranchData) Reset

func (x *BranchData) Reset()

func (*BranchData) String

func (x *BranchData) String() string

type BranchID

type BranchID string

BranchID is an identifier for a branch

func (BranchID) Ref

func (id BranchID) Ref() Ref

func (BranchID) String

func (id BranchID) String() string

type BranchIterator

type BranchIterator interface {
	Next() bool
	SeekGE(id BranchID)
	Value() *BranchRecord
	Err() error
	Close()
}

type BranchLocker

type BranchLocker interface {
	Writer(ctx context.Context, repository *RepositoryRecord, branchID BranchID, lockedFn BranchLockerFunc) (interface{}, error)
	MetadataUpdater(ctx context.Context, repository *RepositoryRecord, branchID BranchID, lockeFn BranchLockerFunc) (interface{}, error)
}

type BranchLockerFunc

type BranchLockerFunc func() (interface{}, error)

BranchLockerFunc callback function when branch is locked for operation (ex: writer or metadata updater)

type BranchProtectionBlockedAction added in v0.52.0

type BranchProtectionBlockedAction int32
const (
	BranchProtectionBlockedAction_STAGING_WRITE BranchProtectionBlockedAction = 0
	BranchProtectionBlockedAction_COMMIT        BranchProtectionBlockedAction = 1
)

func (BranchProtectionBlockedAction) Descriptor added in v0.52.0

func (BranchProtectionBlockedAction) Enum added in v0.52.0

func (BranchProtectionBlockedAction) EnumDescriptor deprecated added in v0.52.0

func (BranchProtectionBlockedAction) EnumDescriptor() ([]byte, []int)

Deprecated: Use BranchProtectionBlockedAction.Descriptor instead.

func (BranchProtectionBlockedAction) Number added in v0.52.0

func (BranchProtectionBlockedAction) String added in v0.52.0

func (BranchProtectionBlockedAction) Type added in v0.52.0

type BranchProtectionBlockedActions added in v0.52.0

type BranchProtectionBlockedActions struct {
	Value []BranchProtectionBlockedAction `` /* 135-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*BranchProtectionBlockedActions) Descriptor deprecated added in v0.52.0

func (*BranchProtectionBlockedActions) Descriptor() ([]byte, []int)

Deprecated: Use BranchProtectionBlockedActions.ProtoReflect.Descriptor instead.

func (*BranchProtectionBlockedActions) GetValue added in v0.52.0

func (*BranchProtectionBlockedActions) ProtoMessage added in v0.52.0

func (*BranchProtectionBlockedActions) ProtoMessage()

func (*BranchProtectionBlockedActions) ProtoReflect added in v0.52.0

func (*BranchProtectionBlockedActions) Reset added in v0.52.0

func (x *BranchProtectionBlockedActions) Reset()

func (*BranchProtectionBlockedActions) String added in v0.52.0

type BranchProtectionRules added in v0.52.0

type BranchProtectionRules struct {
	BranchPatternToBlockedActions map[string]*BranchProtectionBlockedActions `` /* 242-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*BranchProtectionRules) Descriptor deprecated added in v0.52.0

func (*BranchProtectionRules) Descriptor() ([]byte, []int)

Deprecated: Use BranchProtectionRules.ProtoReflect.Descriptor instead.

func (*BranchProtectionRules) GetBranchPatternToBlockedActions added in v0.52.0

func (x *BranchProtectionRules) GetBranchPatternToBlockedActions() map[string]*BranchProtectionBlockedActions

func (*BranchProtectionRules) ProtoMessage added in v0.52.0

func (*BranchProtectionRules) ProtoMessage()

func (*BranchProtectionRules) ProtoReflect added in v0.52.0

func (x *BranchProtectionRules) ProtoReflect() protoreflect.Message

func (*BranchProtectionRules) Reset added in v0.52.0

func (x *BranchProtectionRules) Reset()

func (*BranchProtectionRules) String added in v0.52.0

func (x *BranchProtectionRules) String() string

type BranchRecord

type BranchRecord struct {
	BranchID BranchID `db:"id"`
	*Branch
}

BranchRecord holds BranchID with the associated Branch data

type BranchUpdateFunc added in v0.70.0

type BranchUpdateFunc func(*Branch) (*Branch, error)

BranchUpdateFunc Used to pass validation call back to ref manager for UpdateBranch flow

type CombinedDiffIterator added in v0.53.0

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

CombinedDiffIterator calculates the diff between a commit and a branch, including the staging area of the branch. committedDiffIterator is the DiffIterator between the commit and the HEAD of the branch. stagingIterator is the ValueIterator on the staging area of the branch leftIterator is the ValueIterator on the commit

func NewCombinedDiffIterator added in v0.53.0

func NewCombinedDiffIterator(committedDiffIterator DiffIterator, leftIterator ValueIterator, stagingIterator ValueIterator) *CombinedDiffIterator

func (*CombinedDiffIterator) Close added in v0.53.0

func (c *CombinedDiffIterator) Close()

func (*CombinedDiffIterator) Err added in v0.53.0

func (c *CombinedDiffIterator) Err() error

func (*CombinedDiffIterator) Next added in v0.53.0

func (c *CombinedDiffIterator) Next() bool

func (*CombinedDiffIterator) SeekGE added in v0.53.0

func (c *CombinedDiffIterator) SeekGE(id Key)

func (*CombinedDiffIterator) Value added in v0.53.0

func (c *CombinedDiffIterator) Value() *Diff

type CombinedIterator

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

CombinedIterator iterates over two listing iterators, in case of duplication (in values or in errors) returns value in iterA. CombinedIterator can be constructed from other CombinedIterator to allow chaining of multiple ValueIterators.

func (*CombinedIterator) Close

func (c *CombinedIterator) Close()

func (*CombinedIterator) Err

func (c *CombinedIterator) Err() error

func (*CombinedIterator) Next

func (c *CombinedIterator) Next() bool

func (*CombinedIterator) SeekGE

func (c *CombinedIterator) SeekGE(id Key)

func (*CombinedIterator) Value

func (c *CombinedIterator) Value() *ValueRecord

type Commit

type Commit struct {
	Version      CommitVersion
	Committer    string
	Message      string
	MetaRangeID  MetaRangeID
	CreationDate time.Time
	Parents      CommitParents
	Metadata     Metadata
	Generation   CommitGeneration
}

Commit represents commit metadata (author, time, MetaRangeID)

func CommitFromProto added in v0.70.0

func CommitFromProto(pb *CommitData) *Commit

func NewCommit added in v0.40.0

func NewCommit() Commit

func (Commit) Identity

func (c Commit) Identity() []byte

type CommitData

type CommitData struct {
	Id           string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Committer    string                 `protobuf:"bytes,2,opt,name=committer,proto3" json:"committer,omitempty"`
	Message      string                 `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	CreationDate *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"`
	MetaRangeId  string                 `protobuf:"bytes,5,opt,name=meta_range_id,json=metaRangeId,proto3" json:"meta_range_id,omitempty"`
	Metadata     map[string]string      `` /* 157-byte string literal not displayed */
	Parents      []string               `protobuf:"bytes,7,rep,name=parents,proto3" json:"parents,omitempty"`
	Version      int32                  `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"`
	Generation   int32                  `protobuf:"varint,9,opt,name=generation,proto3" json:"generation,omitempty"`
	// contains filtered or unexported fields
}

func ProtoFromCommit added in v0.70.0

func ProtoFromCommit(commitID CommitID, c *Commit) *CommitData

func (*CommitData) Descriptor deprecated

func (*CommitData) Descriptor() ([]byte, []int)

Deprecated: Use CommitData.ProtoReflect.Descriptor instead.

func (*CommitData) GetCommitter

func (x *CommitData) GetCommitter() string

func (*CommitData) GetCreationDate

func (x *CommitData) GetCreationDate() *timestamppb.Timestamp

func (*CommitData) GetGeneration added in v0.41.1

func (x *CommitData) GetGeneration() int32

func (*CommitData) GetId

func (x *CommitData) GetId() string

func (*CommitData) GetMessage

func (x *CommitData) GetMessage() string

func (*CommitData) GetMetaRangeId

func (x *CommitData) GetMetaRangeId() string

func (*CommitData) GetMetadata

func (x *CommitData) GetMetadata() map[string]string

func (*CommitData) GetParents

func (x *CommitData) GetParents() []string

func (*CommitData) GetVersion added in v0.40.0

func (x *CommitData) GetVersion() int32

func (*CommitData) ProtoMessage

func (*CommitData) ProtoMessage()

func (*CommitData) ProtoReflect

func (x *CommitData) ProtoReflect() protoreflect.Message

func (*CommitData) Reset

func (x *CommitData) Reset()

func (*CommitData) String

func (x *CommitData) String() string

type CommitGeneration added in v1.9.0

type CommitGeneration int64

type CommitID

type CommitID string

CommitID is a content addressable hash representing a Commit object

func (CommitID) Ref

func (id CommitID) Ref() Ref

func (CommitID) String

func (id CommitID) String() string

type CommitIDAndSummary

type CommitIDAndSummary struct {
	ID      CommitID
	Summary DiffSummary
}

type CommitIterator

type CommitIterator interface {
	Next() bool
	SeekGE(id CommitID)
	Value() *CommitRecord
	Err() error
	Close()
}

type CommitParams

type CommitParams struct {
	Committer string
	Message   string
	// Date (Unix Epoch in seconds) is used to override commits creation date
	Date     *int64
	Metadata Metadata
	// SourceMetaRange - If exists, use it directly. Fail if branch has uncommitted changes
	SourceMetaRange *MetaRangeID
	AllowEmpty      bool
}

type CommitParents

type CommitParents []CommitID

func (CommitParents) AsStringSlice

func (cp CommitParents) AsStringSlice() []string

func (CommitParents) Contains

func (cp CommitParents) Contains(commitID CommitID) bool

func (CommitParents) Identity

func (cp CommitParents) Identity() []byte

type CommitRecord

type CommitRecord struct {
	CommitID CommitID `db:"id"`
	*Commit
}

CommitRecord holds CommitID with the associated Commit data

type CommitVersion added in v0.40.0

type CommitVersion int

CommitVersion used to track changes in Commit schema. Each version is change that a constant describes.

const (
	CommitVersionInitial CommitVersion = iota
	CommitVersionParentSwitch

	CurrentCommitVersion = CommitVersionParentSwitch
)

type CommittedManager

type CommittedManager interface {
	// Get returns the provided key, if exists, from the provided MetaRangeID
	Get(ctx context.Context, ns StorageNamespace, rangeID MetaRangeID, key Key) (*Value, error)

	// Exists returns true if a MetaRange matching ID exists in namespace ns.
	Exists(ctx context.Context, ns StorageNamespace, id MetaRangeID) (bool, error)

	// WriteMetaRangeByIterator flushes the iterator to a new MetaRange and returns the created ID.
	WriteMetaRangeByIterator(ctx context.Context, ns StorageNamespace, it ValueIterator, metadata Metadata) (*MetaRangeID, error)

	// WriteRange creates a new Range from the iterator values.
	// Keeps Range closing logic, so might not exhaust the iterator.
	WriteRange(ctx context.Context, ns StorageNamespace, it ValueIterator) (*RangeInfo, error)

	// WriteMetaRange creates a new MetaRange from the given Ranges.
	WriteMetaRange(ctx context.Context, ns StorageNamespace, ranges []*RangeInfo) (*MetaRangeInfo, error)

	// List takes a given tree and returns an ValueIterator
	List(ctx context.Context, ns StorageNamespace, rangeID MetaRangeID) (ValueIterator, error)

	// Diff receives two metaRanges and returns a DiffIterator describing all differences between them.
	// This is similar to a two-dot diff in git (left..right)
	Diff(ctx context.Context, ns StorageNamespace, left, right MetaRangeID) (DiffIterator, error)

	// Compare returns the difference between 'source' and 'destination', relative to a merge base 'base'.
	// This is similar to a three-dot diff in git.
	Compare(ctx context.Context, ns StorageNamespace, destination, source, base MetaRangeID) (DiffIterator, error)

	// Merge applies changes from 'source' to 'destination', relative to a merge base 'base' and
	// returns the ID of the new metarange. This is similar to a git merge operation.
	// The resulting tree is expected to be immediately addressable.
	Merge(ctx context.Context, ns StorageNamespace, destination, source, base MetaRangeID, strategy MergeStrategy, opts ...SetOptionsFunc) (MetaRangeID, error)

	// Import sync changes from 'source' to 'destination'. All the given prefixes are completely overridden on the resulting metarange. Returns the ID of the new
	// metarange.
	Import(ctx context.Context, ns StorageNamespace, destination, source MetaRangeID, prefixes []Prefix, opts ...SetOptionsFunc) (MetaRangeID, error)

	// Commit is the act of taking an existing metaRange (snapshot) and applying a set of changes to it.
	// A change is either an entity to write/overwrite, or a tombstone to mark a deletion
	// it returns a new MetaRangeID that is expected to be immediately addressable
	Commit(ctx context.Context, ns StorageNamespace, baseMetaRangeID MetaRangeID, changes ValueIterator, allowEmpty bool, opts ...SetOptionsFunc) (MetaRangeID, DiffSummary, error)

	// GetMetaRange returns information where metarangeID is stored.
	GetMetaRange(ctx context.Context, ns StorageNamespace, metaRangeID MetaRangeID) (MetaRangeAddress, error)
	// GetRange returns information where rangeID is stored.
	GetRange(ctx context.Context, ns StorageNamespace, rangeID RangeID) (RangeAddress, error)

	// GetRangeIDByKey returns the RangeID that contains the given key.
	GetRangeIDByKey(ctx context.Context, ns StorageNamespace, id MetaRangeID, key Key) (RangeID, error)
}

CommittedManager reads and applies committed snapshots it is responsible for de-duping them, persisting them and providing basic diff, merge and list capabilities

type DeleteError added in v0.82.0

type DeleteError struct {
	Key Key
	Err error
}

DeleteError single delete error used by DeleteBatch's multierror.Error to report each key that failed

func (*DeleteError) Error added in v0.82.0

func (d *DeleteError) Error() string

func (*DeleteError) Unwrap added in v0.82.0

func (d *DeleteError) Unwrap() error

type DeleteSensor added in v1.13.0

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

func NewDeleteSensor added in v1.13.0

func NewDeleteSensor(triggerAt int, cb DeleteSensorCB, opts ...DeleteSensorOpts) *DeleteSensor

func (*DeleteSensor) Close added in v1.13.0

func (s *DeleteSensor) Close()

func (*DeleteSensor) CountDelete added in v1.13.0

func (s *DeleteSensor) CountDelete(ctx context.Context, repositoryID RepositoryID, branchID BranchID, stagingTokenID StagingToken)

type DeleteSensorCB added in v1.13.0

type DeleteSensorCB func(repositoryID RepositoryID, branchID BranchID, stagingTokenID StagingToken, inGrace bool)

type DeleteSensorOpts added in v1.13.0

type DeleteSensorOpts func(s *DeleteSensor)

func WithCBBufferSize added in v1.13.0

func WithCBBufferSize(bufferSize int) DeleteSensorOpts

type Diff

type Diff struct {
	Type         DiffType
	Key          Key
	Value        *Value
	LeftIdentity []byte // the Identity of the value on the left side of the diff
}

Diff represents a change in value based on key

func (*Diff) Copy

func (d *Diff) Copy() *Diff

type DiffIterator

type DiffIterator interface {
	Next() bool
	SeekGE(id Key)
	Value() *Diff
	Err() error
	Close()
}

func NewUncommittedDiffIterator

func NewUncommittedDiffIterator(ctx context.Context, committedList ValueIterator, uncommittedList ValueIterator) DiffIterator

NewUncommittedDiffIterator lists uncommitted changes as a diff. If `metaRangeID` is empty then there is no commit and it returns all objects as added

type DiffSummary

type DiffSummary struct {
	Count      map[DiffType]int
	Incomplete bool // true when Diff summary has missing Information (could happen when skipping ranges with same bounds)
}

type DiffType

type DiffType uint8

DiffType represents the type of the change

const (
	DiffTypeAdded DiffType = iota
	DiffTypeRemoved
	DiffTypeChanged
	DiffTypeConflict
)

type Dumper

type Dumper interface {
	// DumpCommits iterates through all commits and dumps them in Graveler format
	DumpCommits(ctx context.Context, repository *RepositoryRecord) (*MetaRangeID, error)

	// DumpBranches iterates through all branches and dumps them in Graveler format
	DumpBranches(ctx context.Context, repository *RepositoryRecord) (*MetaRangeID, error)

	// DumpTags iterates through all tags and dumps them in Graveler format
	DumpTags(ctx context.Context, repository *RepositoryRecord) (*MetaRangeID, error)
}

type EventType

type EventType string
const (
	EventTypePreCommit        EventType = "pre-commit"
	EventTypePostCommit       EventType = "post-commit"
	EventTypePreMerge         EventType = "pre-merge"
	EventTypePostMerge        EventType = "post-merge"
	EventTypePreCreateTag     EventType = "pre-create-tag"
	EventTypePostCreateTag    EventType = "post-create-tag"
	EventTypePreDeleteTag     EventType = "pre-delete-tag"
	EventTypePostDeleteTag    EventType = "post-delete-tag"
	EventTypePreCreateBranch  EventType = "pre-create-branch"
	EventTypePostCreateBranch EventType = "post-create-branch"
	EventTypePreDeleteBranch  EventType = "pre-delete-branch"
	EventTypePostDeleteBranch EventType = "post-delete-branch"

	RunIDTimeLayout = "20060102150405"
	UnixYear3000    = 32500915200
)

type FilterTombstoneIterator added in v0.70.0

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

FilterTombstoneIterator wraps a value iterator and filters out tombstones.

func NewFilterTombstoneIterator added in v0.70.0

func NewFilterTombstoneIterator(iter ValueIterator) *FilterTombstoneIterator

func (*FilterTombstoneIterator) Close added in v0.70.0

func (f *FilterTombstoneIterator) Close()

func (*FilterTombstoneIterator) Err added in v0.70.0

func (f *FilterTombstoneIterator) Err() error

func (*FilterTombstoneIterator) Next added in v0.70.0

func (f *FilterTombstoneIterator) Next() bool

func (*FilterTombstoneIterator) SeekGE added in v0.70.0

func (f *FilterTombstoneIterator) SeekGE(id Key)

func (*FilterTombstoneIterator) Value added in v0.70.0

type GarbageCollectionManager added in v0.43.0

type GarbageCollectionManager interface {
	GetRules(ctx context.Context, storageNamespace StorageNamespace) (*GarbageCollectionRules, error)
	SaveRules(ctx context.Context, storageNamespace StorageNamespace, rules *GarbageCollectionRules) error

	SaveGarbageCollectionCommits(ctx context.Context, repository *RepositoryRecord, rules *GarbageCollectionRules) (string, error)
	GetCommitsCSVLocation(runID string, sn StorageNamespace) (string, error)
	SaveGarbageCollectionUncommitted(ctx context.Context, repository *RepositoryRecord, filename, runID string) error
	GetUncommittedLocation(runID string, sn StorageNamespace) (string, error)
	GetAddressesLocation(sn StorageNamespace) (string, error)
	NewID() string
}

type GarbageCollectionRules added in v0.43.0

type GarbageCollectionRules struct {
	DefaultRetentionDays int32            `protobuf:"varint,1,opt,name=default_retention_days,json=defaultRetentionDays,proto3" json:"default_retention_days,omitempty"`
	BranchRetentionDays  map[string]int32 `` /* 209-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*GarbageCollectionRules) Descriptor deprecated added in v0.43.0

func (*GarbageCollectionRules) Descriptor() ([]byte, []int)

Deprecated: Use GarbageCollectionRules.ProtoReflect.Descriptor instead.

func (*GarbageCollectionRules) GetBranchRetentionDays added in v0.43.0

func (x *GarbageCollectionRules) GetBranchRetentionDays() map[string]int32

func (*GarbageCollectionRules) GetDefaultRetentionDays added in v0.43.0

func (x *GarbageCollectionRules) GetDefaultRetentionDays() int32

func (*GarbageCollectionRules) ProtoMessage added in v0.43.0

func (*GarbageCollectionRules) ProtoMessage()

func (*GarbageCollectionRules) ProtoReflect added in v0.43.0

func (x *GarbageCollectionRules) ProtoReflect() protoreflect.Message

func (*GarbageCollectionRules) Reset added in v0.43.0

func (x *GarbageCollectionRules) Reset()

func (*GarbageCollectionRules) String added in v0.43.0

func (x *GarbageCollectionRules) String() string

type GarbageCollectionRunMetadata added in v0.44.0

type GarbageCollectionRunMetadata struct {
	RunID string
	// Location of active commits CSV file on object store
	CommitsCSVLocation string
	// Location of where to write active addresses on object store
	AddressLocation string
}

type GetOptions added in v0.90.1

type GetOptions struct {
	// StageOnly fetch key from stage area only. Default (false) will lookup stage and committed data.
	StageOnly bool
}

GetOptions controls get request defaults

type GetOptionsFunc added in v0.90.1

type GetOptionsFunc func(opts *GetOptions)

func WithStageOnly added in v0.90.1

func WithStageOnly(v bool) GetOptionsFunc

type Graveler

type Graveler struct {
	CommittedManager CommittedManager
	RefManager       RefManager
	StagingManager   StagingManager

	BranchUpdateBackOff backoff.BackOff
	// contains filtered or unexported fields
}

func NewGraveler

func NewGraveler(committedManager CommittedManager, stagingManager StagingManager, refManager RefManager, gcManager GarbageCollectionManager, protectedBranchesManager ProtectedBranchesManager, deleteSensor *DeleteSensor) *Graveler

func (*Graveler) AddCommit

func (g *Graveler) AddCommit(ctx context.Context, repository *RepositoryRecord, commit Commit, opts ...SetOptionsFunc) (CommitID, error)

func (*Graveler) CherryPick added in v0.97.0

func (g *Graveler) CherryPick(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, parentNumber *int, committer string, opts ...SetOptionsFunc) (CommitID, error)

CherryPick creates a new commit on the given branch, with the changes from the given commit. If the commit is a merge commit, 'parentNumber' is the parent number (1-based) relative to which the cherry-pick is done.

func (*Graveler) Commit

func (g *Graveler) Commit(ctx context.Context, repository *RepositoryRecord, branchID BranchID, params CommitParams, opts ...SetOptionsFunc) (CommitID, error)

func (*Graveler) Compare

func (g *Graveler) Compare(ctx context.Context, repository *RepositoryRecord, left, right Ref) (DiffIterator, error)

func (*Graveler) CreateBareRepository

func (g *Graveler) CreateBareRepository(ctx context.Context, repositoryID RepositoryID, storageNamespace StorageNamespace, defaultBranchID BranchID, readOnly bool) (*RepositoryRecord, error)

func (*Graveler) CreateBranch

func (g *Graveler) CreateBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, opts ...SetOptionsFunc) (*Branch, error)

func (*Graveler) CreateCommitRecord added in v1.9.0

func (g *Graveler) CreateCommitRecord(ctx context.Context, repository *RepositoryRecord, commitID CommitID, commit Commit, opts ...SetOptionsFunc) error

func (*Graveler) CreateRepository

func (g *Graveler) CreateRepository(ctx context.Context, repositoryID RepositoryID, storageNamespace StorageNamespace, branchID BranchID, readOnly bool) (*RepositoryRecord, error)

func (*Graveler) CreateTag

func (g *Graveler) CreateTag(ctx context.Context, repository *RepositoryRecord, tagID TagID, commitID CommitID, opts ...SetOptionsFunc) error

func (*Graveler) Delete

func (g *Graveler) Delete(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, opts ...SetOptionsFunc) error

func (*Graveler) DeleteBatch added in v0.89.0

func (g *Graveler) DeleteBatch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, keys []Key, opts ...SetOptionsFunc) error

DeleteBatch delete batch of keys. Keys length is limited to DeleteKeysMaxSize. Return error can be of type 'multi-error' holds DeleteError with each key/error that failed as part of the batch.

func (*Graveler) DeleteBranch

func (g *Graveler) DeleteBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, opts ...SetOptionsFunc) error

func (*Graveler) DeleteExpiredImports added in v0.102.0

func (g *Graveler) DeleteExpiredImports(ctx context.Context, repository *RepositoryRecord) error

func (*Graveler) DeleteExpiredLinkAddresses added in v0.90.0

func (g *Graveler) DeleteExpiredLinkAddresses(ctx context.Context, repository *RepositoryRecord) error

func (*Graveler) DeleteRepository

func (g *Graveler) DeleteRepository(ctx context.Context, repositoryID RepositoryID, opts ...SetOptionsFunc) error

func (*Graveler) DeleteTag

func (g *Graveler) DeleteTag(ctx context.Context, repository *RepositoryRecord, tagID TagID, opts ...SetOptionsFunc) error

func (*Graveler) Dereference

func (g *Graveler) Dereference(ctx context.Context, repository *RepositoryRecord, ref Ref) (*ResolvedRef, error)

func (*Graveler) Diff

func (g *Graveler) Diff(ctx context.Context, repository *RepositoryRecord, left, right Ref) (DiffIterator, error)

func (*Graveler) DiffUncommitted

func (g *Graveler) DiffUncommitted(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (DiffIterator, error)

DiffUncommitted returns DiffIterator between committed data and staging area of a branch

func (*Graveler) DumpBranches

func (g *Graveler) DumpBranches(ctx context.Context, repository *RepositoryRecord) (*MetaRangeID, error)

func (*Graveler) DumpCommits

func (g *Graveler) DumpCommits(ctx context.Context, repository *RepositoryRecord) (*MetaRangeID, error)

func (*Graveler) DumpTags

func (g *Graveler) DumpTags(ctx context.Context, repository *RepositoryRecord) (*MetaRangeID, error)

func (*Graveler) FindMergeBase added in v0.94.1

func (g *Graveler) FindMergeBase(ctx context.Context, repository *RepositoryRecord, from Ref, to Ref) (*CommitRecord, *CommitRecord, *Commit, error)

func (*Graveler) GCGetUncommittedLocation added in v0.89.0

func (g *Graveler) GCGetUncommittedLocation(repository *RepositoryRecord, runID string) (string, error)

func (*Graveler) GCNewRunID added in v0.89.0

func (g *Graveler) GCNewRunID() string

func (*Graveler) Get

func (g *Graveler) Get(ctx context.Context, repository *RepositoryRecord, ref Ref, key Key, opts ...GetOptionsFunc) (*Value, error)

func (*Graveler) GetBranch

func (g *Graveler) GetBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (*Branch, error)

func (*Graveler) GetBranchProtectionRules added in v0.52.0

func (g *Graveler) GetBranchProtectionRules(ctx context.Context, repository *RepositoryRecord) (*BranchProtectionRules, *string, error)

func (*Graveler) GetByCommitID added in v0.89.0

func (g *Graveler) GetByCommitID(ctx context.Context, repository *RepositoryRecord, commitID CommitID, key Key) (*Value, error)

func (*Graveler) GetCommit

func (g *Graveler) GetCommit(ctx context.Context, repository *RepositoryRecord, commitID CommitID) (*Commit, error)

func (*Graveler) GetGarbageCollectionRules added in v0.43.0

func (g *Graveler) GetGarbageCollectionRules(ctx context.Context, repository *RepositoryRecord) (*GarbageCollectionRules, error)

func (*Graveler) GetMetaRange

func (g *Graveler) GetMetaRange(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID) (MetaRangeAddress, error)

func (*Graveler) GetRange

func (g *Graveler) GetRange(ctx context.Context, repository *RepositoryRecord, rangeID RangeID) (RangeAddress, error)

func (*Graveler) GetRangeIDByKey added in v0.98.0

func (g *Graveler) GetRangeIDByKey(ctx context.Context, repository *RepositoryRecord, commitID CommitID, key Key) (RangeID, error)

func (*Graveler) GetRepository

func (g *Graveler) GetRepository(ctx context.Context, repositoryID RepositoryID) (*RepositoryRecord, error)

func (*Graveler) GetRepositoryMetadata added in v0.104.0

func (g *Graveler) GetRepositoryMetadata(ctx context.Context, repositoryID RepositoryID) (RepositoryMetadata, error)

func (*Graveler) GetStagingToken added in v0.40.0

func (g *Graveler) GetStagingToken(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (*StagingToken, error)

func (*Graveler) GetTag

func (g *Graveler) GetTag(ctx context.Context, repository *RepositoryRecord, tagID TagID) (*CommitID, error)

func (*Graveler) Import added in v0.102.0

func (g *Graveler) Import(ctx context.Context, repository *RepositoryRecord, destination BranchID, source MetaRangeID, commitParams CommitParams, prefixes []Prefix, opts ...SetOptionsFunc) (CommitID, error)

func (*Graveler) IsLinkAddressExpired added in v0.90.0

func (g *Graveler) IsLinkAddressExpired(linkAddress *LinkAddressData) (bool, error)

func (*Graveler) List

func (g *Graveler) List(ctx context.Context, repository *RepositoryRecord, ref Ref, batchSize int) (ValueIterator, error)

func (*Graveler) ListBranches

func (g *Graveler) ListBranches(ctx context.Context, repository *RepositoryRecord) (BranchIterator, error)

func (*Graveler) ListLinkAddresses added in v0.90.0

func (g *Graveler) ListLinkAddresses(ctx context.Context, repository *RepositoryRecord) (LinkAddressIterator, error)

func (*Graveler) ListRepositories

func (g *Graveler) ListRepositories(ctx context.Context) (RepositoryIterator, error)

func (*Graveler) ListStaging added in v0.89.0

func (g *Graveler) ListStaging(ctx context.Context, branch *Branch, batchSize int) (ValueIterator, error)

ListStaging Exposing listStagingArea to catalog for PrepareGCUncommitted

func (*Graveler) ListTags

func (g *Graveler) ListTags(ctx context.Context, repository *RepositoryRecord) (TagIterator, error)

func (*Graveler) LoadBranches

func (g *Graveler) LoadBranches(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID, opts ...SetOptionsFunc) error

func (*Graveler) LoadCommits

func (g *Graveler) LoadCommits(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID, opts ...SetOptionsFunc) error

func (*Graveler) LoadTags

func (g *Graveler) LoadTags(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID, opts ...SetOptionsFunc) error

func (*Graveler) Log

func (g *Graveler) Log(ctx context.Context, repository *RepositoryRecord, commitID CommitID, firstParent bool, since *time.Time) (CommitIterator, error)

func (*Graveler) Merge

func (g *Graveler) Merge(ctx context.Context, repository *RepositoryRecord, destination BranchID, source Ref, commitParams CommitParams, strategy string, opts ...SetOptionsFunc) (CommitID, error)

func (*Graveler) ParseRef added in v0.44.1

func (g *Graveler) ParseRef(ref Ref) (RawRef, error)

func (*Graveler) Reset

func (g *Graveler) Reset(ctx context.Context, repository *RepositoryRecord, branchID BranchID, opts ...SetOptionsFunc) error

func (*Graveler) ResetHard added in v1.8.0

func (g *Graveler) ResetHard(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, opts ...SetOptionsFunc) error

func (*Graveler) ResetKey

func (g *Graveler) ResetKey(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, opts ...SetOptionsFunc) error

func (*Graveler) ResetPrefix

func (g *Graveler) ResetPrefix(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, opts ...SetOptionsFunc) error

func (*Graveler) ResolveRawRef added in v0.44.1

func (g *Graveler) ResolveRawRef(ctx context.Context, repository *RepositoryRecord, rawRef RawRef) (*ResolvedRef, error)

func (*Graveler) Revert

func (g *Graveler) Revert(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, parentNumber int, commitParams CommitParams, opts ...SetOptionsFunc) (CommitID, error)

Revert creates a reverse patch to the commit given as 'ref', and applies it as a new commit on the given branch. This is implemented by merging the parent of 'ref' into the branch, with 'ref' as the merge base. Example: consider the following tree: C1 -> C2 -> C3, with the branch pointing at C3. To revert C2, we merge C1 into the branch, with C2 as the merge base. That is, try to apply the diff from C2 to C1 on the tip of the branch. If the commit is a merge commit, 'parentNumber' is the parent number (1-based) relative to which the revert is done.

func (*Graveler) SaveGarbageCollectionCommits added in v0.43.0

func (g *Graveler) SaveGarbageCollectionCommits(ctx context.Context, repository *RepositoryRecord) (*GarbageCollectionRunMetadata, error)

func (*Graveler) Set

func (g *Graveler) Set(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, value Value, opts ...SetOptionsFunc) error

func (*Graveler) SetBranchProtectionRules added in v0.111.0

func (g *Graveler) SetBranchProtectionRules(ctx context.Context, repository *RepositoryRecord, rules *BranchProtectionRules, lastKnownChecksum *string) error

func (*Graveler) SetGarbageCollectionRules added in v0.43.0

func (g *Graveler) SetGarbageCollectionRules(ctx context.Context, repository *RepositoryRecord, rules *GarbageCollectionRules) error

func (*Graveler) SetHooksHandler

func (g *Graveler) SetHooksHandler(handler HooksHandler)

func (*Graveler) SetLinkAddress added in v0.90.0

func (g *Graveler) SetLinkAddress(ctx context.Context, repository *RepositoryRecord, physicalAddress string) error

func (*Graveler) SetRepositoryMetadata added in v1.8.0

func (g *Graveler) SetRepositoryMetadata(ctx context.Context, repository *RepositoryRecord, updateFunc RepoMetadataUpdateFunc) error

func (*Graveler) StageObject added in v0.98.0

func (g *Graveler) StageObject(ctx context.Context, stagingToken string, object ValueRecord) error

func (*Graveler) UpdateBranch

func (g *Graveler) UpdateBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, opts ...SetOptionsFunc) (*Branch, error)

func (*Graveler) VerifyLinkAddress added in v0.90.0

func (g *Graveler) VerifyLinkAddress(ctx context.Context, repository *RepositoryRecord, physicalAddress string) error

func (*Graveler) WriteMetaRange

func (g *Graveler) WriteMetaRange(ctx context.Context, repository *RepositoryRecord, ranges []*RangeInfo, opts ...SetOptionsFunc) (*MetaRangeInfo, error)

func (*Graveler) WriteMetaRangeByIterator added in v0.63.0

func (g *Graveler) WriteMetaRangeByIterator(ctx context.Context, repository *RepositoryRecord, it ValueIterator, opts ...SetOptionsFunc) (*MetaRangeID, error)

func (*Graveler) WriteRange added in v0.63.0

func (g *Graveler) WriteRange(ctx context.Context, repository *RepositoryRecord, it ValueIterator, opts ...SetOptionsFunc) (*RangeInfo, error)

type HookAbortError

type HookAbortError struct {
	EventType EventType
	RunID     string
	Err       error
}

HookAbortError abort by hook error, holds the event type with the run id to trace back the run

func (*HookAbortError) Error

func (e *HookAbortError) Error() string

func (*HookAbortError) Unwrap

func (e *HookAbortError) Unwrap() error

type HookRecord

type HookRecord struct {
	// Required fields for all event types:
	RunID            string
	EventType        EventType
	RepositoryID     RepositoryID
	StorageNamespace StorageNamespace
	// The reference which the actions files are read from
	SourceRef Ref
	// Event specific fields:
	// Relevant for all event types except tags. For merge events this will be the ID of the destination branch
	BranchID BranchID
	// Relevant only for commit and merge events. In both it will contain the new commit data created from the operation
	Commit Commit
	// Not relevant in delete branch. In commit and merge will not exist in pre-action. In post actions will contain the new commit ID
	CommitID CommitID
	// Exists only in post actions. Contains the ID of the pre-action associated with this post-action
	PreRunID string
	// Exists only in tag actions.
	TagID TagID
}

HookRecord is an aggregation of all necessary fields for all event types

type HooksHandler

type HooksHandler interface {
	PreCommitHook(ctx context.Context, record HookRecord) error
	PostCommitHook(ctx context.Context, record HookRecord) error
	PreMergeHook(ctx context.Context, record HookRecord) error
	PostMergeHook(ctx context.Context, record HookRecord) error
	PreCreateTagHook(ctx context.Context, record HookRecord) error
	PostCreateTagHook(ctx context.Context, record HookRecord)
	PreDeleteTagHook(ctx context.Context, record HookRecord) error
	PostDeleteTagHook(ctx context.Context, record HookRecord)
	PreCreateBranchHook(ctx context.Context, record HookRecord) error
	PostCreateBranchHook(ctx context.Context, record HookRecord)
	PreDeleteBranchHook(ctx context.Context, record HookRecord) error
	PostDeleteBranchHook(ctx context.Context, record HookRecord)
	// NewRunID TODO (niro): WA for now until KV feature complete
	NewRunID() string
}

type HooksNoOp

type HooksNoOp struct{}

func (*HooksNoOp) NewRunID added in v0.67.0

func (h *HooksNoOp) NewRunID() string

func (*HooksNoOp) PostCommitHook

func (h *HooksNoOp) PostCommitHook(context.Context, HookRecord) error

func (*HooksNoOp) PostCreateBranchHook added in v0.62.0

func (h *HooksNoOp) PostCreateBranchHook(context.Context, HookRecord)

func (*HooksNoOp) PostCreateTagHook added in v0.62.0

func (h *HooksNoOp) PostCreateTagHook(context.Context, HookRecord)

func (*HooksNoOp) PostDeleteBranchHook added in v0.62.0

func (h *HooksNoOp) PostDeleteBranchHook(context.Context, HookRecord)

func (*HooksNoOp) PostDeleteTagHook added in v0.62.0

func (h *HooksNoOp) PostDeleteTagHook(context.Context, HookRecord)

func (*HooksNoOp) PostMergeHook

func (h *HooksNoOp) PostMergeHook(context.Context, HookRecord) error

func (*HooksNoOp) PreCommitHook

func (h *HooksNoOp) PreCommitHook(context.Context, HookRecord) error

func (*HooksNoOp) PreCreateBranchHook added in v0.62.0

func (h *HooksNoOp) PreCreateBranchHook(context.Context, HookRecord) error

func (*HooksNoOp) PreCreateTagHook added in v0.62.0

func (h *HooksNoOp) PreCreateTagHook(context.Context, HookRecord) error

func (*HooksNoOp) PreDeleteBranchHook added in v0.62.0

func (h *HooksNoOp) PreDeleteBranchHook(context.Context, HookRecord) error

func (*HooksNoOp) PreDeleteTagHook added in v0.62.0

func (h *HooksNoOp) PreDeleteTagHook(context.Context, HookRecord) error

func (*HooksNoOp) PreMergeHook

func (h *HooksNoOp) PreMergeHook(context.Context, HookRecord) error

type ImportID added in v0.102.0

type ImportID string

ImportID represents an import process id in the ref-store

func (ImportID) String added in v0.102.0

func (id ImportID) String() string

type ImportStatus added in v0.102.0

type ImportStatus struct {
	ID          ImportID
	Completed   bool
	UpdatedAt   time.Time
	Progress    int64
	MetaRangeID MetaRangeID
	Commit      *CommitRecord
	Error       error
}

func ImportStatusFromProto added in v0.102.0

func ImportStatusFromProto(pb *ImportStatusData) *ImportStatus

type ImportStatusData added in v0.102.0

type ImportStatusData struct {
	Id          string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Completed   bool                   `protobuf:"varint,2,opt,name=completed,proto3" json:"completed,omitempty"`
	UpdatedAt   *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	Progress    int64                  `protobuf:"varint,4,opt,name=progress,proto3" json:"progress,omitempty"`
	MetarangeId string                 `protobuf:"bytes,5,opt,name=metarange_id,json=metarangeId,proto3" json:"metarange_id,omitempty"`
	Commit      *CommitData            `protobuf:"bytes,6,opt,name=commit,proto3" json:"commit,omitempty"`
	Error       string                 `protobuf:"bytes,7,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func ProtoFromImportStatus added in v0.102.0

func ProtoFromImportStatus(status *ImportStatus) *ImportStatusData

func (*ImportStatusData) Descriptor deprecated added in v0.102.0

func (*ImportStatusData) Descriptor() ([]byte, []int)

Deprecated: Use ImportStatusData.ProtoReflect.Descriptor instead.

func (*ImportStatusData) GetCommit added in v0.102.0

func (x *ImportStatusData) GetCommit() *CommitData

func (*ImportStatusData) GetCompleted added in v0.102.0

func (x *ImportStatusData) GetCompleted() bool

func (*ImportStatusData) GetError added in v0.102.0

func (x *ImportStatusData) GetError() string

func (*ImportStatusData) GetId added in v0.102.0

func (x *ImportStatusData) GetId() string

func (*ImportStatusData) GetMetarangeId added in v0.102.0

func (x *ImportStatusData) GetMetarangeId() string

func (*ImportStatusData) GetProgress added in v0.102.0

func (x *ImportStatusData) GetProgress() int64

func (*ImportStatusData) GetUpdatedAt added in v0.102.0

func (x *ImportStatusData) GetUpdatedAt() *timestamppb.Timestamp

func (*ImportStatusData) ProtoMessage added in v0.102.0

func (*ImportStatusData) ProtoMessage()

func (*ImportStatusData) ProtoReflect added in v0.102.0

func (x *ImportStatusData) ProtoReflect() protoreflect.Message

func (*ImportStatusData) Reset added in v0.102.0

func (x *ImportStatusData) Reset()

func (*ImportStatusData) String added in v0.102.0

func (x *ImportStatusData) String() string

type Key

type Key []byte

Key represents a logical path for a value

func (Key) Copy

func (id Key) Copy() Key

func (Key) String

func (id Key) String() string

type KeyValueStore

type KeyValueStore interface {
	// Get returns value from repository / reference by key, nil value is a valid value for tombstone
	// returns error if value does not exist
	Get(ctx context.Context, repository *RepositoryRecord, ref Ref, key Key, opts ...GetOptionsFunc) (*Value, error)

	// GetByCommitID returns value from repository / commit by key and error if value does not exist
	GetByCommitID(ctx context.Context, repository *RepositoryRecord, commitID CommitID, key Key) (*Value, error)

	// GetRangeIDByKey returns rangeID from the commitID that contains the key
	GetRangeIDByKey(ctx context.Context, repository *RepositoryRecord, commitID CommitID, key Key) (RangeID, error)

	// Set stores value on repository / branch by key. nil value is a valid value for tombstone
	Set(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, value Value, opts ...SetOptionsFunc) error

	// Delete value from repository / branch by key
	Delete(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, opts ...SetOptionsFunc) error

	// DeleteBatch delete values from repository / branch by batch of keys
	DeleteBatch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, keys []Key, opts ...SetOptionsFunc) error

	// List lists values on repository / ref
	List(ctx context.Context, repository *RepositoryRecord, ref Ref, batchSize int) (ValueIterator, error)

	// ListStaging returns ValueIterator for branch staging area. Exposed to be used by X in PrepareGCUncommitted
	ListStaging(ctx context.Context, branch *Branch, batchSize int) (ValueIterator, error)
}

type LinkAddressData added in v0.90.0

type LinkAddressData struct {

	// xid physical address that includes the creation date
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

message data model to track address tokens

func (*LinkAddressData) Descriptor deprecated added in v0.90.0

func (*LinkAddressData) Descriptor() ([]byte, []int)

Deprecated: Use LinkAddressData.ProtoReflect.Descriptor instead.

func (*LinkAddressData) GetAddress added in v0.90.0

func (x *LinkAddressData) GetAddress() string

func (*LinkAddressData) ProtoMessage added in v0.90.0

func (*LinkAddressData) ProtoMessage()

func (*LinkAddressData) ProtoReflect added in v0.90.0

func (x *LinkAddressData) ProtoReflect() protoreflect.Message

func (*LinkAddressData) Reset added in v0.90.0

func (x *LinkAddressData) Reset()

func (*LinkAddressData) String added in v0.90.0

func (x *LinkAddressData) String() string

type LinkAddressIterator added in v0.112.0

type LinkAddressIterator interface {
	Next() bool
	SeekGE(address string)
	Value() *LinkAddressData
	Err() error
	Close()
}

type Loader

type Loader interface {
	// LoadCommits iterates through all commits in Graveler format and loads them into repositoryID
	LoadCommits(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID, opts ...SetOptionsFunc) error

	// LoadBranches iterates through all branches in Graveler format and loads them into repositoryID
	LoadBranches(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID, opts ...SetOptionsFunc) error

	// LoadTags iterates through all tags in Graveler format and loads them into repositoryID
	LoadTags(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID, opts ...SetOptionsFunc) error
}

type MergeStrategy added in v0.61.0

type MergeStrategy int

MergeStrategy changes from dest or source are automatically overridden in case of a conflict

type MetaRangeAddress added in v0.63.0

type MetaRangeAddress string

MetaRangeAddress is the URI of a metarange file.

type MetaRangeID

type MetaRangeID string

MetaRangeID represents a snapshot of the MetaRange, referenced by a commit

func (MetaRangeID) String added in v0.70.0

func (id MetaRangeID) String() string

type MetaRangeInfo

type MetaRangeInfo struct {
	// ID is the identifier for the written MetaRange.
	// Calculated by a hash function to all keys and values' identity.
	ID MetaRangeID
}

MetaRangeInfo contains information on a MetaRange

type Metadata

type Metadata map[string]string

Metadata key/value strings to hold metadata information on value and commit

type Plumbing

type Plumbing interface {
	// GetMetaRange returns information where metarangeID is stored.
	GetMetaRange(ctx context.Context, repository *RepositoryRecord, metaRangeID MetaRangeID) (MetaRangeAddress, error)
	// GetRange returns information where rangeID is stored.
	GetRange(ctx context.Context, repository *RepositoryRecord, rangeID RangeID) (RangeAddress, error)
	// WriteRange creates a new Range from the iterator values.
	// Keeps Range closing logic, so might not flush all values to the range.
	// Returns the created range info and in addition a list of records which were skipped due to out of order listing
	// which might happen in Azure ADLS Gen2 listing
	WriteRange(ctx context.Context, repository *RepositoryRecord, it ValueIterator, opts ...SetOptionsFunc) (*RangeInfo, error)
	// WriteMetaRange creates a new MetaRange from the given Ranges.
	WriteMetaRange(ctx context.Context, repository *RepositoryRecord, ranges []*RangeInfo, opts ...SetOptionsFunc) (*MetaRangeInfo, error)
	// StageObject stages given object to stagingToken.
	StageObject(ctx context.Context, stagingToken string, object ValueRecord) error
}

Plumbing includes commands for fiddling more directly with graveler implementation internals.

type Prefix added in v0.105.0

type Prefix string

Prefix of a given key

type ProtectedBranchesManager added in v0.52.0

type ProtectedBranchesManager interface {
	// GetRules returns all branch protection rules for the repository.
	// The returned checksum represents the current state of the rules, and can be passed to SetRulesIf for conditional updates.
	GetRules(ctx context.Context, repository *RepositoryRecord) (*BranchProtectionRules, *string, error)
	// SetRules sets the branch protection rules for the repository.
	// If lastKnownChecksum does not match the current checksum, returns ErrPreconditionFailed.
	// If lastKnownChecksum is the empty string, the rules are set only if they are not currently set.
	// If lastKnownChecksum is nil, the rules are set unconditionally.
	SetRules(ctx context.Context, repository *RepositoryRecord, rules *BranchProtectionRules, lastKnownChecksum *string) error
	// IsBlocked returns whether the action is blocked by any branch protection rule matching the given branch.
	IsBlocked(ctx context.Context, repository *RepositoryRecord, branchID BranchID, action BranchProtectionBlockedAction) (bool, error)
}

type RangeAddress added in v0.63.0

type RangeAddress string

RangeAddress is the URI of a range file.

type RangeID

type RangeID string

RangeID represents a part of a MetaRange, useful only for plumbing.

type RangeInfo

type RangeInfo struct {
	// ID is the identifier for the written Range.
	// Calculated by a hash function to all keys and values' identity.
	ID RangeID

	// MinKey is the first key in the Range.
	MinKey Key

	// MaxKey is the last key in the Range.
	MaxKey Key

	// Count is the number of records in the Range.
	Count int

	// EstimatedRangeSizeBytes is Approximate size of each Range
	EstimatedRangeSizeBytes uint64
}

RangeInfo contains information on a Range

type RawRef added in v0.44.1

type RawRef struct {
	BaseRef   string
	Modifiers []RefModifier
}

RawRef is a parsed Ref that includes 'BaseRef' that holds the branch/tag/hash and a list of

ordered modifiers that applied to the reference.

Example: master~2 will be parsed into {BaseRef:"master", Modifiers:[{Type:RefModTypeTilde, Value:2}]}

type Ref

type Ref string

Ref could be a commit ID, a branch name, a Tag

func (Ref) String

func (id Ref) String() string

type RefManager

type RefManager interface {
	// GetRepository returns the Repository metadata object for the given RepositoryID
	GetRepository(ctx context.Context, repositoryID RepositoryID) (*RepositoryRecord, error)

	// CreateRepository stores a new Repository under RepositoryID with the given Branch as default branch
	CreateRepository(ctx context.Context, repositoryID RepositoryID, repository Repository) (*RepositoryRecord, error)

	// CreateBareRepository stores a new repository under RepositoryID without creating an initial commit and branch
	CreateBareRepository(ctx context.Context, repositoryID RepositoryID, repository Repository) (*RepositoryRecord, error)

	// ListRepositories lists repositories
	ListRepositories(ctx context.Context) (RepositoryIterator, error)

	// DeleteRepository deletes the repository
	DeleteRepository(ctx context.Context, repositoryID RepositoryID, opts ...SetOptionsFunc) error

	// GetRepositoryMetadata gets repository user metadata
	GetRepositoryMetadata(ctx context.Context, repositoryID RepositoryID) (RepositoryMetadata, error)

	// SetRepositoryMetadata updates repository user metadata using the updateFunc
	SetRepositoryMetadata(ctx context.Context, repository *RepositoryRecord, updateFunc RepoMetadataUpdateFunc) error

	// ParseRef returns parsed 'ref' information as RawRef
	ParseRef(ref Ref) (RawRef, error)

	// ResolveRawRef returns the ResolvedRef matching the given RawRef
	ResolveRawRef(ctx context.Context, repository *RepositoryRecord, rawRef RawRef) (*ResolvedRef, error)

	// GetBranch returns the Branch metadata object for the given BranchID
	GetBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (*Branch, error)

	// CreateBranch creates a branch with the given id and Branch metadata
	CreateBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, branch Branch) error

	// SetBranch points the given BranchID at the given Branch metadata
	SetBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, branch Branch) error

	// BranchUpdate Conditional set of branch with validation callback
	BranchUpdate(ctx context.Context, repository *RepositoryRecord, branchID BranchID, f BranchUpdateFunc) error

	// DeleteBranch deletes the branch
	DeleteBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID) error

	// ListBranches lists branches
	ListBranches(ctx context.Context, repository *RepositoryRecord) (BranchIterator, error)

	// GCBranchIterator TODO (niro): Remove when DB implementation is deleted
	// GCBranchIterator temporary WA to support both DB and KV GC BranchIterator, which iterates over branches by order of commit ID
	GCBranchIterator(ctx context.Context, repository *RepositoryRecord) (BranchIterator, error)

	// GetTag returns the Tag metadata object for the given TagID
	GetTag(ctx context.Context, repository *RepositoryRecord, tagID TagID) (*CommitID, error)

	// CreateTag create a given tag pointing to a commit
	CreateTag(ctx context.Context, repository *RepositoryRecord, tagID TagID, commitID CommitID) error

	// DeleteTag deletes the tag
	DeleteTag(ctx context.Context, repository *RepositoryRecord, tagID TagID) error

	// ListTags lists tags
	ListTags(ctx context.Context, repository *RepositoryRecord) (TagIterator, error)

	// GetCommit returns the Commit metadata object for the given CommitID.
	GetCommit(ctx context.Context, repository *RepositoryRecord, commitID CommitID) (*Commit, error)

	// GetCommitByPrefix returns the Commit metadata object for the given prefix CommitID.
	// if more than 1 commit starts with the ID prefix returns error
	GetCommitByPrefix(ctx context.Context, repository *RepositoryRecord, prefix CommitID) (*Commit, error)

	// AddCommit stores the Commit object, returning its ID
	AddCommit(ctx context.Context, repository *RepositoryRecord, commit Commit) (CommitID, error)

	// CreateCommitRecord stores the Commit object
	CreateCommitRecord(ctx context.Context, repository *RepositoryRecord, commitID CommitID, commit Commit) error

	// RemoveCommit deletes commit from store - used for repository cleanup
	RemoveCommit(ctx context.Context, repository *RepositoryRecord, commitID CommitID) error

	// FindMergeBase returns the merge-base for the given CommitIDs
	// see: https://git-scm.com/docs/git-merge-base
	// and internally: https://github.com/treeverse/lakeFS/blob/09954804baeb36ada74fa17d8fdc13a38552394e/index/dag/commits.go
	FindMergeBase(ctx context.Context, repository *RepositoryRecord, commitIDs ...CommitID) (*Commit, error)

	// Log returns an iterator starting at commit ID up to repository root
	Log(ctx context.Context, repository *RepositoryRecord, commitID CommitID, firstParent bool, since *time.Time) (CommitIterator, error)

	// ListCommits returns an iterator over all known commits, ordered by their commit ID
	ListCommits(ctx context.Context, repository *RepositoryRecord) (CommitIterator, error)

	// GCCommitIterator TODO (niro): Remove when DB implementation is deleted
	// GCCommitIterator temporary WA to support both DB and KV GC CommitIterator
	GCCommitIterator(ctx context.Context, repository *RepositoryRecord) (CommitIterator, error)

	// VerifyLinkAddress verifies the given link address
	VerifyLinkAddress(ctx context.Context, repository *RepositoryRecord, physicalAddress string) error

	// SetLinkAddress saves a link address under the repository.
	SetLinkAddress(ctx context.Context, repository *RepositoryRecord, physicalAddress string) error

	// ListLinkAddresses lists saved link addresses on a repository
	ListLinkAddresses(ctx context.Context, repository *RepositoryRecord) (LinkAddressIterator, error)

	// DeleteExpiredLinkAddresses deletes expired link addresses on a repository
	DeleteExpiredLinkAddresses(ctx context.Context, repository *RepositoryRecord) error

	// IsLinkAddressExpired returns nil if the link address is valid and not expired
	IsLinkAddressExpired(linkAddress *LinkAddressData) (bool, error)

	// DeleteExpiredImports deletes expired imports on a given repository
	DeleteExpiredImports(ctx context.Context, repository *RepositoryRecord) error
}

RefManager handles references: branches, commits, probably tags in the future it also handles the structure of the commit graph and its traversal (notably, merge-base and log)

type RefModType added in v0.44.1

type RefModType rune
const (
	RefModTypeTilde  RefModType = '~'
	RefModTypeCaret  RefModType = '^'
	RefModTypeAt     RefModType = '@'
	RefModTypeDollar RefModType = '$'
)

type RefModifier added in v0.44.1

type RefModifier struct {
	Type  RefModType
	Value int
}

type ReferenceType

type ReferenceType uint8

ReferenceType represents the type of the reference

const (
	ReferenceTypeCommit ReferenceType = iota
	ReferenceTypeTag
	ReferenceTypeBranch
)

type RepoMetadata added in v0.104.0

type RepoMetadata struct {
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func ProtoFromRepositoryMetadata added in v0.104.0

func ProtoFromRepositoryMetadata(metadata RepositoryMetadata) *RepoMetadata

func (*RepoMetadata) Descriptor deprecated added in v0.104.0

func (*RepoMetadata) Descriptor() ([]byte, []int)

Deprecated: Use RepoMetadata.ProtoReflect.Descriptor instead.

func (*RepoMetadata) GetMetadata added in v0.104.0

func (x *RepoMetadata) GetMetadata() map[string]string

func (*RepoMetadata) ProtoMessage added in v0.104.0

func (*RepoMetadata) ProtoMessage()

func (*RepoMetadata) ProtoReflect added in v0.104.0

func (x *RepoMetadata) ProtoReflect() protoreflect.Message

func (*RepoMetadata) Reset added in v0.104.0

func (x *RepoMetadata) Reset()

func (*RepoMetadata) String added in v0.104.0

func (x *RepoMetadata) String() string

type RepoMetadataUpdateFunc added in v0.104.0

type RepoMetadataUpdateFunc func(metadata RepositoryMetadata) (RepositoryMetadata, error)

type Repository

type Repository struct {
	StorageNamespace StorageNamespace
	CreationDate     time.Time
	DefaultBranchID  BranchID
	// RepositoryState represents the state of the repository, only ACTIVE repository is considered a valid one.
	// other states represent in invalid temporary or terminal state
	State RepositoryState
	// InstanceUID identifies repository in a unique way. Since repositories with same name can be deleted and recreated
	// this field identifies the specific instance, and used in the KV store key path to store all the entities belonging
	// to this specific instantiation of repo with the given ID
	InstanceUID string
	// ReadOnly indicates if the repository is a read-only repository. All write operations will be blocked for a
	// read-only repository.
	ReadOnly bool
}

Repository represents repository metadata

func NewRepository added in v0.70.0

func NewRepository(storageNamespace StorageNamespace, defaultBranchID BranchID, readOnly bool) Repository

type RepositoryData added in v0.70.0

type RepositoryData struct {
	Id               string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	StorageNamespace string                 `protobuf:"bytes,2,opt,name=storage_namespace,json=storageNamespace,proto3" json:"storage_namespace,omitempty"`
	DefaultBranchId  string                 `protobuf:"bytes,3,opt,name=default_branch_id,json=defaultBranchId,proto3" json:"default_branch_id,omitempty"`
	CreationDate     *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=creation_date,json=creationDate,proto3" json:"creation_date,omitempty"`
	State            RepositoryState        `protobuf:"varint,5,opt,name=state,proto3,enum=io.treeverse.lakefs.graveler.RepositoryState" json:"state,omitempty"`
	InstanceUid      string                 `protobuf:"bytes,6,opt,name=instance_uid,json=instanceUid,proto3" json:"instance_uid,omitempty"`
	ReadOnly         bool                   `protobuf:"varint,7,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
	// contains filtered or unexported fields
}

func ProtoFromRepo added in v0.70.0

func ProtoFromRepo(repo *RepositoryRecord) *RepositoryData

func (*RepositoryData) Descriptor deprecated added in v0.70.0

func (*RepositoryData) Descriptor() ([]byte, []int)

Deprecated: Use RepositoryData.ProtoReflect.Descriptor instead.

func (*RepositoryData) GetCreationDate added in v0.70.0

func (x *RepositoryData) GetCreationDate() *timestamppb.Timestamp

func (*RepositoryData) GetDefaultBranchId added in v0.70.0

func (x *RepositoryData) GetDefaultBranchId() string

func (*RepositoryData) GetId added in v0.70.0

func (x *RepositoryData) GetId() string

func (*RepositoryData) GetInstanceUid added in v0.70.0

func (x *RepositoryData) GetInstanceUid() string

func (*RepositoryData) GetReadOnly added in v1.5.0

func (x *RepositoryData) GetReadOnly() bool

func (*RepositoryData) GetState added in v0.70.0

func (x *RepositoryData) GetState() RepositoryState

func (*RepositoryData) GetStorageNamespace added in v0.70.0

func (x *RepositoryData) GetStorageNamespace() string

func (*RepositoryData) ProtoMessage added in v0.70.0

func (*RepositoryData) ProtoMessage()

func (*RepositoryData) ProtoReflect added in v0.70.0

func (x *RepositoryData) ProtoReflect() protoreflect.Message

func (*RepositoryData) Reset added in v0.70.0

func (x *RepositoryData) Reset()

func (*RepositoryData) String added in v0.70.0

func (x *RepositoryData) String() string

type RepositoryID

type RepositoryID string

RepositoryID is an identifier for a repo

func (RepositoryID) String

func (id RepositoryID) String() string

type RepositoryIterator

type RepositoryIterator interface {
	Next() bool
	SeekGE(id RepositoryID)
	Value() *RepositoryRecord
	Err() error
	Close()
}

type RepositoryMetadata added in v0.104.0

type RepositoryMetadata map[string]string

func RepoMetadataFromProto added in v0.104.0

func RepoMetadataFromProto(pb *RepoMetadata) RepositoryMetadata

type RepositoryRecord

type RepositoryRecord struct {
	RepositoryID RepositoryID `db:"id"`
	*Repository
}

func RepoFromProto added in v0.70.0

func RepoFromProto(pb *RepositoryData) *RepositoryRecord

type RepositoryState added in v0.70.0

type RepositoryState int32
const (
	RepositoryState_ACTIVE      RepositoryState = 0
	RepositoryState_IN_DELETION RepositoryState = 1
)

func (RepositoryState) Descriptor added in v0.70.0

func (RepositoryState) Enum added in v0.70.0

func (x RepositoryState) Enum() *RepositoryState

func (RepositoryState) EnumDescriptor deprecated added in v0.70.0

func (RepositoryState) EnumDescriptor() ([]byte, []int)

Deprecated: Use RepositoryState.Descriptor instead.

func (RepositoryState) Number added in v0.70.0

func (RepositoryState) String added in v0.70.0

func (x RepositoryState) String() string

func (RepositoryState) Type added in v0.70.0

type ResolvedBranchModifier added in v0.44.1

type ResolvedBranchModifier int

ResolvedBranchModifier indicates if the ref specified one of the committed/staging modifiers, and which.

const (
	ResolvedBranchModifierNone ResolvedBranchModifier = iota
	ResolvedBranchModifierCommitted
	ResolvedBranchModifierStaging
)

type ResolvedRef added in v0.44.1

type ResolvedRef struct {
	Type                   ReferenceType
	ResolvedBranchModifier ResolvedBranchModifier
	BranchRecord
}

ResolvedRef include resolved information of Ref/RawRef:

Type: Branch / Tag / Commit
BranchID: for type ReferenceTypeBranch will hold the branch ID
ResolvedBranchModifier: branch indicator if resolved to a branch the latest commit, staging or none was specified.
CommitID: the commit ID of the branch head,  tag or specific hash.
StagingToken: empty if ResolvedBranchModifier is ResolvedBranchModifierCommitted.

type SetOptions added in v0.90.1

type SetOptions struct {
	IfAbsent bool
	// MaxTries set number of times we try to perform the operation before we fail with BranchWriteMaxTries.
	// By default, 0 - we try BranchWriteMaxTries
	MaxTries int
	// Force set to true will bypass repository read-only protection.
	Force bool
}

type SetOptionsFunc added in v0.90.1

type SetOptionsFunc func(opts *SetOptions)

func WithForce added in v1.5.0

func WithForce(v bool) SetOptionsFunc

func WithIfAbsent added in v0.90.1

func WithIfAbsent(v bool) SetOptionsFunc

type StagedEntryData added in v0.70.0

type StagedEntryData struct {
	Key      []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
	Data     []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func ProtoFromStagedEntry added in v0.70.0

func ProtoFromStagedEntry(key []byte, v *Value) *StagedEntryData

func (*StagedEntryData) Descriptor deprecated added in v0.70.0

func (*StagedEntryData) Descriptor() ([]byte, []int)

Deprecated: Use StagedEntryData.ProtoReflect.Descriptor instead.

func (*StagedEntryData) GetData added in v0.70.0

func (x *StagedEntryData) GetData() []byte

func (*StagedEntryData) GetIdentity added in v0.70.0

func (x *StagedEntryData) GetIdentity() []byte

func (*StagedEntryData) GetKey added in v0.70.0

func (x *StagedEntryData) GetKey() []byte

func (*StagedEntryData) ProtoMessage added in v0.70.0

func (*StagedEntryData) ProtoMessage()

func (*StagedEntryData) ProtoReflect added in v0.70.0

func (x *StagedEntryData) ProtoReflect() protoreflect.Message

func (*StagedEntryData) Reset added in v0.70.0

func (x *StagedEntryData) Reset()

func (*StagedEntryData) String added in v0.70.0

func (x *StagedEntryData) String() string

type StagingManager

type StagingManager interface {
	// Get returns the value for the provided staging token and key
	// Returns ErrNotFound if no value found on key.
	Get(ctx context.Context, st StagingToken, key Key) (*Value, error)

	// Set writes a (possibly nil) value under the given staging token and key.
	// If requireExists is true - update key only if key already exists in store
	Set(ctx context.Context, st StagingToken, key Key, value *Value, requireExists bool) error

	// Update updates a (possibly nil) value under the given staging token and key.
	// Skip update in case 'ErrSkipUpdateValue' is returned from 'updateFunc'.
	Update(ctx context.Context, st StagingToken, key Key, updateFunc ValueUpdateFunc) error

	// List returns a ValueIterator for the given staging token
	List(ctx context.Context, st StagingToken, batchSize int) ValueIterator

	// DropKey clears a value by staging token and key
	DropKey(ctx context.Context, st StagingToken, key Key) error

	// Drop clears the given staging area
	Drop(ctx context.Context, st StagingToken) error

	// DropAsync clears the given staging area eventually. Keys may still exist under the token
	// for a short period of time after the request was made.
	DropAsync(ctx context.Context, st StagingToken) error

	// DropByPrefix drops all keys starting with the given prefix, from the given staging area
	DropByPrefix(ctx context.Context, st StagingToken, prefix Key) error
}

StagingManager manages entries in a staging area, denoted by a staging token

type StagingToken

type StagingToken string

StagingToken represents a namespace for writes to apply as uncommitted

func GenerateStagingToken added in v0.70.0

func GenerateStagingToken(repositoryID RepositoryID, branchID BranchID) StagingToken

func (StagingToken) String added in v0.70.0

func (id StagingToken) String() string

type StagingTokenCounter added in v1.13.0

type StagingTokenCounter struct {
	StagingTokenID StagingToken
	Counter        int
}

StagingTokenCounter holds a counter for a specific staging token.

type StorageNamespace

type StorageNamespace string

StorageNamespace is the URI to the storage location

func (StorageNamespace) String

func (ns StorageNamespace) String() string

type TagData

type TagData struct {
	Id       string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CommitId string `protobuf:"bytes,2,opt,name=commit_id,json=commitId,proto3" json:"commit_id,omitempty"`
	// contains filtered or unexported fields
}

func (*TagData) Descriptor deprecated

func (*TagData) Descriptor() ([]byte, []int)

Deprecated: Use TagData.ProtoReflect.Descriptor instead.

func (*TagData) GetCommitId

func (x *TagData) GetCommitId() string

func (*TagData) GetId

func (x *TagData) GetId() string

func (*TagData) ProtoMessage

func (*TagData) ProtoMessage()

func (*TagData) ProtoReflect

func (x *TagData) ProtoReflect() protoreflect.Message

func (*TagData) Reset

func (x *TagData) Reset()

func (*TagData) String

func (x *TagData) String() string

type TagID

type TagID string

TagID represents a named tag pointing at a commit

func (TagID) String

func (id TagID) String() string

type TagIterator

type TagIterator interface {
	Next() bool
	SeekGE(id TagID)
	Value() *TagRecord
	Err() error
	Close()
}

type TagRecord

type TagRecord struct {
	TagID    TagID `db:"id"`
	CommitID CommitID
}

TagRecord holds TagID with the associated Tag data

func TagFromProto added in v0.70.0

func TagFromProto(pb *TagData) *TagRecord

type Value

type Value struct {
	Identity []byte `db:"identity"`
	Data     []byte `db:"data"`
}

Value represents metadata or a given object (modified date, physical address, etc)

func StagedEntryFromProto added in v0.70.0

func StagedEntryFromProto(pb *StagedEntryData) *Value

type ValueIterator

type ValueIterator interface {
	Next() bool
	SeekGE(id Key)
	Value() *ValueRecord
	Err() error
	Close()
}

func NewCombinedIterator

func NewCombinedIterator(iters ...ValueIterator) ValueIterator

NewCombinedIterator combines multiple ValueIterators into a single CombinedIterator. The returned iterator precedence order is first-to-last in case of matching keys in 2 or more iterators.

type ValueRecord

type ValueRecord struct {
	Key Key `db:"key"`
	*Value
}

ValueRecord holds Key with the associated Value information

func (*ValueRecord) IsTombstone

func (v *ValueRecord) IsTombstone() bool

type ValueUpdateFunc added in v0.70.0

type ValueUpdateFunc func(*Value) (*Value, error)

ValueUpdateFunc Used to pass validation call back to staging manager for UpdateValue flow

type VersionController

type VersionController interface {
	// GetRepository returns the Repository metadata object for the given RepositoryID
	GetRepository(ctx context.Context, repositoryID RepositoryID) (*RepositoryRecord, error)

	// CreateRepository stores a new Repository under RepositoryID with the given Branch as default branch
	CreateRepository(ctx context.Context, repositoryID RepositoryID, storageNamespace StorageNamespace, branchID BranchID, readOnly bool) (*RepositoryRecord, error)

	// CreateBareRepository stores a new Repository under RepositoryID with no initial branch or commit
	CreateBareRepository(ctx context.Context, repositoryID RepositoryID, storageNamespace StorageNamespace, defaultBranchID BranchID, readOnly bool) (*RepositoryRecord, error)

	// ListRepositories returns iterator to scan repositories
	ListRepositories(ctx context.Context) (RepositoryIterator, error)

	// DeleteRepository deletes the repository
	DeleteRepository(ctx context.Context, repositoryID RepositoryID, opts ...SetOptionsFunc) error

	// GetRepositoryMetadata returns repository user metadata
	GetRepositoryMetadata(ctx context.Context, repositoryID RepositoryID) (RepositoryMetadata, error)

	// SetRepositoryMetadata sets repository user metadata
	SetRepositoryMetadata(ctx context.Context, repository *RepositoryRecord, updateFunc RepoMetadataUpdateFunc) error

	// CreateBranch creates branch on repository pointing to ref
	CreateBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, opts ...SetOptionsFunc) (*Branch, error)

	// UpdateBranch updates branch on repository pointing to ref
	UpdateBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, opts ...SetOptionsFunc) (*Branch, error)

	// GetBranch gets branch information by branch / repository id
	GetBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (*Branch, error)

	// GetTag gets tag's commit id
	GetTag(ctx context.Context, repository *RepositoryRecord, tagID TagID) (*CommitID, error)

	// CreateTag creates tag on a repository pointing to a commit id
	CreateTag(ctx context.Context, repository *RepositoryRecord, tagID TagID, commitID CommitID, opts ...SetOptionsFunc) error

	// DeleteTag remove tag from a repository
	DeleteTag(ctx context.Context, repository *RepositoryRecord, tagID TagID, opts ...SetOptionsFunc) error

	// ListTags lists tags on a repository
	ListTags(ctx context.Context, repository *RepositoryRecord) (TagIterator, error)

	// Log returns an iterator starting at commit ID up to repository root
	Log(ctx context.Context, repository *RepositoryRecord, commitID CommitID, firstParent bool, since *time.Time) (CommitIterator, error)

	// ListBranches lists branches on repositories
	ListBranches(ctx context.Context, repository *RepositoryRecord) (BranchIterator, error)

	// DeleteBranch deletes branch from repository
	DeleteBranch(ctx context.Context, repository *RepositoryRecord, branchID BranchID, opts ...SetOptionsFunc) error

	// Commit the staged data and returns a commit ID that references that change
	//   ErrNothingToCommit in case there is no data in stage
	Commit(ctx context.Context, repository *RepositoryRecord, branchID BranchID, commitParams CommitParams, opts ...SetOptionsFunc) (CommitID, error)

	// CreateCommitRecord creates a commit record in the repository.
	CreateCommitRecord(ctx context.Context, repository *RepositoryRecord, commitID CommitID, commit Commit, opts ...SetOptionsFunc) error

	// WriteMetaRangeByIterator accepts a ValueIterator and writes the entire iterator to a new MetaRange
	// and returns the result ID.
	WriteMetaRangeByIterator(ctx context.Context, repository *RepositoryRecord, it ValueIterator, opts ...SetOptionsFunc) (*MetaRangeID, error)

	// AddCommit creates a dangling (no referencing branch) commit in the repo from the pre-existing commit.
	// Returns ErrMetaRangeNotFound if the referenced metaRangeID doesn't exist.
	AddCommit(ctx context.Context, repository *RepositoryRecord, commit Commit, opts ...SetOptionsFunc) (CommitID, error)

	// GetCommit returns the Commit metadata object for the given CommitID
	GetCommit(ctx context.Context, repository *RepositoryRecord, commitID CommitID) (*Commit, error)

	// Dereference returns the resolved ref information based on 'ref' reference
	Dereference(ctx context.Context, repository *RepositoryRecord, ref Ref) (*ResolvedRef, error)

	// ParseRef returns parsed 'ref' information as raw reference
	ParseRef(ref Ref) (RawRef, error)

	// ResolveRawRef returns the ResolvedRef matching the given RawRef
	ResolveRawRef(ctx context.Context, repository *RepositoryRecord, rawRef RawRef) (*ResolvedRef, error)

	// ResetHard resets branch to point at ref.
	ResetHard(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, opts ...SetOptionsFunc) error

	// Reset throws all staged data on the repository / branch
	Reset(ctx context.Context, repository *RepositoryRecord, branchID BranchID, opts ...SetOptionsFunc) error

	// ResetKey throws all staged data under the specified key on the repository / branch
	ResetKey(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, opts ...SetOptionsFunc) error

	// ResetPrefix throws all staged data starting with the given prefix on the repository / branch
	ResetPrefix(ctx context.Context, repository *RepositoryRecord, branchID BranchID, key Key, opts ...SetOptionsFunc) error

	// Revert creates a reverse patch to the commit given as 'ref', and applies it as a new commit on the given branch.
	Revert(ctx context.Context, repository *RepositoryRecord, branchID BranchID, ref Ref, parentNumber int, commitParams CommitParams, opts ...SetOptionsFunc) (CommitID, error)

	// CherryPick creates a patch to the commit given as 'ref', and applies it as a new commit on the given branch.
	CherryPick(ctx context.Context, repository *RepositoryRecord, id BranchID, reference Ref, number *int, committer string, opts ...SetOptionsFunc) (CommitID, error)

	// Merge merges 'source' into 'destination' and returns the commit id for the created merge commit.
	Merge(ctx context.Context, repository *RepositoryRecord, destination BranchID, source Ref, commitParams CommitParams, strategy string, opts ...SetOptionsFunc) (CommitID, error)

	// Import creates a merge-commit in the destination branch using the source MetaRangeID, overriding any destination
	// range keys that have the same prefix as the source range keys.
	Import(ctx context.Context, repository *RepositoryRecord, destination BranchID, source MetaRangeID, commitParams CommitParams, prefixes []Prefix, opts ...SetOptionsFunc) (CommitID, error)

	// DiffUncommitted returns iterator to scan the changes made on the branch
	DiffUncommitted(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (DiffIterator, error)

	// Diff returns the changes between 'left' and 'right' ref.
	// This is similar to a two-dot (left..right) diff in git.
	Diff(ctx context.Context, repository *RepositoryRecord, left, right Ref) (DiffIterator, error)

	// Compare returns the difference between the commit where 'left' was last synced into 'right', and the most recent commit of `right`.
	// This is similar to a three-dot (from...to) diff in git.
	Compare(ctx context.Context, repository *RepositoryRecord, left, right Ref) (DiffIterator, error)

	// FindMergeBase returns the 'from' commit, the 'to' commit and the merge base commit of 'from' and 'to' commits.
	FindMergeBase(ctx context.Context, repository *RepositoryRecord, from Ref, to Ref) (*CommitRecord, *CommitRecord, *Commit, error)

	// SetHooksHandler set handler for all graveler hooks
	SetHooksHandler(handler HooksHandler)

	// GetStagingToken returns the token identifying current staging for branchID of
	// repositoryID.
	GetStagingToken(ctx context.Context, repository *RepositoryRecord, branchID BranchID) (*StagingToken, error)

	GetGarbageCollectionRules(ctx context.Context, repository *RepositoryRecord) (*GarbageCollectionRules, error)

	SetGarbageCollectionRules(ctx context.Context, repository *RepositoryRecord, rules *GarbageCollectionRules) error

	// SaveGarbageCollectionCommits saves the sets of active and expired commits, according to the branch rules for garbage collection.
	// Returns
	//	- run id which can later be used to retrieve the set of commits.
	//	- location where the expired/active commit information was saved
	//	- location where the information of addresses to be removed should be saved
	// If a previousRunID is specified, commits that were already expired and their ancestors will not be considered as expired/active.
	// Note: Ancestors of previously expired commits may still be considered if they can be reached from a non-expired commit.
	SaveGarbageCollectionCommits(ctx context.Context, repository *RepositoryRecord) (garbageCollectionRunMetadata *GarbageCollectionRunMetadata, err error)

	// GCGetUncommittedLocation returns full uri of the storage location of saved uncommitted files per runID
	GCGetUncommittedLocation(repository *RepositoryRecord, runID string) (string, error)

	GCNewRunID() string

	// GetBranchProtectionRules return all branch protection rules for the repository.
	// The returned checksum represents the current state of the rules, and can be passed to SetBranchProtectionRules for a conditional update.
	GetBranchProtectionRules(ctx context.Context, repository *RepositoryRecord) (*BranchProtectionRules, *string, error)

	// SetBranchProtectionRules sets the branch protection rules for the repository.
	// If lastKnownChecksum doesn't match the current state, the update fails with ErrPreconditionFailed.
	// If lastKnownChecksum is the empty string, the update is performed only if no rules exist.
	// If lastKnownChecksum is nil, the update is performed unconditionally.
	SetBranchProtectionRules(ctx context.Context, repository *RepositoryRecord, rules *BranchProtectionRules, lastKnownChecksum *string) error

	// SetLinkAddress saves the address for linking under the repository.
	// It returns ErrLinkAddressAlreadyExists if the address already saved.
	SetLinkAddress(ctx context.Context, repository *RepositoryRecord, physicalAddress string) error

	// VerifyLinkAddress returns nil if physicalAddress is valid (exists and not expired) and deletes it.
	VerifyLinkAddress(ctx context.Context, repository *RepositoryRecord, physicalAddress string) error

	// ListLinkAddresses lists saved addresses on a repository
	ListLinkAddresses(ctx context.Context, repository *RepositoryRecord) (LinkAddressIterator, error)

	// DeleteExpiredLinkAddresses deletes expired addresses on a repository
	DeleteExpiredLinkAddresses(ctx context.Context, repository *RepositoryRecord) error

	// IsLinkAddressExpired returns nil if the address is valid and not expired
	IsLinkAddressExpired(address *LinkAddressData) (bool, error)

	// DeleteExpiredImports deletes expired imports on a given repository
	DeleteExpiredImports(ctx context.Context, repository *RepositoryRecord) error
}

Directories

Path Synopsis
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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