Cloud messages for Load81
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend-api-design, distributed-systems, networking
Hướng nghiên cứu
Issue định nghĩa các điểm vào listen(), unlisten(), receive() và send(), đồng thời mô tả Redis pub/sub trên các socket không chặn. Trước tiên, hãy xác định các điểm vào đó cùng với mã xử lý sự kiện/socket, sau đó xác minh hành vi API được nêu và việc xếp hàng thông báo. Công việc được xem là hoàn tất khi các thực thể Load81 có thể trao đổi các thông báo đã tuần tự hóa thông qua các channel đã đăng ký mà không nhận được thông báo của chính mình.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Load81 programs are currently self-contained into a box without the ability to talk with the external world.
Specifically they can't talk with other instances of the same program running in other Load81 instances around the world! What a shame. So what I'm proposing and implementing is a Cloud message service for Load81.
API
A Load81 program listen to channels using the listen() function. Multiple calls to listen are allowed in order to listen to multiple channels, and it is also possible to no longer listen to a given channel using unlisten(). Example:
listen("asteroids")
listen("foo","bar")
unlisten("asteroids")
Every time a message is received the function receive is called. It is important to understand how this works. The normal flow of a Load81 program is to call setup the first time, and then call draw. When the program is listening to one or more channels, the function receive is called before the function draw is called, and is called for all the pending messages currently in the queue, so for instance you may have 5 calls to receive, and finally the call to draw, and so forth.
This is how the function receive is defined in a program:
function receive(sender,channel,msg)
....
end
The three arguments are:
- sender: a 40 chars hex string that uniquely identifies the sender instance (this instance ID changes at every run).
- channel: the channel that received the message.
- msg: a Lua object (number, string, table, boolean, ...)
You don't receive messages that are sent by your instance.
In order to send messages you simply use:
send("channel",lua_object)
You can send messages to channels you are not listening without problems if you wish.
Implementation
The implementation using a Redis instance running at pubsub.load81.com, with only PUBLISH and SUBSCRIBE commands enabled. The instance is configured to drop clients that reached an output buffer of a few hundred kbytes so that it is not possible to abuse the instance just listening to channels without actually reading data.
Every Load81 instance creates a random identifier at startup, either reading from /dev/urandom or using a mix of time and rand() if urandom is not available.
Messages are send to Redis as <Instance ID>:<MessagePack representation of the Lua object sent>.
Messages are both sent and received using a non blocking socket. At every iteration we read what's new in the socket, and call a function that will put all the entire messages in the queue, parsing the Redis protocol.
From the point of view of sending, we'll try to send messages every time the user calls the send() function in order to minimize latency, but if there is no room on the kernel socket buffer we'll bufferize the write and send it when possible (at the next iteration of the event processor, that is, by default, 30 times per second).
Abuses
From the outside attacker this is a free message hub, but I think it's fine since for instance an IRC server has the same problem.... and I think no one will try to abuse this stuff, at least I hop.
- Ngôn ngữ chính
- C
- Star
- 743
- Fork
- 65
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của antirez/load81
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
load81 x SDL x cygwin 64-bitĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
-
support offscreen drawingĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của antirez/load81
Issue tương tự
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea:http kind:gate-defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
InauguralSystems/EigenScript#2397 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add SECURITY.mdĐang mởenhancement
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
modem: ppp: CMUX DLCI receive buffer overruns on large downlink packetsCó thể đã có người làm @pedrohqr đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
zephyrproject-rtos/zephyr#126195 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
ly05010419/MacNativeGames#2271 ·
Maintainer thường phản hồi trong vòng 1 ngày