OxL Справочник OxL
РусскийEnglish

counter-cluster

A small cluster of two roles (Standard §12): edge nodes serve the Gate service, store nodes keep the state of the sharded actor Counter in their replicated storage. The same binary runs on every node; the role decides what a node does.

sh
oxl dev --nodes 4                 # four local nodes 127.0.0.1:7000..7003, roles assigned automatically
oxl test                          # one in-process node with every role

oxl dev rebuilds and restarts the nodes when a source file changes; the log of each node is <data-dir>/nX/stdout.log. A leader task on the edge role (runs leader("traffic")) calls Gate.add(7, 1) every two seconds, so the log shows the counter growing; the actor is activated on the node that owns its shard and moves (with its state) when nodes come and go. Try kill on one of the node processes listed by oxl dev.

Файлы проекта#

Скачать проект (zip)

Исходник: examples/counter-cluster

OxL 1.0.0-beta · Версия документации 1.0.0-beta© OxwaldLink · сгенерировано из Стандарта, исходников std и руководства