Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions src/main/java/network/crypta/node/runtime/LegacyRuntimePorts.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.Random;
import network.crypta.node.Node;
import network.crypta.node.NodeClientCore;
import network.crypta.runtime.admin.AdminRuntimePortsBundle;
import network.crypta.runtime.admin.AdminRuntimePortsFactory;
import network.crypta.runtime.spi.ConfigPort;
import network.crypta.runtime.spi.ConnectionsPagePort;
import network.crypta.runtime.spi.ConnectionsSupportPort;
Expand Down Expand Up @@ -165,28 +167,30 @@ public long startupTimeMillis() {
};
this.configPort = new LegacyConfigPort(node, core);
this.connectivityPort = new LegacyConnectivityPort(node);
this.connectionsPagePort = new LegacyConnectionsPagePort(node, core);
this.connectionsSupportPort = new LegacyConnectionsSupportPort(node);
this.darknetConnectionsPort = new LegacyDarknetConnectionsPort(node);
this.darknetMessagingPort = new LegacyDarknetMessagingPort(node);
this.diagnosticPort = new LegacyDiagnosticPort(node, core);
this.pageChromePort = new LegacyPageChromePort(node);
this.coreUpdateActionPort = new LegacyCoreUpdateActionPort(node);
this.queueCompletionPort = new LegacyQueueCompletionPort(core);
this.queuePagePort = new LegacyQueuePagePort(core);
this.queueDownloadPort = new LegacyQueueDownloadPort(core);
this.queueInsertPort = new LegacyQueueInsertPort(core);
this.queueMutationPort = new LegacyQueueMutationPort(core);
this.queueSupportPort = new LegacyQueueSupportPort(core);
this.statisticsPort = new LegacyStatisticsPort(node, core);
this.securityLevelsPort = new LegacySecurityLevelsPort(node);
this.firstTimeWizardPort = new LegacyFirstTimeWizardPort(node, core);
this.toadletSymlinkPort = new LegacyToadletSymlinkPort(node, core);
this.welcomePagePort = new LegacyWelcomePagePort(node);
this.welcomeActionPort = new LegacyWelcomeActionPort(node);
this.requestQueuePort = new LegacyRequestQueuePort(core);
this.nodeInfoPort = new LegacyNodeInfoPort(node);
this.peerPort = new LegacyPeerPort(node);

AdminRuntimePortsBundle adminRuntimePorts = AdminRuntimePortsFactory.create(node, core);
this.connectionsPagePort = adminRuntimePorts.connectionsPage();
this.connectionsSupportPort = adminRuntimePorts.connectionsSupport();
this.darknetConnectionsPort = adminRuntimePorts.darknetConnections();
this.darknetMessagingPort = adminRuntimePorts.darknetMessaging();
this.diagnosticPort = adminRuntimePorts.diagnostic();
this.pageChromePort = adminRuntimePorts.pageChrome();
this.queueCompletionPort = adminRuntimePorts.queueCompletion();
this.queuePagePort = adminRuntimePorts.queuePage();
this.queueDownloadPort = adminRuntimePorts.queueDownload();
this.queueInsertPort = adminRuntimePorts.queueInsert();
this.queueMutationPort = adminRuntimePorts.queueMutation();
this.queueSupportPort = adminRuntimePorts.queueSupport();
this.statisticsPort = adminRuntimePorts.statistics();
this.firstTimeWizardPort = adminRuntimePorts.firstTimeWizard();
this.toadletSymlinkPort = adminRuntimePorts.toadletSymlinks();
this.welcomePagePort = adminRuntimePorts.welcomePage();
this.welcomeActionPort = adminRuntimePorts.welcomeAction();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package network.crypta.runtime.admin;

