Skip to content

Commit 4324c9f

Browse files
committed
update.
1 parent 5b4a177 commit 4324c9f

File tree

5 files changed

+39
-20
lines changed

5 files changed

+39
-20
lines changed

docs/immortal/code/database.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ Each nostr event kind has a different collection on mongo db database. This help
1010

1111
## Queries
1212

13-
When immortal wants to query something from mongo db, its basically a filter. The immortal turns the normal filter and makes `n` mongo queries. `n` is the number of kind numbers in filter. it would attach the whole conditions of filter to each query and execute the queries. Currently queries are sent separately which is inefficient, we are working on it to support batch queries or increase the performance.
14-
15-
> The special case is when someone requests a filter without kinds field, in this case immortal makes a request to some papular collections like reactions, short text notes, zaps and some more.
13+
When immortal wants to query something from mongo db, its basically a filter. The immortal turns the normal filter and makes `n` mongo queries. Then we use the mongo db aggregation pipeline and `$unionWith` stage to query all requested collections. If you kinds was provided it will query all tables.
1614

1715
## Deleting
1816

19-
To delete some document for a NIP-09 request or Expiration or operator order from manager, we make ALL fields removed (not empty!) and we only keep the id of event. this helps us to prevent an deleted event be rewritten.
17+
To delete some document for a NIP-09 request or Expiration or operator order from manager, we set all fields `null` using `$unset` mongo command and we only keep the `id` of event. this helps us to prevent an deleted event be rewritten or returned to user.

docs/immortal/managment/apis.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ Here is a list of APIs between manager and immortals. All of these APIs are thro
1111

1212
Here is a list of APIs which is provided by manager and relay calls them:
1313

14-
### registerService
14+
### RegisterService
1515

1616
The relays call this endpoint to receive an ID (a unique id between all relays in the same system for manager to identify them).
1717

1818
Here is an example of register request:
1919

2020
```proto
2121
// Request to register a service.
22-
message registerServiceRequest {
22+
message RegisterServiceRequest {
2323
string port = 1; // Service grpc port.
2424
uint32 heartbeat_duration_in_sec = 2; // Heartbeat interval in seconds for calling Status endpoint of relay.
2525
ServiceTypeEnum type = 3; // Type of the service. (e.g., RELAY)
@@ -31,7 +31,7 @@ Response example:
3131

3232
```proto
3333
// Response after registering a service.
34-
message registerServiceResponse {
34+
message RegisterServiceResponse {
3535
bool success = 1; // Indicates if registration was successful.
3636
optional string message = 2; // Optional message with additional information.
3737
string token = 3; // Token assigned to the registered service.
@@ -40,22 +40,22 @@ message registerServiceResponse {
4040

4141
> Relay will send the id in the header of `x-identifier` in each request to manager. this helps the manager to know who is talking with and take different actions for same request but different relays.
4242
43-
### getConfig
43+
### GetParameters
4444

4545
Relays will call this endpoint to get the parameters config from manager which requires the `x-identifier` header as well.
4646

4747
Request example:
4848

4949
```proto
5050
// Empty request used for methods that do not require parameters.
51-
message EmptyRequest {}
51+
message GetParametersRequest {}
5252
```
5353

5454
Response example:
5555

5656
```proto
5757
// Response containing configuration details.
58-
message getConfigResponse {
58+
message GetParametersResponse {
5959
limitations limitations = 1; // Configuration limitations.
6060
string url = 2; // Relay public URL.
6161
}
@@ -68,7 +68,6 @@ Types used:
6868
message limitations {
6969
int32 max_message_length = 1; // Maximum allowed message length.
7070
int32 max_subscriptions = 2; // Maximum number of subscriptions allowed.
71-
int32 max_filters = 3; // Maximum number of filters allowed.
7271
int32 max_subid_length = 4; // Maximum length of a subscription ID.
7372
int32 min_pow_difficulty = 5; // Minimum proof-of-work difficulty.
7473
bool auth_required = 6; // Indicates if authentication is required.
@@ -90,16 +89,27 @@ enum ServiceTypeEnum {
9089
}
9190
```
9291

92+
### AddLog
9393

94-
### shutdown
94+
Relays may send system level logs to manager.
9595

96-
> TODO.
96+
```proto
97+
message AddLogRequest {
98+
string message = 1;
99+
string stack = 2;
100+
}
101+
```
97102

98-
### addLog
103+
Response example:
99104

100-
> TODO.
105+
```proto
106+
message AddLogResponse {
107+
bool success = 1;
108+
optional string message = 2;
109+
}
110+
```
101111

102-
## Relay to Manager
112+
## Manager to Relay
103113

104114
Here is a list of APIs provided by relays which would be called by managers:
105115

@@ -147,4 +157,14 @@ The manager can show the response in a monitoring system, make notifications, sh
147157
148158
### Shutdown
149159

150-
> TODO.
160+
Manager can send a shutdown signal to each relay independently.
161+
162+
```proto
163+
message ShutdownRequest {}
164+
```
165+
166+
Response example:
167+
168+
```proto
169+
message ShutdownResponse {}
170+
```

docs/immortal/managment/manager.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 2
44

55
# Manager
66

7-
This section contains the information about the manager rules and responsibilities. To findout how relays interact with manager and vice versa you can check the [APIs](./apis.md) section.
7+
This section contains the information about the manager rules and responsibilities. To find out how relays interact with manager and vice versa you can check the [APIs](./apis.md) section.
88

99
## White/Black Listing
1010

docs/immortal/nips/nip-09.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ sidebar_position: 2
55
# NIP-09
66

77
The NIP-09 follows normal NIP-09 from NIPs repository and also supports filter tag requests from this document: https://github.com/nostr-protocol/nips/pull/1509.
8+
9+
> TODO: add its limitations.

docs/immortal/nips/nip-56.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ sidebar_position: 4
44

55
# NIP-56
66

7-
Reports are supported on immortal but it won't be processed by relays code and relays only store and broadcast them. The manager will read the report events from database and list them for operator review. There is no support for trusted moderators at the moment.
8-
7+
Reports are supported on immortal but it won't be processed by relays code and relays only store and broadcast them. The manager will receive them from immortal instances through gRPC calls. There is no support for trusted moderators at the moment.

0 commit comments

Comments
 (0)