-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Graveler transform catalog interface (#993)
* Catalog as generic key/value with EntryCatalog as a layer between * split interfaces * wip * graveler * revert mvcc changes * revert export cmd * revert some more * revert part 2 * use iterators at catalog level * code review changes * remove unused ListingType * update comments * update Log
- Loading branch information
Showing
4 changed files
with
241 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package rocks | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/treeverse/lakefs/graveler" | ||
) | ||
|
||
type Path string | ||
|
||
// Entry represents metadata or a given object (modified date, physical address, etc) | ||
type Entry struct { | ||
LastModified time.Time | ||
Address string | ||
Metadata graveler.Metadata | ||
ETag string | ||
Size int64 | ||
} | ||
|
||
type EntryRecord struct { | ||
Path Path | ||
*Entry | ||
} | ||
|
||
type EntryListing struct { | ||
CommonPrefix bool | ||
Path | ||
*Entry | ||
} | ||
|
||
type EntryListingIterator interface { | ||
Next() bool | ||
SeekGE(id Path) bool | ||
Value() *EntryListing | ||
Err() error | ||
Close() | ||
} | ||
|
||
// EntryCatalog | ||
type EntryCatalog interface { | ||
graveler.VersionController | ||
|
||
// Get returns entry from repository / reference by path, nil entry is a valid entry for tombstone | ||
// returns error if entry does not exist | ||
GetEntry(ctx context.Context, repositoryID graveler.RepositoryID, ref graveler.Ref, path Path) (*Entry, error) | ||
|
||
// Set stores entry on repository / branch by path. nil entry is a valid entry for tombstone | ||
SetEntry(ctx context.Context, repositoryID graveler.RepositoryID, branchID graveler.BranchID, path Path, entry *Entry) error | ||
|
||
// DeleteEntry deletes entry from repository / branch by path | ||
DeleteEntry(ctx context.Context, repositoryID graveler.RepositoryID, branchID graveler.BranchID, path Path) error | ||
|
||
// List lists entries on repository / ref will filter by prefix, from path 'from'. | ||
// When 'delimiter' is set the listing will include common prefixes based on the delimiter | ||
ListEntries(ctx context.Context, repositoryID graveler.RepositoryID, ref graveler.Ref, prefix, from, delimiter Path) (EntryListingIterator, error) | ||
} | ||
|
||
func NewPath(id string) (Path, error) { | ||
return Path(id), nil | ||
} | ||
|
||
func (id Path) String() string { | ||
return string(id) | ||
} |
Oops, something went wrong.