Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Additional catalog client functionality for cache eviction #301

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions go/tasks/pluginmachinery/catalog/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ type Client interface {
// GetOrExtendReservation tries to retrieve a (valid) reservation for the given key, creating a new one using the
// specified owner ID if none was found or updating an existing one if it has expired.
GetOrExtendReservation(ctx context.Context, key Key, ownerID string, heartbeatInterval time.Duration) (*datacatalog.Reservation, error)
// GetOrExtendReservationByArtifactTag tries to retrieve a (valid) reservation for the given dataset ID and artifact
// tag, creating a new one using the specified owner ID if none was found or updating an existing one if it has expired.
GetOrExtendReservationByArtifactTag(ctx context.Context, datasetID *datacatalog.DatasetID, artifactTag string, ownerID string, heartbeatInterval time.Duration) (*datacatalog.Reservation, error)
// Put stores the given data using the specified key, creating artifact entries as required.
// To update an existing artifact, use Update instead.
Put(ctx context.Context, key Key, reader io.OutputReader, metadata Metadata) (Status, error)
Expand All @@ -139,6 +142,17 @@ type Client interface {
Update(ctx context.Context, key Key, reader io.OutputReader, metadata Metadata) (Status, error)
// ReleaseReservation releases an acquired reservation for the given key and owner ID.
ReleaseReservation(ctx context.Context, key Key, ownerID string) error
// ReleaseReservationByArtifactTag releases an acquired reservation for the given dataset ID, artifact tag and
// owner ID.
ReleaseReservationByArtifactTag(ctx context.Context, datasetID *datacatalog.DatasetID, artifactTag string, ownerID string) error
// Delete removes the artifact associated with the given key and deletes its underlying data from blob storage.
Delete(ctx context.Context, key Key) error
// DeleteByArtifactTag removes the artifact associated with the given dataset ID and artifact tag and deletes its
// underlying data from blob storage.
DeleteByArtifactTag(ctx context.Context, datasetID *datacatalog.DatasetID, artifactTag string) error
// DeleteByArtifactID removes the artifact associated with the given dataset and artifact ID and deletes its
// underlying data from blob storage.
DeleteByArtifactID(ctx context.Context, datasetID *datacatalog.DatasetID, artifactID string) error
}

func IsNotFound(err error) bool {
Expand Down
169 changes: 169 additions & 0 deletions go/tasks/pluginmachinery/catalog/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.