ProviderDescriptor class
The public description of a storage provider: who it is, which organizations it serves, how its bytes are reached, and how much room it has left.
This is what a node announces on registration and what
GET /api/v1/providers returns. Organizations and providers are many to
many: one organization's releases may be spread over (or replicated
across) several nodes, and one node may serve several organizations. That
relation lives in organizations.
- Annotations
-
- @immutable
- @JsonSerializable.new(explicitToJson: true)
Constructors
-
ProviderDescriptor({required String id, ProviderKind kind = ProviderKind.node, Set<
String> organizations = const {}, bool servesAll = false, DataPlaneMode dataPlane = DataPlaneMode.relay, String? baseUrl, Map<String, String> labels = const {}, int priority = 0, int? capacityBytes, int? usedBytes, String agentVersion = 'unknown', ProviderStatus status = ProviderStatus.online, DateTime? lastSeenAt, Map<String, String> metadata = const {}}) - Creates a descriptor. Collections are copied into unmodifiable views.
-
ProviderDescriptor.fromJson(Map<
String, dynamic> json) -
Parses a descriptor from a JSON map.
factory
Properties
- agentVersion → String
-
The provider agent's version string.
final
- baseUrl → String?
-
The provider's publicly reachable base URL, for DataPlaneMode.direct.
final
- capacityBytes → int?
-
Total capacity in bytes, or
nullif the provider does not report one.final - dataPlane → DataPlaneMode
-
How this provider's bytes reach a client.
final
- freeBytes → int?
-
Free capacity in bytes, or
nullif the provider does not report capacity. Never negative.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
Stable identifier, unique across the hub. For a node this is its
OmnyHub
NodeId.final - isReadable → bool
-
Whether this provider can be read from right now.
no setter
- isWritable → bool
-
Whether this provider can accept new writes right now.
no setter
- kind → ProviderKind
-
Whether this is the hub itself or a connected node.
final
-
labels
→ Map<
String, String> -
Key/value labels used for placement filtering (
region=eu,tier=cold).final - lastSeenAt → DateTime?
-
When the hub last heard from this provider (UTC).
final
-
metadata
→ Map<
String, String> -
Arbitrary application-defined key/value pairs.
final
-
organizations
→ Set<
String> -
The names of the organizations this provider serves.
final
- priority → int
-
Selection weight: higher wins when several providers are eligible. Equal
weights are broken deterministically by id, so placement never depends
on registration order.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- servesAll → bool
-
Whether this provider serves every organization, present and future.
final
- status → ProviderStatus
-
Liveness, maintained hub-side from the control connection.
final
- usedBytes → int?
-
Bytes currently stored, or
nullif the provider does not report it.final
Methods
-
copyWith(
{Set< String> ? organizations, bool? servesAll, DataPlaneMode? dataPlane, String? baseUrl, Map<String, String> ? labels, int? priority, int? capacityBytes, int? usedBytes, String? agentVersion, ProviderStatus? status, DateTime? lastSeenAt, Map<String, String> ? metadata}) → ProviderDescriptor - Returns a copy with the given fields replaced.
-
hasRoomFor(
int bytes) → bool -
Whether this provider has room for
bytesmore. -
matchesLabels(
Map< String, String> filter) → bool -
Whether this provider's labels contain every entry in
filter. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
serves(
String organization) → bool -
Whether this provider serves the organization named
organization. -
toJson(
) → Map< String, dynamic> - Serialises the descriptor to a JSON map.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
comparePreferred(
ProviderDescriptor a, ProviderDescriptor b) → int - Orders providers best-first for placement: highest priority, then most free space, then id so the result is stable.