Class RestApiServer
- All Implemented Interfaces:
AutoCloseable
STATUS: INTENTIONALLY DISABLED / DE-SCOPED
This REST ingress layer is not production-ready and is intentionally disabled.
Both start() and startUnsafeDirectApi() throw
IllegalStateException because the current implementation bypasses two
critical safety paths:
- Authentication -- direct registry access has no mTLS certificate validation or CN-based permission checks.
- Raft consensus -- mutations go straight to the local
DataStructureRegistrywithout being proposed through the Raft log, breaking linearizability and replication guarantees.
The handler methods and router logic are retained so they can be wired into a
proper auth + Raft pipeline in a future release. Until then, the only supported
ingress path is the custom binary protocol via TcpServer.
Endpoint groups (for future reference):
- Map operations: GET/PUT/DELETE/LIST/QUERY
- Queue operations: OFFER/POLL/SIZE
- Set operations: ADD/REMOVE/MEMBERS
- Topic operations: PUBLISH/SUBSCRIBE (SSE)
- Cluster operations: INFO/MEMBERS/HEALTH
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRestApiServer(int port, DataStructureRegistry registry) Deprecated.Create a REST API server bound to loopback (127.0.0.1) by default.RestApiServer(int port, String bindAddress, DataStructureRegistry registry) Deprecated.Create a REST API server bound to a specific address. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Deprecated.voidhandleClusterHealth(HttpExchange exchange) Deprecated.Handle GET /api/v1/cluster/healthvoidhandleClusterInfo(HttpExchange exchange) Deprecated.Handle GET /api/v1/cluster/infovoidhandleClusterMembers(HttpExchange exchange) Deprecated.Handle GET /api/v1/cluster/membersvoidhandleMapDelete(HttpExchange exchange, String mapName, String key) Deprecated.Handle DELETE /api/v1/maps/{mapName}/{key}voidhandleMapGet(HttpExchange exchange, String mapName, String key) Deprecated.Handle GET /api/v1/maps/{mapName}/{key}voidhandleMapList(HttpExchange exchange, String mapName, Map<String, String> queryParams) Deprecated.Handle GET /api/v1/maps/{mapName} — list all keys with paginationvoidhandleMapPut(HttpExchange exchange, String mapName, String key) Deprecated.Handle PUT /api/v1/maps/{mapName}/{key}voidhandleMapQuery(HttpExchange exchange, String mapName) Deprecated.Handle POST /api/v1/maps/{mapName}/query — SQL queryvoidhandleQueueOffer(HttpExchange exchange, String queueName) Deprecated.Handle POST /api/v1/queues/{queueName}/offervoidhandleQueuePoll(HttpExchange exchange, String queueName) Deprecated.Handle POST /api/v1/queues/{queueName}/pollvoidhandleQueueSize(HttpExchange exchange, String queueName) Deprecated.Handle GET /api/v1/queues/{queueName}/sizevoidhandleSetAdd(HttpExchange exchange, String setName) Deprecated.Handle POST /api/v1/sets/{setName}/addvoidhandleSetMembers(HttpExchange exchange, String setName) Deprecated.Handle GET /api/v1/sets/{setName}/membersvoidhandleSetRemove(HttpExchange exchange, String setName, String element) Deprecated.Handle DELETE /api/v1/sets/{setName}/{element}voidhandleTopicPublish(HttpExchange exchange, String topicName) Deprecated.Handle POST /api/v1/topics/{name}/publishvoidhandleTopicSubscribe(HttpExchange exchange, String topicName) Deprecated.Handle GET /api/v1/topics/{name}/subscribe (Server-Sent Events)voidsetClusterInfoSuppliers(Map<String, Object> suppliers) Deprecated.Set cluster info suppliers (called from CacheNode to expose cluster state).voidstart()Deprecated.REST ingress is de-scoped.voidDeprecated.REST ingress is de-scoped.voidstop()Deprecated.Stop the REST API server.
-
Constructor Details
-
RestApiServer
Deprecated.Create a REST API server bound to loopback (127.0.0.1) by default.- Parameters:
port- the port to listen onregistry- the data structure registry
-
RestApiServer
Deprecated.Create a REST API server bound to a specific address.- Parameters:
port- the port to listen onbindAddress- the address to bind to (e.g., "127.0.0.1" or "0.0.0.0")registry- the data structure registry
-
-
Method Details
-
start
Deprecated.REST ingress is de-scoped. Use the binary protocol via TcpServer.Start the REST API server.Intentionally disabled. Always throws
IllegalStateExceptionbecause the current implementation bypasses authentication and Raft consensus. This method will be re-enabled once REST ingress is wired through the proper auth + Raft pipeline.- Throws:
IllegalStateException- always -- REST ingress is de-scopedIOException
-
startUnsafeDirectApi
Deprecated.REST ingress is de-scoped. Use the binary protocol via TcpServer.Legacy startup path retained only to preserve binary compatibility for callers that still instantiate the server directly.Intentionally disabled. Always throws
IllegalStateExceptionbecause direct registry-backed REST bypasses authentication and Raft consensus.- Throws:
IllegalStateException- always -- REST ingress is de-scoped
-
stop
public void stop()Deprecated.Stop the REST API server. -
setClusterInfoSuppliers
-
handleMapGet
-
handleMapPut
-
handleMapDelete
-
handleMapList
public void handleMapList(HttpExchange exchange, String mapName, Map<String, String> queryParams) throws IOExceptionDeprecated.Handle GET /api/v1/maps/{mapName} — list all keys with pagination- Throws:
IOException
-
handleMapQuery
-
handleQueueOffer
-
handleQueuePoll
-
handleQueueSize
-
handleSetAdd
-
handleSetRemove
public void handleSetRemove(HttpExchange exchange, String setName, String element) throws IOException Deprecated.Handle DELETE /api/v1/sets/{setName}/{element}- Throws:
IOException
-
handleSetMembers
-
handleTopicPublish
-
handleTopicSubscribe
Deprecated.Handle GET /api/v1/topics/{name}/subscribe (Server-Sent Events) -
handleClusterInfo
-
handleClusterMembers
-
handleClusterHealth
-
close
-