import network.crypta.runtime.spi.ConnectionsPagePort;
import network.crypta.runtime.spi.ConnectionsSupportPort;
import network.crypta.runtime.spi.DarknetConnectionsPort;
import network.crypta.runtime.spi.DarknetMessagingPort;
import network.crypta.runtime.spi.DiagnosticPort;
import network.crypta.runtime.spi.FirstTimeWizardPort;
import network.crypta.runtime.spi.PageChromePort;
import network.crypta.runtime.spi.QueueCompletionPort;
import network.crypta.runtime.spi.QueueDownloadPort;
import network.crypta.runtime.spi.QueueInsertPort;
import network.crypta.runtime.spi.QueueMutationPort;
import network.crypta.runtime.spi.QueuePagePort;
import network.crypta.runtime.spi.QueueSupportPort;
import network.crypta.runtime.spi.StatisticsPort;
import network.crypta.runtime.spi.ToadletSymlinkPort;
import network.crypta.runtime.spi.WelcomeActionPort;
import network.crypta.runtime.spi.WelcomePagePort;

/**
* Groups the admin and page-oriented runtime SPI adapters owned by this package.
*
* <p>This record is the package-local handoff between {@link AdminRuntimePortsFactory} and {@link
* network.crypta.node.runtime.LegacyRuntimePorts}. It lets the admin adapter cluster move together
* without forcing the node-runtime nucleus to know which concrete classes implement the various
* page, queue, and welcome flows. Callers typically create one bundle during runtime-port assembly
* and then keep the individual port references in longer-lived wiring objects.
*
* <p>The record is immutable, but the contained ports are still live adapters over the mutable
* daemon state. Holding a bundle does not snapshot node data, queue state, or welcome-page values.
* It only preserves a stable set of adapter instances, so the surrounding wiring can pass them
* around as one explicit ownership boundary.
*
* @param connectionsPage adapter that renders detached connections-page snapshots for admin pages
* @param connectionsSupport adapter that exposes installer and peer-offer helpers for connections
* UI
* @param darknetConnections adapter that resolves detached darknet friend actions against live
* peers
* @param darknetMessaging adapter that sends detached darknet messages and file offers on demand
* @param diagnostic adapter that exports detached diagnostic and report-oriented admin snapshots
* @param pageChrome adapter that exposes shared page-shell status for admin toadlets and page maker
* @param queueCompletion adapter that serves queue-completion exports and completion-oriented
* actions
* @param queuePage adapter that renders detached queue-page snapshots and key-list exports
* @param queueDownload adapter that performs queue download mutations through detached inputs
* @param queueInsert adapter that performs queue insert mutations through detached inputs
* @param queueMutation adapter that applies generic queue item mutation and removal operations
* @param queueSupport adapter that exposes queue availability, persistence state, and panic helpers
* @param statistics adapter that renders detached statistics-page snapshots for the admin UI
* @param firstTimeWizard adapter that exports and applies first-time-wizard detached state
* @param toadletSymlinks adapter that persists detached symlink configuration for admin toadlets
* @param welcomePage adapter that exports detached welcome-page read state and log excerpts
* @param welcomeAction adapter that applies detached welcome-page action and bandwidth submissions
*/
public record AdminRuntimePortsBundle(
ConnectionsPagePort connectionsPage,
ConnectionsSupportPort connectionsSupport,
DarknetConnectionsPort darknetConnections,
DarknetMessagingPort darknetMessaging,
DiagnosticPort diagnostic,
PageChromePort pageChrome,
QueueCompletionPort queueCompletion,
QueuePagePort queuePage,
QueueDownloadPort queueDownload,
QueueInsertPort queueInsert,
QueueMutationPort queueMutation,
QueueSupportPort queueSupport,
StatisticsPort statistics,
FirstTimeWizardPort firstTimeWizard,
ToadletSymlinkPort toadletSymlinks,
WelcomePagePort welcomePage,
WelcomeActionPort welcomeAction) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package network.crypta.runtime.admin;

import network.crypta.node.Node;
import network.crypta.node.NodeClientCore;

