-----Star topological fractal design of Golang distributed design pattern

Source: Internet
Author: User

-----Star topological fractal design of Golang distributed design pattern

In the previous layered design, the simple pipelining principle was used to realize the simple State transfer design. As follows

We will consider another situation in this article. For example, process management in the Linux kernel. All processes have a parent process. When a child process is running normally, there is basically no communication with the parent process. However, when a child process dies, the parent process is notified of its parent process for resource reclamation. When the parent process dies, the child process dies with the parent process, or the child process is managed by the parent process of the parent process. Similar to the following figure


Each of these processes has its own parent process, and it is possible to have its own child processes.

In this kind of management, the parent-child relationship, or the relationship between the manager and the manager. Being a manager, you can run it on your own, but to inform the manager or manager of some of its status, you can periodically get the status of the manager.

Here is an example of a Peer-to-peer downloader:

I. Division of functions, formation of managers and being managers

1) Download Task Manager. (for adding, deleting tasks, and controlling the speed of task downloads, for some policy management)

2) Download the task module. (For specific individual task downloads, you can control peer)

3) equivalent peer module. (Peer-to-peer interactive peer communication, data interaction)

There are two star topological models here.

1 Download Task Manager, for Manager, control task Add, delete, etc. Download task module, for the manager, for a specific task of the download.

Download Manager, can real-time control download module, download module, download speed, download completion status to the Download management report.

2 Download task module, for managers, control Peer-to-peer peer acquisition, creation, etc. Peer-to-peer peer modules, for managers, for specific communications, data interactions, etc.

Its two star structures, which form a fractal structure of the star type

Second, the definition of interface

1 The manager, defines a manager's interface, which is used to pass to the manager.

2 by the manager, define a state interface, for managers to acquire, control the status of the manager.

Third, the operation

1, the manager initializes, and runs

2, add to be the manager.

When adding, the admin interface is passed to the manager.

The star topology fractal design can be classified into a kind of system based on functional management. Each function is independent, and through the interface, carries on the weak communication, realizes the escalation, the management and so on behavior. But each function can be loosely coupled.

Hao Haohua First Draft

The Long Crescent Moon Road

QQ 29185807

August 22, 2014



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.