Mercurial > projects > ldc
comparison tango/tango/net/cluster/tina/RollCall.d @ 132:1700239cab2e trunk
[svn r136] MAJOR UNSTABLE UPDATE!!!
Initial commit after moving to Tango instead of Phobos.
Lots of bugfixes...
This build is not suitable for most things.
author | lindquist |
---|---|
date | Fri, 11 Jan 2008 17:57:40 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
1 /******************************************************************************* | |
2 | |
3 copyright: Copyright (c) 2004 Kris Bell. All rights reserved | |
4 | |
5 license: BSD style: $(LICENSE) | |
6 | |
7 version: July 2004: Initial release | |
8 | |
9 author: Kris | |
10 | |
11 *******************************************************************************/ | |
12 | |
13 module tango.net.cluster.tina.RollCall; | |
14 | |
15 private import tango.net.cluster.NetworkMessage; | |
16 | |
17 /****************************************************************************** | |
18 | |
19 An IMessage used by the cluster client and server during discovery | |
20 lookup and liveness broadcasts. The client broadcasts one of these | |
21 at startup to see which servers are alive. The server responds with | |
22 a reply RollCall stating its name and port. The server will also | |
23 broadcast one of these when it first starts, such that any running | |
24 clients can tell the server has 'recovered'. | |
25 | |
26 Requests and responses are distinguished by the content of the msg: | |
27 a type value of Request indicates a request from a client and other | |
28 values are considered to be responses from servers. | |
29 | |
30 ******************************************************************************/ | |
31 | |
32 class RollCall : NetworkMessage | |
33 { | |
34 enum {Request, Cache, Queue, Task} | |
35 | |
36 char[] addr; // server name & port pair | |
37 uint type; // request, cache, queue, or task server? | |
38 | |
39 /********************************************************************** | |
40 | |
41 A request from a client | |
42 | |
43 **********************************************************************/ | |
44 | |
45 this () | |
46 { | |
47 } | |
48 | |
49 /********************************************************************** | |
50 | |
51 Response from a server | |
52 | |
53 **********************************************************************/ | |
54 | |
55 this (int type) | |
56 { | |
57 this.type = type; | |
58 } | |
59 | |
60 /********************************************************************** | |
61 | |
62 Freeze the content | |
63 | |
64 **********************************************************************/ | |
65 | |
66 void read (IReader input) | |
67 { | |
68 super.read (input); | |
69 input (addr) (type); | |
70 } | |
71 | |
72 /********************************************************************** | |
73 | |
74 Defrost the content | |
75 | |
76 **********************************************************************/ | |
77 | |
78 void write (IWriter output) | |
79 { | |
80 super.write (output); | |
81 output (addr) (type); | |
82 } | |
83 } | |
84 | |
85 |