Source code for multistorageclient.references

 1# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 2# SPDX-License-Identifier: Apache-2.0
 3#
 4# Licensed under the Apache License, Version 2.0 (the "License");
 5# you may not use this file except in compliance with the License.
 6# You may obtain a copy of the License at
 7#
 8# http://www.apache.org/licenses/LICENSE-2.0
 9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""Contracts for integrations that resolve catalog URLs to read-only storage profiles."""
17
18from dataclasses import dataclass
19from datetime import datetime
20from typing import Any, Protocol
21
22
[docs] 23@dataclass(frozen=True) 24class ParsedReference: 25 """A locally parsed dataset root, decoded key, selector kind and authorization scope. 26 27 Set access_scope to None if the effective caller cannot be identified locally. 28 Only immutable identifiers and concrete revisions qualify as canonical roots. 29 """ 30 31 root_url: str 32 relative_path: str 33 is_canonical: bool 34 access_scope: str | None
35 36
[docs] 37@dataclass(frozen=True) 38class BoundProfile: 39 """An authorized JSON-compatible MSC profile and its pinned root. 40 41 reuse_until is the UTC deadline for local reuse, or None to disable reuse. 42 """ 43 44 profile_config: dict[str, Any] 45 canonical_root_url: str 46 reuse_until: datetime | None
47 48
[docs] 49class URLResolver(Protocol): 50 """An explicitly configured URI scheme integration.""" 51
[docs] 52 def parse(self, url: str) -> ParsedReference: 53 """Parse a URI and identify the current caller scope without performing I/O.""" 54 ...
55
[docs] 56 def bind(self, reference: ParsedReference) -> BoundProfile: 57 """Authorize the captured scope and return the pinned storage profile.""" 58 ...