// Copyright AGNTCY Contributors (https://github.com/agntcy) // SPDX-License-Identifier: Apache-2.0 syntax = "proto3"; package agntcy.dir.store.v1; // SyncService provides functionality for synchronizing objects between Directory nodes. // // This service enables one-way synchronization from a remote Directory node to the local node, // allowing distributed Directory instances to share and replicate objects. The service supports // both on-demand synchronization and tracking of sync operations through their lifecycle. service SyncService { // CreateSync initiates a new synchronization operation from a remote Directory node. // // The operation is non-blocking and returns immediately with a sync ID that can be used // to track progress and manage the sync operation. rpc CreateSync(CreateSyncRequest) returns (CreateSyncResponse); // ListSyncs returns a stream of all sync operations known to the system. // // This includes active, completed, and failed synchronizations. rpc ListSyncs(ListSyncsRequest) returns (stream ListSyncsItem); // GetSync retrieves detailed status information for a specific synchronization. rpc GetSync(GetSyncRequest) returns (GetSyncResponse); // DeleteSync removes a synchronization operation from the system. rpc DeleteSync(DeleteSyncRequest) returns (DeleteSyncResponse); // RequestRegistryCredentials requests registry credentials between two Directory nodes. // // This RPC allows a requesting node to authenticate with this node and obtain // temporary registry credentials for secure OCI synchronization. rpc RequestRegistryCredentials(RequestRegistryCredentialsRequest) returns (RequestRegistryCredentialsResponse); } // CreateSyncRequest defines the parameters for creating a new synchronization operation. // // Supports two modes: // 1. Standard sync: provide remote_directory_url to negotiate registry credentials via gRPC. // 2. Direct registry sync: provide remote_registry_url (and optionally repository_name) to pull // directly from a public OCI registry without credential negotiation. // // At least one of remote_directory_url or remote_registry_url must be provided. message CreateSyncRequest { // URL of the remote Directory to synchronize from. // // Used for credential negotiation via gRPC. Optional when remote_registry_url is provided. // Examples: // - "https://directory.example.com" // - "http://localhost:8080" // - "https://directory.example.com:9443" string remote_directory_url = 1; // List of CIDs to synchronize from the remote Directory. // If empty, all objects will be synchronized. repeated string cids = 2; // URL of the remote OCI registry to pull from directly, bypassing credential negotiation. // When set, the sync worker pulls from this registry without calling RequestRegistryCredentials. // Examples: // - "https://registry.example.com" // - "https://ghcr.io" // - "http://localhost:5555" string remote_registry_url = 3; // Repository name within the registry. Used with remote_registry_url. // Defaults to "dir" if not specified. string repository_name = 4; } // CreateSyncResponse contains the result of creating a new synchronization operation. message CreateSyncResponse { // Unique identifier for the created synchronization operation. // This ID can be used with other SyncService RPCs to monitor and manage the sync. string sync_id = 1; } // ListSyncsRequest specifies parameters for listing synchronization operations. message ListSyncsRequest { // Optional limit on the number of results to return. optional uint32 limit = 2; // Optional offset for pagination of results. optional uint32 offset = 3; } // ListSyncItem represents a single synchronization in the list of all syncs. message ListSyncsItem { // Unique identifier of the synchronization operation. string sync_id = 1; // Current status of the synchronization operation. SyncStatus status = 2; // URL of the remote Directory being synchronized from. string remote_directory_url = 3; // URL of the remote OCI registry for direct registry sync (empty for standard sync). string remote_registry_url = 4; // Repository name within the registry. string repository_name = 5; } // GetSyncRequest specifies which synchronization status to retrieve. message GetSyncRequest { // Unique identifier of the synchronization operation to query. string sync_id = 1; } // GetSyncResponse provides detailed information about a specific synchronization operation. message GetSyncResponse { // Unique identifier of the synchronization operation. string sync_id = 1; // Current status of the synchronization operation. SyncStatus status = 2; // URL of the remote Directory node being synchronized from. string remote_directory_url = 3; // Timestamp when the synchronization operation was created in the RFC3339 format. // Specs: https://www.rfc-editor.org/rfc/rfc3339.html string created_time = 4; // Timestamp of the most recent status update for this synchronization in the RFC3339 format. string last_update_time = 5; // URL of the remote OCI registry for direct registry sync (empty for standard sync). string remote_registry_url = 6; // Repository name within the registry. string repository_name = 7; } // DeleteSyncRequest specifies which synchronization to delete. message DeleteSyncRequest { // Unique identifier of the synchronization operation to delete. string sync_id = 1; } // DeleteSyncResponse message DeleteSyncResponse {} message RequestRegistryCredentialsRequest {} message RequestRegistryCredentialsResponse { // Success status of the credential negotiation bool success = 1; // Error message if negotiation failed string error_message = 2; // Address of the remote Registry (e.g., "ghcr.io", "dir-zot.default.svc.cluster.local:5000") string registry_address = 3; // Repository name within the registry (e.g., "user/dir-test/dir", "dir") string repository_name = 6; // Registry credentials (oneof based on credential type) oneof credentials { BasicAuthCredentials basic_auth = 4; // CertificateCredentials certificate = 5; } // Whether the registry uses plain HTTP (insecure) instead of HTTPS // When true, TLS should be disabled for connections to this registry bool insecure = 7; } // Supporting credential type definitions message BasicAuthCredentials { string username = 1; string password = 2; } // SyncStatus enumeration defines the possible states of a synchronization operation. enum SyncStatus { // Default/unset status - should not be used in practice SYNC_STATUS_UNSPECIFIED = 0; // Sync operation has been created but not yet started SYNC_STATUS_PENDING = 1; // Sync operation is actively discovering and transferring objects SYNC_STATUS_IN_PROGRESS = 2; // Sync operation encountered an error and stopped SYNC_STATUS_FAILED = 3; // Sync operation has been marked for deletion but cleanup not yet started SYNC_STATUS_DELETE_PENDING = 4; // Sync operation has been successfully deleted and cleaned up SYNC_STATUS_DELETED = 5; // Sync operation has completed successfully SYNC_STATUS_COMPLETED = 6; }