Skip to content

Commit

Permalink
catalog interface | change Dereference to RevParse (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-har authored Nov 29, 2020
1 parent 24fb08c commit 4b28f2e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions catalog/rocks/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

// Basic Types

// DiffType represents a changed state for a given entry (added, removed, changed, conflict)
// DiffType represents a changed state for a given entry
type DiffType uint8

const (
Expand All @@ -17,6 +17,21 @@ const (
DiffTypeConflict
)

// ReferenceType represents the type of the reference
type ReferenceType uint8

const (
ReferenceTypeCommit ReferenceType = iota
ReferenceTypeTag
ReferenceTypeBranch
)

type Reference interface {
Type() ReferenceType
Branch() Branch
CommitID() CommitID
}

// function/methods receiving the following basic types could assume they passed validation
type (
// StorageNamespace is the URI to the storage location
Expand Down Expand Up @@ -147,9 +162,6 @@ type Catalog interface {
// GetBranch gets branch information by branch / repository id
GetBranch(ctx context.Context, repositoryID RepositoryID, branchID BranchID) (Branch, error)

// Dereference translates ref to commit id
Dereference(ctx context.Context, repositoryID RepositoryID, ref Ref) (CommitID, error)

// Log lists commits in repository
// The 'from' is used to get all commits after the specified commit id
// The 'amount' specifies the maximum number of commits the call will return
Expand Down Expand Up @@ -260,8 +272,8 @@ type RefManager interface {
// DeleteRepository deletes the repository
DeleteRepository(ctx context.Context, repositoryID RepositoryID) error

// Dereference translates Ref to the corresponding CommitID
Dereference(ctx context.Context, repositoryID RepositoryID, ref Ref) (CommitID, error)
// RevParse returns the Reference matching the given Ref
RevParse(ctx context.Context, repositoryID RepositoryID, ref Ref) (Reference, error)

// GetBranch returns the Branch metadata object for the given BranchID
GetBranch(ctx context.Context, repositoryID RepositoryID, branchID BranchID) (*Branch, error)
Expand Down

0 comments on commit 4b28f2e

Please sign in to comment.