OmnyStoreNode class

A storage node: an OmnyStore that dials a hub and serves its organizations' releases through it.

The node is the unit of capacity and ownership in a federated deployment. It holds the metadata and the bytes for the organizations it serves, and answers the hub's calls over an outbound WebSocket — so it can sit behind NAT, on a private network, or in a different cloud from the hub, and still be a first-class part of a public registry.

final node = OmnyStoreNode(
  hubUri: Uri.parse('wss://store.example.com/_node'),
  nodeId: 'node-eu',
  organizations: {'acme', 'globex'},
  store: OmnyStore(
    repositories: MemoryRepositories(),
    storage: S3ObjectStorage(
      bucket: 'acme-releases',
      region: 'eu-west-1',
      credentials: EnvironmentAwsCredentialsProvider(Platform.environment),
    ),
    providerId: 'node-eu',
  ),
  authToken: Platform.environment['OMNYSTORE_NODE_TOKEN'],
);

await node.start();

Reconnection is automatic. The underlying NodeRuntime reconnects with exponential backoff and re-registers, so a hub restart or a network blip heals without operator action. Downloads in flight over the relay fail and must be retried; a client behind a DownloadManager resumes them.

The data plane is chosen from what the node can do. If its object storage can presign URLs the node advertises DataPlaneMode.presigned and clients fetch straight from the bucket. If it is reachable at publicBaseUrl it advertises DataPlaneMode.direct. Otherwise it falls back to DataPlaneMode.relay, where artifact bytes are chunked over the control channel — always correct, and the slowest of the three.

Constructors

OmnyStoreNode({required Uri hubUri, required String nodeId, required OmnyStore store, Set<String> organizations = const {}, String? publicBaseUrl, Map<String, String> labels = const {}, int priority = 0, int? capacityBytes, Logger logger = const NoopLogger(), String? authToken, Duration heartbeatInterval = const Duration(seconds: 10), Duration sessionTimeout = const Duration(minutes: 10), ReconnectPolicy? reconnect, NodeRuntime? runtime, StoreRpcServer? rpc})
Creates a node.

Properties

capacityBytes int?
Total capacity in bytes, or null if unbounded/unknown.
final
hashCode int
The hash code for this object.
no setterinherited
isDraining bool
Whether the node is draining: still serving downloads, taking no writes.
no setter
isReady bool
Whether the node is registered with the hub and serving.
no setter
labels Map<String, String>
Placement labels advertised to the hub (region=eu, tier=cold).
final
logger Logger
Structured logging.
final
nodeId String
This node's identifier, unique within the hub.
final
organizations Set<String>
The organizations this node serves.
final
priority int
Selection weight: higher wins when several nodes serve one organization.
final
publicBaseUrl String?
The node's publicly reachable base URL, enabling DataPlaneMode.direct. null means the node is not reachable and bytes are relayed.
final
rpc StoreRpcServer
The RPC server answering the hub's calls.
latefinal
runtime ↔ NodeRuntime
The underlying OmnyHub node runtime: connection, registration, heartbeating and reconnection.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
states Stream<NodeState>
Lifecycle transitions of the hub connection.
no setter
store OmnyStore
The store holding this node's organizations.
final

Methods

close() Future<void>
Stops the node and closes its store.
describe() Future<ProviderDescriptor>
This node's current provider descriptor.
drain() Future<void>
Stops accepting new writes while continuing to serve downloads, and tells the hub.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resume() Future<void>
Resumes accepting writes after a drain.
start() Future<void>
Connects to the hub and registers. Returns once the node is serving.
stop() Future<void>
Disconnects from the hub, closing every in-flight relay session.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited