Branch data Line data Source code
1 : : // Copyright 2026 HPActor Contributors
2 : : //
3 : : // Licensed under the Apache License, Version 2.0 (the "License");
4 : : // you may not use this file except in compliance with the License.
5 : : // You may obtain a copy of the License at
6 : : //
7 : : // http://www.apache.org/licenses/LICENSE-2.0
8 : : //
9 : : // Unless required by applicable law or agreed to in writing, software
10 : : // distributed under the License is distributed on an "AS IS" BASIS,
11 : : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : : // See the License for the specific language governing permissions and
13 : : // limitations under the License.
14 : :
15 : : #pragma once
16 : :
17 : : #include <hpactor/actor/event_based_actor.hpp>
18 : : #include <hpactor/actor_type_registry.hpp>
19 : : #include <hpactor/net/frame.hpp>
20 : : #include <hpactor/spawn.hpp>
21 : :
22 : : namespace hpactor {
23 : :
24 : : // -----------------------------------------------------------------------------
25 : : // SpawnReceiver - system actor handling remote spawn requests
26 : : // -----------------------------------------------------------------------------
27 : : // Receives SpawnRequest messages, creates actors via ActorTypeRegistry,
28 : : // and sends SpawnResponse back to the caller via Transport.
29 : : class SpawnReceiver : public EventBasedActor {
30 : : public:
31 : : SpawnReceiver(ActorSystem& sys, ActorTypeRegistry& registry,
32 : : net::Transport* transport);
33 : :
34 : : Behavior make_behavior() override;
35 : :
36 : 0 : bool is_system_actor() const override {
37 : 0 : return true;
38 : : }
39 : :
40 : : private:
41 : : void handle_spawn_request(const SpawnRequest& req, const net::WireFrame& frame);
42 : :
43 : : ActorTypeRegistry& registry_;
44 : : net::Transport* transport_; // non-owning
45 : : };
46 : :
47 : : } // namespace hpactor
|