StoreRpcServer class
Answers StoreProtocol RPCs against a local OmnyStoreApi.
This is the node's half of the control plane. OmnyStoreNode hands every
inbound action from the hub to handle; the hub's RemoteNodeStoreProvider
is the exact mirror, turning OmnyStoreApi calls back into these actions.
Keeping the two symmetric in one protocol is what lets the hub treat a
remote node and an in-process store as the same thing.
Streams become sessions. OmnyStoreApi deals in byte streams, and an RPC channel deals in discrete messages, so a download becomes an open/read/ close session and an upload a begin/chunk/commit one. Sessions hold real resources — an open object read, an in-flight upload — so they time out: a hub that dies mid-download must not leak a file handle on every node it was talking to.
Constructors
-
StoreRpcServer({required OmnyStoreApi store, required Future<
ProviderDescriptor> describeProvider(), IdGenerator? idGenerator, Duration sessionTimeout = const Duration(minutes: 10)}) -
Creates a server over
store.
Properties
-
describeProvider
→ Future<
ProviderDescriptor> Function() -
Describes this node as a provider. Called for StoreProtocol.describe.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- idGenerator → IdGenerator
-
Supplies session identifiers.
final
- openReads → int
-
The number of open download sessions, for tests and diagnostics.
no setter
- openUploads → int
-
The number of in-flight upload sessions.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionTimeout → Duration
-
How long an idle read or upload session survives before being reclaimed.
final
- store → OmnyStoreApi
-
The store being exposed.
final
Methods
-
closeSessions(
) → Future< void> - Closes every open session. Called when the node stops or the hub connection drops — an orphaned session would otherwise hold its object read open until it timed out.
-
handle(
String action, Map< String, dynamic> payload) → Future<Map< String, dynamic> > -
Handles
actionwithpayload, returning the response payload. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited