// Copyright AGNTCY Contributors (https://github.com/agntcy) // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; package agntcy.dir.store.v1; import "agntcy/dir/core/v1/record.proto"; import "agntcy/dir/core/v1/referrer.proto"; import "google/protobuf/empty.proto"; import "buf/validate/validate.proto"; import "agntcy/dir/core/v1/rules.proto"; import "google/protobuf/struct.proto"; // Defines an interface for content-addressable storage // service for objects. // // Max object size: 4MB (to fully fit in a single request) // Max metadata size: 100KB // // Store service can be implemented by various storage backends, // such as local file system, OCI registry, etc. // // Middleware should be used to control who can perform these RPCs. // Policies for the middleware can be handled via separate service. // // Each operation is performed sequentially, meaning that // for the N-th request, N-th response will be returned. // If an error occurs, the stream will be cancelled. service StoreService { // Push performs write operation for given records. rpc Push(stream core.v1.Record) returns (stream core.v1.RecordRef); // Pull performs read operation for given records. rpc Pull(stream core.v1.RecordRef) returns (stream core.v1.Record); // Lookup resolves basic metadata for the records. rpc Lookup(stream core.v1.RecordRef) returns (stream core.v1.RecordMeta); // Remove performs delete operation for the records. rpc Delete(stream core.v1.RecordRef) returns (google.protobuf.Empty); // PushReferrer performs write operation for record referrers. rpc PushReferrer(stream PushReferrerRequest) returns (stream PushReferrerResponse); // PullReferrer performs read operation for record referrers. rpc PullReferrer(stream PullReferrerRequest) returns (stream PullReferrerResponse); // DeleteReferrer performs delete operation for record referrers. rpc DeleteReferrer(stream DeleteReferrerRequest) returns (stream DeleteReferrerResponse); } // PushReferrerRequest represents a record with optional OCI artifacts for push operations. message PushReferrerRequest { // Record reference core.v1.RecordRef record_ref = 1 [ (buf.validate.field).required = true ]; // The type of the referrer. // For example, "agntcy.dir.sign.v1.Signature" for signatures. string type = 2 [ (buf.validate.field).required = true, (buf.validate.field).string.(core.v1.is_referrer_type) = true ]; // Annotations attached to the referrer object. map annotations = 3; // Creation timestamp of the record in the RFC3339 format. // Specs: https://www.rfc-editor.org/rfc/rfc3339.html string created_at = 4; // The actual data of the referrer. google.protobuf.Struct data = 5; } // PushReferrerResponse message PushReferrerResponse { // The push process result bool success = 1; // Optional error message if push failed optional string error_message = 2; // The CID of the referrer core.v1.ReferrerRef referrer_ref = 3; } // PullReferrerRequest represents a record with optional OCI artifacts for pull operations. message PullReferrerRequest { // Record reference core.v1.RecordRef record_ref = 1 [ (buf.validate.field).required = true ]; // Record referrer type to be pulled // If not provided, all referrers will be pulled optional string referrer_type = 2 [ (buf.validate.field).string.(core.v1.is_referrer_type) = true ]; // If set, return the given referrer. optional core.v1.ReferrerRef referrer_ref = 3; } // PullReferrerResponse is returned after successfully fetching a record referrer. message PullReferrerResponse { // RecordReferrer object associated with the record core.v1.RecordReferrer referrer = 1; } message DeleteReferrerRequest { // The record the referrer(s) are referring to. core.v1.RecordRef record = 1 [ (buf.validate.field).required = true ]; // The CID of the referrer to delete. // If set, delete the referrer by CID. optional core.v1.ReferrerRef referrer_ref = 2; // The referrer type of the referrers to delete. // If set, delete the referrers with given type. optional string referrer_type = 3 [ (buf.validate.field).string.(core.v1.is_referrer_type) = true ]; } message DeleteReferrerResponse { // The CID(s) of the deleted referrers. repeated core.v1.ReferrerRef referrer_refs = 1; }