/**
* Creates the legacy admin and page-oriented runtime SPI adapters as one package-owned bundle.
*
* <p>This factory keeps the construction details for the transitional admin cluster inside {@code
* network.crypta.runtime.admin}. The surrounding node-runtime wiring only needs to know that there
* is one coherent group of page, queue, statistics, and welcome adapters that depend on the live
* daemon {@link Node} and {@link NodeClientCore}. That keeps the move mechanical in this PR while
* making the ownership boundary explicit for later extraction work.
*
* <p>The factory is intentionally small. It does not cache adapters, interpret the daemon state, or
* add policy on top of the existing constructors. Each call creates a fresh immutable {@link
* AdminRuntimePortsBundle} whose members preserve the legacy adapter behavior and lifecycle
* expectations.
*/
public final class AdminRuntimePortsFactory {
private AdminRuntimePortsFactory() {}

/**
* Creates the admin/page runtime-port bundle backed by the current daemon node and client core.
*
* <p>Callers normally invoke this once while assembling {@link
* network.crypta.node.runtime.LegacyRuntimePorts}. The returned bundle contains the exact legacy
* adapter set that was moved out of {@code network.crypta.node.runtime}, with queue-oriented
* adapters bound to {@code core} and page or node-state adapters bound to {@code node}. The
* method performs no validation beyond the constructors it delegates to.
*
* @param node live daemon node used by node-backed admin adapters and page state lookups
* @param core live client core used by queue, wizard, and persistence-oriented adapters
* @return immutable bundle containing the moved admin and page-oriented runtime adapters
*/
public static AdminRuntimePortsBundle create(Node node, NodeClientCore core) {
return new AdminRuntimePortsBundle(
new LegacyConnectionsPagePort(node, core),
new LegacyConnectionsSupportPort(node),
new LegacyDarknetConnectionsPort(node),
new LegacyDarknetMessagingPort(node),
new LegacyDiagnosticPort(node, core),
new LegacyPageChromePort(node),
new LegacyQueueCompletionPort(core),
new LegacyQueuePagePort(core),
new LegacyQueueDownloadPort(core),
new LegacyQueueInsertPort(core),
new LegacyQueueMutationPort(core),
new LegacyQueueSupportPort(core),
new LegacyStatisticsPort(node, core),
new LegacyFirstTimeWizardPort(node, core),
new LegacyToadletSymlinkPort(node, core),
new LegacyWelcomePagePort(node),
new LegacyWelcomeActionPort(node));
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.text.DecimalFormat;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.DataOutputStream;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.util.Objects;
import network.crypta.node.DarknetPeerNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.File;
import java.text.DecimalFormat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.util.Objects;
import network.crypta.node.DarknetPeerNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.IOException;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.FileNotFoundException;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.util.List;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.File;
import java.time.Instant;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.IOException;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.util.Objects;
import network.crypta.config.InvalidConfigValueException;
Expand All @@ -25,7 +25,7 @@
* present, writes the same config keys, and swallows restart-required exceptions exactly as the
* legacy welcome toadlet did. The class is package-private because it is an implementation detail
* behind {@link WelcomeActionPort}; callers should depend on the SPI surface exposed through {@link
* LegacyRuntimePorts} instead of constructing this adapter directly.
* network.crypta.node.runtime.LegacyRuntimePorts} instead of constructing this adapter directly.
*/
final class LegacyWelcomeActionPort implements WelcomeActionPort {
/** Small delay that lets the HTTP layer finish its redirect before shutdown or restart begins. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package network.crypta.node.runtime;
package network.crypta.runtime.admin;

import java.io.File;
import java.io.IOException;
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/network/crypta/runtime/admin/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Legacy admin and page-oriented runtime SPI adapters.
*
* <p>This package intentionally groups the transitional runtime adapters that back the legacy admin
* pages, queue views, statistics reports, and welcome or first-time-wizard flows. The adapters
* still depend on daemon-local services such as {@code Node}, {@code NodeClientCore}, HTTP helper
* classes, and queue/reporting internals, but they present the detached {@code runtime-spi}
* interfaces expected by higher-level wiring.
*
* <p>Keeping these classes here makes the ownership boundary explicit. The narrower {@code
* network.crypta.node.runtime} package can keep the core runtime nucleus, while this package
* carries the page-oriented compatibility layer that may later be extracted or reshaped as a more
* focused adapter cluster.
*/
package network.crypta.runtime.admin;
Loading
Loading