132
|
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.model.IMessage;
|
|
14
|
|
15 public import tango.time.Time;
|
|
16
|
|
17 public import tango.io.protocol.model.IReader,
|
|
18 tango.io.protocol.model.IWriter;
|
|
19
|
|
20 /*******************************************************************************
|
|
21
|
|
22 *******************************************************************************/
|
|
23
|
|
24 interface IMessage : IReadable, IWritable
|
|
25 {
|
|
26 /***********************************************************************
|
|
27
|
|
28 ***********************************************************************/
|
|
29
|
|
30 char[] toString ();
|
|
31
|
|
32 /***********************************************************************
|
|
33
|
|
34 ***********************************************************************/
|
|
35
|
|
36 IMessage clone ();
|
|
37
|
|
38 /***********************************************************************
|
|
39
|
|
40 ***********************************************************************/
|
|
41
|
|
42 void reply (char[] channel);
|
|
43
|
|
44 /***********************************************************************
|
|
45
|
|
46 ***********************************************************************/
|
|
47
|
|
48 char[] reply ();
|
|
49
|
|
50 /***********************************************************************
|
|
51
|
|
52 ***********************************************************************/
|
|
53
|
|
54 void time (Time value);
|
|
55
|
|
56 /***********************************************************************
|
|
57
|
|
58 ***********************************************************************/
|
|
59
|
|
60 Time time ();
|
|
61
|
|
62 /***********************************************************************
|
|
63
|
|
64 ***********************************************************************/
|
|
65
|
|
66 void id (uint value);
|
|
67
|
|
68 /***********************************************************************
|
|
69
|
|
70 ***********************************************************************/
|
|
71
|
|
72 uint id ();
|
|
73
|
|
74 /***********************************************************************
|
|
75
|
|
76 ***********************************************************************/
|
|
77
|
|
78 void execute ();
|
|
79 }
|
|
80
|
|
81
|
|
82 /******************************************************************************
|
|
83
|
|
84 Manages the lifespan of an ICache entry. These loaders effectively
|
|
85 isolate the cache from whence the content is derived. It's a good
|
|
86 idea to employ this abstraction where appropriate, since it allows
|
|
87 the cache source to change with minimal (if any) impact on client
|
|
88 code.
|
|
89
|
|
90 ******************************************************************************/
|
|
91
|
|
92 interface IMessageLoader
|
|
93 {
|
|
94 /**********************************************************************
|
|
95
|
|
96 Load a cache entry from wherever the content is persisted.
|
|
97 The 'time' argument represents that belonging to a stale
|
|
98 entry, which can be used to optimize the loader operation
|
|
99 (no need to perform a full load where there's already a
|
|
100 newer version in an L2 cache). This 'time' value will be
|
|
101 long.min where was no such stale entry.
|
|
102
|
|
103 **********************************************************************/
|
|
104
|
|
105 IMessage load ();
|
|
106 }
|
|
107
|
|
108
|
|
109
|