Skip to content

Commit fd786db

Browse files
committed
Update protobufs
1 parent 87f7ebf commit fd786db

File tree

16 files changed

+648
-2840
lines changed

16 files changed

+648
-2840
lines changed

protobuf/eigr/actor.proto protobuf/eigr/functions/protocol/actors/actor.proto

+45-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
syntax = "proto3";
22

3-
package eigr.actors;
3+
package eigr.functions.protocol.actors;
44

55
import "google/protobuf/any.proto";
66

@@ -75,19 +75,56 @@ message Metadata {
7575
map<string, string> tags = 2;
7676
}
7777

78+
// The type that defines the runtime characteristics of the Actor.
79+
// Regardless of the type of actor it is important that
80+
// all actors are registered during the proxy and host initialization phase.
81+
enum Kind {
82+
// When no type is informed, the default to be assumed will be the Singleton pattern.
83+
UNKNOW_KIND = 0;
84+
85+
// Abstract actors are used to create children of this based actor at runtime
86+
ABSTRACT = 1;
87+
88+
// Singleton actors as the name suggests have only one real instance of themselves running
89+
// during their entire lifecycle. That is, they are the opposite of the Abstract type Actors.
90+
SINGLETON = 2;
91+
92+
// Pooled Actors are similar to abstract actors, but unlike them,
93+
// their identifying name will always be the one registered at the system initialization stage.
94+
// The great advantage of Pooled actors is that they have multiple instances of themselves
95+
// acting as a request service pool.
96+
// Pooled actors are also stateless actors, that is, they will not have their
97+
// in-memory state persisted via Statesstore. This is done to avoid problems
98+
// with the correctness of the stored state.
99+
// Pooled Actors are generally used for tasks where the Actor Model would perform worse
100+
// than other concurrency models and for tasks that do not require state concerns.
101+
// Integration flows, data caching, proxies are good examples of use cases
102+
// for this type of Actor.
103+
POOLED = 3;
104+
105+
// Reserved for future use
106+
PROXY = 4;
107+
}
108+
78109
message ActorSettings {
79110

80-
// Indicates if actor´s is abstract or non abstract.
81-
bool abstract = 1;
111+
// Indicates the type of Actor to be configured.
112+
Kind kind = 1;
82113

83114
// Indicates whether an actor's state should be persisted in a definitive store.
84-
bool persistent = 2;
115+
bool stateful = 2;
85116

86117
// Snapshot strategy
87118
ActorSnapshotStrategy snapshot_strategy = 3;
88119

89120
// Deactivate strategy
90121
ActorDeactivationStrategy deactivation_strategy = 4;
122+
123+
// When kind is POOLED this is used to define minimun actor instances
124+
int32 min_pool_size = 5;
125+
126+
// When kind is POOLED this is used to define maximum actor instances
127+
int32 max_pool_size = 6;
91128
}
92129

93130
message ActorId {
@@ -96,6 +133,10 @@ message ActorId {
96133

97134
// Name of a ActorSystem
98135
string system = 2;
136+
137+
// When the Actor is of the Abstract type,
138+
// the name of the parent Actor must be informed here.
139+
string parent = 3;
99140
}
100141

101142
message Actor {

protobuf/eigr/functions/protocol/actors/protocol.proto

+443
Large diffs are not rendered by default.

protobuf/eigr/protocol.proto

-344
This file was deleted.

requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ google-api>=0.1.12
33
googleapis-common-protos>=1.56.4
44
flask>=2.1.3
55
protobuf>=3.20.0
6-
grpcio>=1.48.1
7-
grpcio-tools>=1.0.0
86
pytest>=7.1.2

scripts/compile-pb.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -o errexit
55
set -o pipefail
66

77
# follow the basic steps here: https://grpc.io/docs/tutorials/basic/python/
8-
python3 -m grpc_tools.protoc -I ../protobuf/ --python_out=../spawn eigr/actor.proto
9-
python3 -m grpc_tools.protoc -I ../protobuf/ --python_out=../spawn eigr/protocol.proto
8+
protoc -I ../protobuf/ --python_out=../spawn eigr/functions/protocol/actors/actor.proto
9+
protoc -I ../protobuf/ --python_out=../spawn eigr/functions/protocol/actors/protocol.proto
1010

11-
python3 -m grpc_tools.protoc -I ../example/protobuf/ --python_out=../example ../example/protobuf/domain/domain.proto
11+
protoc -I ../example/protobuf/ --python_out=../example ../example/protobuf/domain/domain.proto

setup.cfg

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ install_requires =
2222
attrs == 21.4.0
2323
google-api == 0.1.12
2424
googleapis-common-protos == 1.56.4
25-
grpcio == 1.48.1
26-
grpcio-tools == 1.0.0
2725
flask == 2.1.3
2826
protobuf == 3.20.0
2927
pytest == 7.1.2

setup.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def run(self):
3535
file_path = pathlib.Path(root) / file
3636
destination = "."
3737
print(f"compiling {file_path} to {destination}")
38-
command = f"python -m grpc_tools.protoc {' '.join([' -I ' + i for i in proto_roots + proto_lib_roots])} --python_out={destination} --grpc_python_out={destination} {file_path}" # noqa
38+
command = f"protoc {' '.join([' -I ' + i for i in proto_roots + proto_lib_roots])} --python_out={destination} --grpc_python_out={destination} {file_path}" # noqa
3939
os.system(command)
4040

4141
return super().run()
@@ -62,8 +62,6 @@ def run(self):
6262
"attrs>=21.4.0",
6363
"google-api>=0.1.12",
6464
"googleapis-common-protos>=1.56.4",
65-
"grpcio>=1.48.1",
66-
"grpcio-tools>=1.0.0",
6765
"flask>=2.1.3",
6866
"protobuf>=3.20.0",
6967
"pytest>=7.1.2",

spawn/controller.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Copyright 2022 Eigr.
33
Licensed under the Apache License, Version 2.0.
44
"""
5-
from spawn.eigr.actor_pb2 import (
5+
from spawn.eigr.functions.protocol.actors.actor_pb2 import (
66
Actor,
77
ActorId,
88
ActorState,
@@ -16,7 +16,8 @@
1616
Registry,
1717
TimeoutStrategy,
1818
)
19-
from spawn.eigr.protocol_pb2 import (
19+
20+
from spawn.eigr.functions.protocol.actors.protocol_pb2 import (
2021
RegistrationRequest,
2122
RegistrationResponse,
2223
ServiceInfo,
@@ -53,7 +54,8 @@ def register(self, actors: List[ActorEntity]):
5354
logging.info("Registering Actors on the Proxy %s", actors)
5455
try:
5556

56-
proxy_url = "http://{}:{}{}".format(self.host, self.port, self.register_uri)
57+
proxy_url = "http://{}:{}{}".format(self.host,
58+
self.port, self.register_uri)
5759

5860
# Create actor params via ActorEntity
5961
deactivate_timeout_strategy = TimeoutStrategy()

0 commit comments

Comments
 (0)