redis-rpc 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -0,0 +1,329 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="438px" height="236.632px" viewBox="0 0 438 236.632" enable-background="new 0 0 438 236.632" xml:space="preserve">
6
+ <path fill="#CCCCCC" stroke="#000000" stroke-miterlimit="10" d="M299.5,146.566c0,6.627-5.373,12-12,12h-138
7
+ c-6.627,0-12-5.373-12-12v-111c0-6.627,5.373-12,12-12h138c6.627,0,12,5.373,12,12V146.566z"/>
8
+ <g>
9
+ <path d="M199.735,3.092c0.792-0.144,1.945-0.252,3.007-0.252c1.674,0,2.772,0.324,3.511,0.99c0.594,0.54,0.955,1.368,0.955,2.323
10
+ c0,1.584-1.008,2.647-2.269,3.079v0.054c0.918,0.324,1.477,1.188,1.765,2.449c0.396,1.692,0.684,2.863,0.937,3.331h-1.621
11
+ c-0.198-0.36-0.468-1.386-0.792-2.899c-0.36-1.674-1.026-2.305-2.449-2.359h-1.476v5.258h-1.567V3.092z M201.302,8.62h1.602
12
+ c1.675,0,2.737-0.918,2.737-2.305c0-1.566-1.135-2.251-2.791-2.251c-0.756,0-1.278,0.054-1.548,0.126V8.62z"/>
13
+ <path d="M210.32,10.997c0.036,2.143,1.386,3.025,2.989,3.025c1.134,0,1.836-0.198,2.413-0.45l0.288,1.134
14
+ c-0.558,0.252-1.53,0.559-2.917,0.559c-2.683,0-4.286-1.783-4.286-4.412c0-2.628,1.548-4.681,4.087-4.681
15
+ c2.863,0,3.601,2.484,3.601,4.087c0,0.324-0.018,0.559-0.054,0.738H210.32z M214.965,9.862c0.018-0.99-0.414-2.557-2.196-2.557
16
+ c-1.621,0-2.305,1.458-2.431,2.557H214.965z"/>
17
+ <path d="M225.964,2.282v10.533c0,0.774,0.036,1.656,0.071,2.25h-1.404l-0.071-1.513h-0.054c-0.469,0.973-1.514,1.711-2.936,1.711
18
+ c-2.106,0-3.745-1.783-3.745-4.43c-0.018-2.898,1.801-4.663,3.907-4.663c1.351,0,2.232,0.63,2.629,1.314h0.036V2.282H225.964z
19
+ M224.397,9.898c0-0.198-0.019-0.468-0.072-0.667c-0.233-0.99-1.099-1.818-2.286-1.818c-1.639,0-2.611,1.44-2.611,3.349
20
+ c0,1.765,0.883,3.223,2.574,3.223c1.062,0,2.035-0.721,2.323-1.891c0.054-0.216,0.072-0.432,0.072-0.685V9.898z"/>
21
+ <path d="M230.372,3.903c0,0.54-0.378,0.972-1.009,0.972c-0.576,0-0.954-0.432-0.954-0.972c0-0.541,0.396-0.991,0.99-0.991
22
+ C229.976,2.912,230.372,3.344,230.372,3.903z M228.607,15.066V6.351h1.584v8.715H228.607z"/>
23
+ <path d="M232.604,13.463c0.486,0.288,1.314,0.612,2.106,0.612c1.134,0,1.675-0.558,1.675-1.296c0-0.756-0.451-1.152-1.604-1.584
24
+ c-1.584-0.576-2.322-1.422-2.322-2.467c0-1.404,1.152-2.557,3.007-2.557c0.882,0,1.657,0.234,2.125,0.54l-0.378,1.152
25
+ c-0.342-0.216-0.973-0.522-1.783-0.522c-0.936,0-1.439,0.54-1.439,1.188c0,0.72,0.504,1.044,1.638,1.495
26
+ c1.495,0.558,2.287,1.314,2.287,2.611c0,1.548-1.206,2.629-3.241,2.629c-0.954,0-1.836-0.252-2.449-0.612L232.604,13.463z"/>
27
+ </g>
28
+ <g>
29
+ <path d="M5.929,24.592c0.792-0.144,1.945-0.252,3.007-0.252c1.674,0,2.772,0.324,3.511,0.99c0.594,0.54,0.955,1.368,0.955,2.323
30
+ c0,1.584-1.008,2.647-2.269,3.079v0.054c0.918,0.324,1.477,1.188,1.765,2.449c0.396,1.692,0.684,2.863,0.937,3.331h-1.621
31
+ c-0.198-0.36-0.468-1.386-0.792-2.899c-0.36-1.674-1.026-2.305-2.449-2.359H7.496v5.258H5.929V24.592z M7.496,30.12h1.602
32
+ c1.675,0,2.737-0.918,2.737-2.305c0-1.566-1.135-2.251-2.791-2.251c-0.756,0-1.278,0.054-1.548,0.126V30.12z"/>
33
+ <path d="M15.613,24.574c0.756-0.126,1.746-0.234,3.007-0.234c1.548,0,2.683,0.36,3.403,1.008c0.648,0.576,1.062,1.458,1.062,2.539
34
+ c0,1.099-0.324,1.963-0.937,2.593c-0.846,0.882-2.179,1.333-3.709,1.333c-0.468,0-0.9-0.018-1.26-0.108v4.861h-1.566V24.574z
35
+ M17.18,30.426c0.342,0.09,0.774,0.126,1.296,0.126c1.89,0,3.042-0.937,3.042-2.575c0-1.621-1.152-2.395-2.863-2.395
36
+ c-0.684,0-1.206,0.054-1.476,0.126V30.426z"/>
37
+ <path d="M33.651,36.188c-0.558,0.288-1.729,0.576-3.205,0.576c-3.421,0-5.978-2.161-5.978-6.158c0-3.817,2.575-6.374,6.338-6.374
38
+ c1.494,0,2.466,0.324,2.881,0.54l-0.396,1.278c-0.576-0.288-1.422-0.504-2.431-0.504c-2.845,0-4.735,1.819-4.735,5.006
39
+ c0,2.989,1.71,4.879,4.646,4.879c0.972,0,1.944-0.198,2.575-0.504L33.651,36.188z"/>
40
+ <path d="M39.174,34.963c0.486,0.288,1.314,0.612,2.107,0.612c1.134,0,1.674-0.558,1.674-1.296c0-0.756-0.45-1.152-1.603-1.584
41
+ c-1.584-0.576-2.323-1.422-2.323-2.467c0-1.404,1.152-2.557,3.007-2.557c0.882,0,1.657,0.234,2.125,0.54l-0.378,1.152
42
+ c-0.342-0.216-0.972-0.522-1.782-0.522c-0.937,0-1.44,0.54-1.44,1.188c0,0.72,0.504,1.044,1.638,1.495
43
+ c1.495,0.558,2.287,1.314,2.287,2.611c0,1.548-1.207,2.629-3.241,2.629c-0.954,0-1.836-0.252-2.449-0.612L39.174,34.963z"/>
44
+ <path d="M47.401,32.497c0.036,2.143,1.386,3.025,2.989,3.025c1.134,0,1.836-0.198,2.413-0.45l0.288,1.134
45
+ c-0.558,0.252-1.53,0.559-2.917,0.559c-2.683,0-4.286-1.783-4.286-4.412c0-2.628,1.548-4.681,4.087-4.681
46
+ c2.863,0,3.601,2.484,3.601,4.087c0,0.324-0.018,0.559-0.054,0.738H47.401z M52.046,31.362c0.018-0.99-0.414-2.557-2.196-2.557
47
+ c-1.621,0-2.305,1.458-2.431,2.557H52.046z"/>
48
+ <path d="M55.536,30.57c0-1.026-0.018-1.909-0.072-2.719h1.387l0.072,1.729h0.054c0.396-1.17,1.368-1.908,2.431-1.908
49
+ c0.162,0,0.288,0.018,0.432,0.036v1.494c-0.162-0.036-0.324-0.036-0.54-0.036c-1.117,0-1.909,0.829-2.125,2.017
50
+ c-0.036,0.216-0.054,0.486-0.054,0.738v4.646h-1.584V30.57z"/>
51
+ <path d="M62.484,27.851l1.71,4.88c0.288,0.81,0.522,1.53,0.702,2.25h0.054c0.198-0.72,0.45-1.44,0.738-2.25l1.693-4.88h1.656
52
+ l-3.421,8.715h-1.513l-3.313-8.715H62.484z"/>
53
+ <path d="M71.232,32.497c0.036,2.143,1.386,3.025,2.989,3.025c1.134,0,1.836-0.198,2.413-0.45l0.288,1.134
54
+ c-0.558,0.252-1.53,0.559-2.917,0.559c-2.683,0-4.285-1.783-4.285-4.412c0-2.628,1.549-4.681,4.087-4.681
55
+ c2.863,0,3.601,2.484,3.601,4.087c0,0.324-0.018,0.559-0.054,0.738H71.232z M75.878,31.362c0.018-0.99-0.415-2.557-2.197-2.557
56
+ c-1.621,0-2.305,1.458-2.431,2.557H75.878z"/>
57
+ <path d="M79.368,30.57c0-1.026-0.018-1.909-0.072-2.719h1.387l0.072,1.729h0.054c0.396-1.17,1.368-1.908,2.431-1.908
58
+ c0.162,0,0.288,0.018,0.432,0.036v1.494c-0.162-0.036-0.324-0.036-0.54-0.036c-1.116,0-1.909,0.829-2.125,2.017
59
+ c-0.036,0.216-0.054,0.486-0.054,0.738v4.646h-1.584V30.57z"/>
60
+ </g>
61
+ <g>
62
+ <path d="M16.236,231.754c-0.558,0.288-1.729,0.576-3.205,0.576c-3.421,0-5.978-2.161-5.978-6.158c0-3.817,2.575-6.374,6.338-6.374
63
+ c1.494,0,2.466,0.324,2.881,0.54l-0.396,1.278c-0.576-0.288-1.422-0.504-2.431-0.504c-2.845,0-4.735,1.819-4.735,5.006
64
+ c0,2.989,1.71,4.879,4.646,4.879c0.972,0,1.944-0.198,2.575-0.504L16.236,231.754z"/>
65
+ <path d="M24.155,230.043c0,0.756,0.036,1.495,0.126,2.089h-1.422l-0.126-1.098h-0.054c-0.486,0.684-1.422,1.296-2.665,1.296
66
+ c-1.765,0-2.665-1.243-2.665-2.503c0-2.106,1.873-3.259,5.239-3.241v-0.18c0-0.702-0.198-2.017-1.98-1.999
67
+ c-0.828,0-1.674,0.234-2.287,0.648l-0.36-1.062c0.72-0.45,1.783-0.756,2.881-0.756c2.665,0,3.313,1.818,3.313,3.547V230.043z
68
+ M22.625,227.685c-1.729-0.036-3.691,0.27-3.691,1.962c0,1.044,0.684,1.513,1.476,1.513c1.152,0,1.891-0.72,2.143-1.458
69
+ c0.054-0.18,0.072-0.36,0.072-0.504V227.685z"/>
70
+ <path d="M26.709,219.349h1.584v12.784h-1.584V219.349z"/>
71
+ <path d="M37.169,231.826c-0.414,0.198-1.333,0.504-2.503,0.504c-2.629,0-4.339-1.783-4.339-4.447c0-2.683,1.837-4.646,4.682-4.646
72
+ c0.936,0,1.765,0.234,2.196,0.468l-0.36,1.207c-0.378-0.198-0.972-0.414-1.836-0.414c-1.999,0-3.079,1.495-3.079,3.295
73
+ c0,2.017,1.296,3.259,3.025,3.259c0.9,0,1.495-0.216,1.945-0.415L37.169,231.826z"/>
74
+ <path d="M46.313,229.738c0,0.918,0.018,1.71,0.072,2.395h-1.404l-0.09-1.422h-0.036c-0.396,0.702-1.332,1.621-2.881,1.621
75
+ c-1.368,0-3.007-0.774-3.007-3.817v-5.096h1.584v4.808c0,1.657,0.522,2.791,1.945,2.791c1.062,0,1.8-0.738,2.088-1.458
76
+ c0.09-0.216,0.144-0.504,0.144-0.81v-5.33h1.584V229.738z"/>
77
+ <path d="M48.939,219.349h1.584v12.784h-1.584V219.349z"/>
78
+ <path d="M59.309,230.043c0,0.756,0.036,1.495,0.126,2.089h-1.422l-0.126-1.098h-0.054c-0.486,0.684-1.422,1.296-2.665,1.296
79
+ c-1.765,0-2.665-1.243-2.665-2.503c0-2.106,1.873-3.259,5.239-3.241v-0.18c0-0.702-0.198-2.017-1.98-1.999
80
+ c-0.828,0-1.674,0.234-2.287,0.648l-0.36-1.062c0.72-0.45,1.783-0.756,2.881-0.756c2.665,0,3.313,1.818,3.313,3.547V230.043z
81
+ M57.778,227.685c-1.729-0.036-3.691,0.27-3.691,1.962c0,1.044,0.684,1.513,1.476,1.513c1.152,0,1.891-0.72,2.143-1.458
82
+ c0.054-0.18,0.072-0.36,0.072-0.504V227.685z"/>
83
+ <path d="M63.7,221.329v2.088h2.269v1.207H63.7v4.7c0,1.08,0.306,1.692,1.188,1.692c0.432,0,0.685-0.036,0.918-0.108l0.072,1.207
84
+ c-0.306,0.108-0.792,0.216-1.404,0.216c-0.738,0-1.332-0.252-1.71-0.667c-0.432-0.486-0.612-1.26-0.612-2.287v-4.753h-1.35v-1.207
85
+ h1.35v-1.62L63.7,221.329z"/>
86
+ <path d="M75.527,227.703c0,3.223-2.25,4.627-4.339,4.627c-2.34,0-4.177-1.729-4.177-4.483c0-2.899,1.927-4.609,4.321-4.609
87
+ C73.835,223.238,75.527,225.056,75.527,227.703z M68.631,227.793c0,1.909,1.081,3.349,2.629,3.349c1.512,0,2.646-1.422,2.646-3.385
88
+ c0-1.476-0.738-3.331-2.611-3.331C69.441,224.426,68.631,226.155,68.631,227.793z"/>
89
+ <path d="M77.523,226.137c0-1.026-0.018-1.909-0.072-2.719h1.387l0.072,1.729h0.054c0.396-1.17,1.368-1.908,2.431-1.908
90
+ c0.162,0,0.288,0.018,0.432,0.036v1.494c-0.162-0.036-0.324-0.036-0.54-0.036c-1.116,0-1.909,0.829-2.125,2.017
91
+ c-0.036,0.216-0.054,0.486-0.054,0.738v4.646h-1.584V226.137z"/>
92
+ </g>
93
+ <g>
94
+ <path d="M357.652,24.592c0.792-0.144,1.944-0.252,3.007-0.252c1.675,0,2.772,0.324,3.511,0.99c0.594,0.54,0.955,1.368,0.955,2.323
95
+ c0,1.584-1.009,2.647-2.27,3.079v0.054c0.918,0.324,1.477,1.188,1.765,2.449c0.396,1.692,0.685,2.863,0.937,3.331h-1.621
96
+ c-0.197-0.36-0.468-1.386-0.792-2.899c-0.36-1.674-1.026-2.305-2.448-2.359h-1.477v5.258h-1.566V24.592z M359.219,30.12h1.603
97
+ c1.675,0,2.736-0.918,2.736-2.305c0-1.566-1.134-2.251-2.79-2.251c-0.757,0-1.279,0.054-1.549,0.126V30.12z"/>
98
+ <path d="M367.336,24.574c0.756-0.126,1.746-0.234,3.008-0.234c1.548,0,2.682,0.36,3.402,1.008c0.648,0.576,1.062,1.458,1.062,2.539
99
+ c0,1.099-0.324,1.963-0.937,2.593c-0.847,0.882-2.179,1.333-3.709,1.333c-0.468,0-0.9-0.018-1.261-0.108v4.861h-1.566V24.574z
100
+ M368.902,30.426c0.342,0.09,0.774,0.126,1.297,0.126c1.891,0,3.043-0.937,3.043-2.575c0-1.621-1.152-2.395-2.863-2.395
101
+ c-0.684,0-1.206,0.054-1.477,0.126V30.426z"/>
102
+ <path d="M385.375,36.188c-0.559,0.288-1.729,0.576-3.205,0.576c-3.422,0-5.979-2.161-5.979-6.158c0-3.817,2.575-6.374,6.338-6.374
103
+ c1.494,0,2.467,0.324,2.881,0.54l-0.396,1.278c-0.576-0.288-1.422-0.504-2.43-0.504c-2.846,0-4.736,1.819-4.736,5.006
104
+ c0,2.989,1.711,4.879,4.646,4.879c0.972,0,1.943-0.198,2.574-0.504L385.375,36.188z"/>
105
+ <path d="M397.326,36.26c-0.414,0.198-1.333,0.504-2.504,0.504c-2.629,0-4.339-1.783-4.339-4.447c0-2.683,1.837-4.646,4.682-4.646
106
+ c0.937,0,1.765,0.234,2.196,0.468l-0.359,1.207c-0.379-0.198-0.973-0.414-1.837-0.414c-1.999,0-3.079,1.495-3.079,3.295
107
+ c0,2.017,1.297,3.259,3.025,3.259c0.9,0,1.494-0.216,1.944-0.415L397.326,36.26z"/>
108
+ <path d="M399.178,23.782h1.584v12.784h-1.584V23.782z"/>
109
+ <path d="M405.189,25.403c0,0.54-0.378,0.972-1.008,0.972c-0.576,0-0.955-0.432-0.955-0.972c0-0.541,0.396-0.991,0.99-0.991
110
+ C404.793,24.412,405.189,24.844,405.189,25.403z M403.426,36.566v-8.715h1.584v8.715H403.426z"/>
111
+ <path d="M408.52,32.497c0.036,2.143,1.387,3.025,2.988,3.025c1.135,0,1.837-0.198,2.413-0.45l0.288,1.134
112
+ c-0.559,0.252-1.53,0.559-2.917,0.559c-2.683,0-4.285-1.783-4.285-4.412c0-2.628,1.549-4.681,4.087-4.681
113
+ c2.863,0,3.602,2.484,3.602,4.087c0,0.324-0.018,0.559-0.055,0.738H408.52z M413.165,31.362c0.018-0.99-0.415-2.557-2.196-2.557
114
+ c-1.621,0-2.305,1.458-2.432,2.557H413.165z"/>
115
+ <path d="M416.655,30.21c0-0.918-0.019-1.638-0.072-2.359h1.405l0.09,1.44h0.035c0.433-0.81,1.441-1.62,2.881-1.62
116
+ c1.207,0,3.079,0.72,3.079,3.709v5.186h-1.585v-5.023c0-1.404-0.521-2.575-2.016-2.575c-1.026,0-1.837,0.738-2.125,1.621
117
+ c-0.072,0.198-0.107,0.468-0.107,0.738v5.24h-1.585V30.21z"/>
118
+ <path d="M428.482,25.763v2.088h2.268v1.207h-2.268v4.7c0,1.08,0.306,1.692,1.188,1.692c0.432,0,0.685-0.036,0.918-0.108
119
+ l0.072,1.207c-0.306,0.108-0.792,0.216-1.404,0.216c-0.738,0-1.332-0.252-1.711-0.667c-0.432-0.486-0.611-1.26-0.611-2.287v-4.753
120
+ h-1.351v-1.207h1.351v-1.62L428.482,25.763z"/>
121
+ </g>
122
+ <g>
123
+ <path d="M160.963,102.83c-0.684,0.234-1.365,0.352-2.045,0.352c-1.109,0-1.964-0.289-2.563-0.867s-0.899-1.398-0.899-2.461
124
+ c0-1.043,0.296-1.857,0.888-2.443s1.415-0.879,2.47-0.879c0.672,0,1.35,0.102,2.033,0.305v0.967
125
+ c-0.754-0.27-1.396-0.404-1.928-0.404c-0.695,0-1.241,0.219-1.638,0.656s-0.595,1.037-0.595,1.799c0,0.77,0.212,1.372,0.636,1.808
126
+ s1.009,0.653,1.755,0.653c0.559,0,1.188-0.131,1.887-0.393V102.83z"/>
127
+ <path d="M166.623,102.267c-0.699,0.586-1.396,0.879-2.092,0.879c-0.582,0-1.062-0.166-1.438-0.498s-0.565-0.752-0.565-1.26
128
+ c0-0.66,0.293-1.191,0.879-1.594s1.359-0.604,2.32-0.604h0.715v-0.545c0-0.449-0.1-0.77-0.299-0.961s-0.529-0.287-0.99-0.287
129
+ c-0.668,0-1.359,0.188-2.074,0.562v-0.99c0.819-0.293,1.588-0.439,2.306-0.439c0.808,0,1.378,0.16,1.711,0.48s0.5,0.873,0.5,1.658
130
+ v2.666c0,0.383,0.041,0.644,0.123,0.782s0.236,0.208,0.463,0.208c0.074,0,0.195-0.02,0.363-0.059l0.105,0.691
131
+ c-0.386,0.125-0.678,0.188-0.876,0.188C167.205,103.146,166.822,102.853,166.623,102.267z M166.441,101.517v-1.605h-0.346
132
+ c-1.582,0-2.373,0.428-2.373,1.283c0,0.309,0.102,0.557,0.305,0.744s0.473,0.281,0.809,0.281
133
+ C165.34,102.22,165.875,101.986,166.441,101.517z"/>
134
+ <path d="M172.43,103.035V94.65h-2.455v-0.867h3.609v9.252H172.43z"/>
135
+ <path d="M182.654,102.83c-0.684,0.234-1.365,0.352-2.045,0.352c-1.109,0-1.964-0.289-2.563-0.867s-0.899-1.398-0.899-2.461
136
+ c0-1.043,0.296-1.857,0.888-2.443s1.415-0.879,2.47-0.879c0.672,0,1.35,0.102,2.033,0.305v0.967
137
+ c-0.754-0.27-1.396-0.404-1.928-0.404c-0.695,0-1.241,0.219-1.638,0.656s-0.595,1.037-0.595,1.799c0,0.77,0.212,1.372,0.636,1.808
138
+ s1.009,0.653,1.755,0.653c0.559,0,1.188-0.131,1.887-0.393V102.83z"/>
139
+ <path d="M186.17,98.406v-1.734h1.734v1.734H186.17z M186.17,103.035V101.3h1.734v1.734H186.17z"/>
140
+ <path d="M192.457,103.035v-6.363h1.154v1.195c0.586-0.891,1.373-1.336,2.361-1.336c0.348,0,0.742,0.049,1.184,0.146v1.805h-0.867
141
+ v-0.885c-0.172-0.039-0.328-0.059-0.469-0.059c-0.441,0-0.829,0.103-1.163,0.308s-0.683,0.554-1.046,1.046v4.143H192.457z"/>
142
+ <path d="M198.932,105.349v-8.678h1.154v1.195c0.559-0.891,1.252-1.336,2.08-1.336c0.723,0,1.292,0.278,1.708,0.835
143
+ s0.624,1.315,0.624,2.276c0,1.055-0.246,1.908-0.738,2.561s-1.137,0.979-1.934,0.979c-0.684,0-1.264-0.289-1.74-0.867v3.035
144
+ H198.932z M200.086,101.447c0.535,0.578,1.062,0.867,1.582,0.867c0.508,0,0.901-0.224,1.181-0.671s0.419-1.073,0.419-1.878
145
+ c0-1.5-0.447-2.25-1.342-2.25c-0.652,0-1.266,0.406-1.84,1.219V101.447z"/>
146
+ <path d="M211.576,102.83c-0.684,0.234-1.365,0.352-2.045,0.352c-1.109,0-1.964-0.289-2.563-0.867s-0.899-1.398-0.899-2.461
147
+ c0-1.043,0.296-1.857,0.888-2.443s1.415-0.879,2.47-0.879c0.672,0,1.35,0.102,2.033,0.305v0.967
148
+ c-0.754-0.27-1.396-0.404-1.928-0.404c-0.695,0-1.241,0.219-1.638,0.656s-0.595,1.037-0.595,1.799c0,0.77,0.212,1.372,0.636,1.808
149
+ s1.009,0.653,1.755,0.653c0.559,0,1.188-0.131,1.887-0.393V102.83z"/>
150
+ <path d="M215.092,98.406v-1.734h1.734v1.734H215.092z M215.092,103.035V101.3h1.734v1.734H215.092z"/>
151
+ <path d="M219.639,103.035l2.939-3.816l-2.688-3.702h1.368l2.025,2.79l2.155-2.79h1.125l-2.738,3.537l2.891,3.98h-1.369
152
+ l-2.221-3.061l-2.363,3.061H219.639z"/>
153
+ <path d="M228.451,103.035c0.07-0.625,0.209-1.184,0.416-1.676s0.686-1.4,1.436-2.725l1.811-3.188h-4.131v-1.084h5.227v0.973
154
+ l-0.281,0.469c-1.863,3.141-2.896,5.551-3.1,7.23H228.451z"/>
155
+ <path d="M237.076,103.035v-3.076l-2.854-4.441h1.33l2.186,3.469l2.391-3.469h1.096l-2.994,4.441v3.076H237.076z"/>
156
+ <path d="M242.25,103.035v-1.014c0.477-0.922,1.188-1.852,2.133-2.789l0.521-0.521c0.719-0.715,1.078-1.436,1.078-2.162
157
+ c0-0.465-0.138-0.837-0.413-1.116s-0.644-0.419-1.104-0.419c-0.559,0-1.225,0.203-1.998,0.609v-1.02
158
+ c0.719-0.305,1.422-0.457,2.109-0.457c0.793,0,1.431,0.216,1.913,0.647s0.724,1.001,0.724,1.708c0,0.457-0.111,0.887-0.334,1.289
159
+ s-0.6,0.852-1.131,1.348l-0.492,0.463c-0.906,0.844-1.451,1.65-1.635,2.42h3.545v1.014H242.25z"/>
160
+ <path d="M249.393,95.517h1.154v4.564c0,0.797,0.126,1.374,0.378,1.731s0.659,0.536,1.222,0.536c0.594,0,1.021-0.179,1.283-0.536
161
+ s0.393-0.944,0.393-1.761v-4.535h1.008v4.365c0,0.941-0.111,1.617-0.334,2.027c-0.473,0.871-1.252,1.307-2.338,1.307
162
+ c-0.941,0-1.638-0.258-2.089-0.773s-0.677-1.309-0.677-2.379V95.517z"/>
163
+ <path d="M261.645,95.693v1.002c-0.848-0.328-1.602-0.492-2.262-0.492c-1.043,0-1.564,0.352-1.564,1.055
164
+ c0,0.285,0.098,0.515,0.293,0.688s0.557,0.353,1.084,0.536l0.738,0.258l0.703,0.24c1.09,0.383,1.635,1.031,1.635,1.945
165
+ c0,0.695-0.278,1.251-0.835,1.667s-1.302,0.624-2.235,0.624c-0.648,0-1.486-0.139-2.514-0.416v-1.143
166
+ c1.023,0.461,1.873,0.691,2.549,0.691c0.57,0,1.025-0.112,1.365-0.337s0.51-0.526,0.51-0.905c0-0.289-0.101-0.518-0.302-0.686
167
+ s-0.616-0.367-1.245-0.598l-0.773-0.281c-0.77-0.285-1.304-0.578-1.603-0.879s-0.448-0.701-0.448-1.201
168
+ c0-0.676,0.229-1.199,0.688-1.57s1.104-0.557,1.937-0.557C260.041,95.335,260.801,95.455,261.645,95.693z"/>
169
+ </g>
170
+ <rect x="153.5" y="109.566" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" width="25" height="25"/>
171
+ <g>
172
+ <path d="M160.963,41.83c-0.684,0.234-1.365,0.352-2.045,0.352c-1.109,0-1.964-0.289-2.563-0.867s-0.899-1.398-0.899-2.461
173
+ c0-1.043,0.296-1.857,0.888-2.443s1.415-0.879,2.47-0.879c0.672,0,1.35,0.102,2.033,0.305v0.967
174
+ c-0.754-0.27-1.396-0.404-1.928-0.404c-0.695,0-1.241,0.219-1.638,0.656s-0.595,1.037-0.595,1.799c0,0.77,0.212,1.372,0.636,1.808
175
+ s1.009,0.653,1.755,0.653c0.559,0,1.188-0.131,1.887-0.393V41.83z"/>
176
+ <path d="M166.623,41.267c-0.699,0.586-1.396,0.879-2.092,0.879c-0.582,0-1.062-0.166-1.438-0.498s-0.565-0.752-0.565-1.26
177
+ c0-0.66,0.293-1.191,0.879-1.594s1.359-0.604,2.32-0.604h0.715v-0.545c0-0.449-0.1-0.77-0.299-0.961s-0.529-0.287-0.99-0.287
178
+ c-0.668,0-1.359,0.188-2.074,0.562v-0.99c0.819-0.293,1.588-0.439,2.306-0.439c0.808,0,1.378,0.16,1.711,0.48s0.5,0.873,0.5,1.658
179
+ v2.666c0,0.383,0.041,0.644,0.123,0.782s0.236,0.208,0.463,0.208c0.074,0,0.195-0.02,0.363-0.059l0.105,0.691
180
+ c-0.386,0.125-0.678,0.188-0.876,0.188C167.205,42.146,166.822,41.853,166.623,41.267z M166.441,40.517v-1.605h-0.346
181
+ c-1.582,0-2.373,0.428-2.373,1.283c0,0.309,0.102,0.557,0.305,0.744s0.473,0.281,0.809,0.281
182
+ C165.34,41.22,165.875,40.986,166.441,40.517z"/>
183
+ <path d="M172.43,42.035V33.65h-2.455v-0.867h3.609v9.252H172.43z"/>
184
+ <path d="M182.654,41.83c-0.684,0.234-1.365,0.352-2.045,0.352c-1.109,0-1.964-0.289-2.563-0.867s-0.899-1.398-0.899-2.461
185
+ c0-1.043,0.296-1.857,0.888-2.443s1.415-0.879,2.47-0.879c0.672,0,1.35,0.102,2.033,0.305v0.967
186
+ c-0.754-0.27-1.396-0.404-1.928-0.404c-0.695,0-1.241,0.219-1.638,0.656s-0.595,1.037-0.595,1.799c0,0.77,0.212,1.372,0.636,1.808
187
+ s1.009,0.653,1.755,0.653c0.559,0,1.188-0.131,1.887-0.393V41.83z"/>
188
+ </g>
189
+ <rect x="153.5" y="48.566" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" width="25" height="25"/>
190
+ <rect x="178.5" y="48.566" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" width="25" height="25"/>
191
+ <rect x="203.5" y="48.566" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" width="25" height="25"/>
192
+ <rect x="228.5" y="48.566" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" width="25" height="25"/>
193
+ <rect x="253.5" y="48.566" fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" width="25" height="25"/>
194
+ <g>
195
+ <g>
196
+ <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M353.588,74.419c0-7.02-30.376-12.765-69.053-13.311"/>
197
+ <g>
198
+ <path d="M278.5,61.066c2.858-1.003,6.413-2.737,8.631-4.602l-1.805,4.724l1.635,4.785C284.812,64.03,281.32,62.169,278.5,61.066z
199
+ "/>
200
+ </g>
201
+ </g>
202
+ </g>
203
+ <circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="393.75" cy="90.816" r="43.75"/>
204
+ <circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="44.25" cy="90.816" r="43.75"/>
205
+ <g>
206
+ <g>
207
+ <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M153.55,61.915c-0.314-2.674-29.853-1.425-67.189,2.743"/>
208
+ <g>
209
+ <path d="M80.364,65.345c2.717-1.339,6.037-3.489,8.015-5.607l-1.224,4.907l2.199,4.553
210
+ C86.986,67.528,83.296,66.101,80.364,65.345z"/>
211
+ </g>
212
+ </g>
213
+ </g>
214
+ <circle fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" cx="44.25" cy="198.316" r="13.75"/>
215
+ <g>
216
+ <g>
217
+ <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M9.744,117.695c0,37.331,6.515,68.695,15.375,77.89"/>
218
+ <g>
219
+ <path d="M30.5,198.316c-2.996-0.444-6.95-0.565-9.781,0.052l3.798-3.34l0.783-4.996C26.296,192.753,28.518,196.026,30.5,198.316z
220
+ "/>
221
+ </g>
222
+ </g>
223
+ </g>
224
+ <g>
225
+ <g>
226
+ <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M78.699,123.73C77.905,165.468,68.95,198.316,58,198.316"/>
227
+ <g>
228
+ <path d="M78.756,117.695c-1.127,2.812-3.016,6.287-4.976,8.421l4.799-1.597l4.708,1.843
229
+ C81.44,124.13,79.735,120.562,78.756,117.695z"/>
230
+ </g>
231
+ </g>
232
+ </g>
233
+ <g>
234
+ <g>
235
+ <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M83.784,109.566c0,6.544,27.977,11.906,63.68,12.454"/>
236
+ <g>
237
+ <path d="M153.5,122.066c-2.858,1.002-6.414,2.736-8.632,4.601l1.806-4.724l-1.634-4.785
238
+ C147.189,119.101,150.68,120.962,153.5,122.066z"/>
239
+ </g>
240
+ </g>
241
+ </g>
242
+ <g>
243
+ <g>
244
+ <path fill="none" stroke="#000000" stroke-miterlimit="10" d="M178.45,121.602c2.182,10.063,76.521,2.517,167.441-16.836"/>
245
+ <g>
246
+ <path d="M351.792,103.499c-2.57,1.603-5.66,4.073-7.417,6.377l0.729-5.004l-2.642-4.312
247
+ C344.985,101.985,348.799,103.038,351.792,103.499z"/>
248
+ </g>
249
+ </g>
250
+ </g>
251
+ <g>
252
+ <path d="M332.59,40.257c0,1.156-0.215,2.252-0.645,3.287s-1.055,1.967-1.875,2.795c-0.82,0.82-1.748,1.445-2.783,1.875
253
+ s-2.131,0.645-3.287,0.645c-1.148,0-2.244-0.217-3.287-0.65s-1.971-1.057-2.783-1.869c-0.82-0.828-1.445-1.76-1.875-2.795
254
+ s-0.645-2.131-0.645-3.287c0-1.148,0.215-2.242,0.645-3.281s1.055-1.969,1.875-2.789c0.812-0.812,1.74-1.436,2.783-1.869
255
+ s2.139-0.65,3.287-0.65c1.156,0,2.252,0.215,3.287,0.645s1.963,1.055,2.783,1.875s1.445,1.75,1.875,2.789
256
+ S332.59,39.109,332.59,40.257z M327.715,46.281v-0.785c-0.703-0.047-1.242-0.199-1.617-0.457s-0.602-0.633-0.68-1.125V34h-0.844
257
+ c-0.539,0.633-1.15,1.113-1.834,1.441s-1.439,0.504-2.268,0.527v0.785l1.582-0.094h0.094c0.312,0,0.531,0.09,0.656,0.27
258
+ s0.188,0.5,0.188,0.961v6.023c0,0.672-0.129,1.104-0.387,1.295s-0.898,0.287-1.922,0.287v0.785H327.715z"/>
259
+ </g>
260
+ <g>
261
+ <path d="M125.547,40.257c0,1.156-0.215,2.252-0.645,3.287s-1.055,1.967-1.875,2.795c-0.82,0.82-1.748,1.445-2.783,1.875
262
+ s-2.131,0.645-3.287,0.645c-1.148,0-2.244-0.217-3.287-0.65s-1.971-1.057-2.783-1.869c-0.82-0.828-1.445-1.76-1.875-2.795
263
+ s-0.645-2.131-0.645-3.287c0-1.148,0.215-2.242,0.645-3.281s1.055-1.969,1.875-2.789c0.812-0.812,1.74-1.436,2.783-1.869
264
+ s2.139-0.65,3.287-0.65c1.156,0,2.252,0.215,3.287,0.645s1.963,1.055,2.783,1.875s1.445,1.75,1.875,2.789
265
+ S125.547,39.109,125.547,40.257z M121.422,41.746l-0.797,0.012c-0.023,0.93-0.139,1.541-0.346,1.834s-0.619,0.439-1.236,0.439
266
+ h-4.969c0.156-0.508,0.463-0.959,0.92-1.354s1.295-0.873,2.514-1.436c1.438-0.672,2.4-1.297,2.889-1.875s0.732-1.297,0.732-2.156
267
+ c0-0.953-0.402-1.727-1.207-2.32S118.055,34,116.734,34c-1.094,0-1.975,0.238-2.643,0.715s-1.002,1.102-1.002,1.875
268
+ c0,0.422,0.117,0.756,0.352,1.002s0.551,0.369,0.949,0.369c0.328,0,0.621-0.121,0.879-0.363s0.387-0.516,0.387-0.82
269
+ c0-0.086-0.035-0.234-0.105-0.445s-0.105-0.379-0.105-0.504c0-0.242,0.129-0.459,0.387-0.65s0.551-0.287,0.879-0.287
270
+ c0.492,0,0.904,0.201,1.236,0.604s0.498,0.912,0.498,1.529c0,0.656-0.162,1.24-0.486,1.752s-1.033,1.182-2.127,2.01
271
+ c-1.328,1.008-2.205,1.867-2.631,2.578s-0.639,1.535-0.639,2.473v0.445h8.766L121.422,41.746z"/>
272
+ </g>
273
+ <g>
274
+ <path d="M34.547,158.257c0,1.156-0.215,2.252-0.645,3.287s-1.055,1.967-1.875,2.795c-0.82,0.82-1.748,1.445-2.783,1.875
275
+ s-2.131,0.645-3.287,0.645c-1.148,0-2.244-0.217-3.287-0.65s-1.971-1.057-2.783-1.869c-0.82-0.828-1.445-1.76-1.875-2.795
276
+ s-0.645-2.131-0.645-3.287c0-1.148,0.215-2.242,0.645-3.281s1.055-1.969,1.875-2.789c0.812-0.812,1.74-1.436,2.783-1.869
277
+ s2.139-0.65,3.287-0.65c1.156,0,2.252,0.215,3.287,0.645s1.963,1.055,2.783,1.875s1.445,1.75,1.875,2.789
278
+ S34.547,157.109,34.547,158.257z M25.43,158.093c0.742,0,1.32,0.219,1.734,0.656s0.621,1.051,0.621,1.84
279
+ c0,0.836-0.23,1.521-0.691,2.057s-1.047,0.803-1.758,0.803c-0.383,0-0.699-0.09-0.949-0.27s-0.375-0.402-0.375-0.668
280
+ c0-0.094,0.027-0.23,0.082-0.41s0.082-0.324,0.082-0.434c0-0.375-0.123-0.684-0.369-0.926s-0.561-0.363-0.943-0.363
281
+ c-0.438,0-0.783,0.125-1.037,0.375s-0.381,0.586-0.381,1.008c0,0.781,0.381,1.422,1.143,1.922s1.748,0.75,2.959,0.75
282
+ c1.492,0,2.709-0.348,3.65-1.043s1.412-1.59,1.412-2.684c0-0.922-0.346-1.67-1.037-2.244s-1.623-0.881-2.795-0.92v-0.07
283
+ c0.984-0.195,1.734-0.52,2.25-0.973s0.773-1.02,0.773-1.699c0-0.852-0.359-1.531-1.078-2.039S27.035,152,25.816,152
284
+ c-1.117,0-2.021,0.219-2.713,0.656s-1.037,1.004-1.037,1.699c0,0.367,0.113,0.666,0.34,0.896s0.523,0.346,0.891,0.346
285
+ c0.328,0,0.605-0.119,0.832-0.357s0.34-0.533,0.34-0.885c0-0.102-0.025-0.219-0.076-0.352s-0.08-0.223-0.088-0.27
286
+ c0.023-0.234,0.146-0.426,0.369-0.574s0.498-0.223,0.826-0.223c0.555,0,0.998,0.186,1.33,0.557s0.498,0.873,0.498,1.506
287
+ c0,0.734-0.229,1.301-0.686,1.699s-1.111,0.598-1.963,0.598h-0.598v0.797H25.43z"/>
288
+ </g>
289
+ <g>
290
+ <path d="M71.547,158.257c0,1.156-0.215,2.252-0.645,3.287s-1.055,1.967-1.875,2.795c-0.82,0.82-1.748,1.445-2.783,1.875
291
+ s-2.131,0.645-3.287,0.645c-1.148,0-2.244-0.217-3.287-0.65s-1.971-1.057-2.783-1.869c-0.82-0.828-1.445-1.76-1.875-2.795
292
+ s-0.645-2.131-0.645-3.287c0-1.148,0.215-2.242,0.645-3.281s1.055-1.969,1.875-2.789c0.812-0.812,1.74-1.436,2.783-1.869
293
+ s2.139-0.65,3.287-0.65c1.156,0,2.252,0.215,3.287,0.645s1.963,1.055,2.783,1.875s1.445,1.75,1.875,2.789
294
+ S71.547,157.109,71.547,158.257z M67.445,161.093v-1.219h-2.93V152h-1.652l-5.672,8.332l0.152,0.762h4.887v0.82
295
+ c0,0.664-0.123,1.09-0.369,1.277s-0.881,0.289-1.904,0.305v0.785h6.457l-0.012-0.785c-0.836-0.016-1.359-0.105-1.57-0.27
296
+ s-0.316-0.602-0.316-1.312v-0.82H67.445z M62.359,154.378l-0.07,5.613h-3.633L62.359,154.378z"/>
297
+ </g>
298
+ <g>
299
+ <path d="M125.547,138.257c0,1.156-0.215,2.252-0.645,3.287s-1.055,1.967-1.875,2.795c-0.82,0.82-1.748,1.445-2.783,1.875
300
+ s-2.131,0.645-3.287,0.645c-1.148,0-2.244-0.217-3.287-0.65s-1.971-1.057-2.783-1.869c-0.82-0.828-1.445-1.76-1.875-2.795
301
+ s-0.645-2.131-0.645-3.287c0-1.148,0.215-2.242,0.645-3.281s1.055-1.969,1.875-2.789c0.812-0.812,1.74-1.436,2.783-1.869
302
+ s2.139-0.65,3.287-0.65c1.156,0,2.252,0.215,3.287,0.645s1.963,1.055,2.783,1.875s1.445,1.75,1.875,2.789
303
+ S125.547,137.109,125.547,138.257z M114.051,139.242c0.328-0.469,0.664-0.816,1.008-1.043s0.703-0.34,1.078-0.34
304
+ c0.617,0,1.129,0.254,1.535,0.762s0.609,1.164,0.609,1.969c0,0.93-0.197,1.654-0.592,2.174s-0.943,0.779-1.646,0.779
305
+ c-0.398,0-0.738-0.084-1.02-0.252s-0.422-0.365-0.422-0.592c0-0.062,0.045-0.199,0.135-0.41s0.135-0.395,0.135-0.551
306
+ c0-0.359-0.131-0.66-0.393-0.902s-0.588-0.363-0.979-0.363c-0.398,0-0.73,0.139-0.996,0.416s-0.398,0.627-0.398,1.049
307
+ c0,0.727,0.373,1.324,1.119,1.793s1.717,0.703,2.912,0.703c1.555,0,2.797-0.357,3.727-1.072s1.395-1.662,1.395-2.842
308
+ c0-1.117-0.377-2.018-1.131-2.701s-1.748-1.025-2.982-1.025c-0.523,0-1.041,0.088-1.553,0.264s-1.033,0.443-1.564,0.803
309
+ l0.293-3.176c0.367,0.031,0.76,0.055,1.178,0.07s0.881,0.023,1.389,0.023c1.43,0,2.414-0.193,2.953-0.58s0.945-1.119,1.219-2.197
310
+ c-0.391,0.117-0.824,0.203-1.301,0.258s-1.148,0.082-2.016,0.082c-1.078,0-1.92-0.027-2.525-0.082s-1.154-0.141-1.646-0.258
311
+ c-0.023,1.117-0.08,2.246-0.17,3.387s-0.217,2.293-0.381,3.457c0.164,0.031,0.334,0.082,0.51,0.152
312
+ S113.879,139.148,114.051,139.242z"/>
313
+ </g>
314
+ <g>
315
+ <path d="M332.59,138.257c0,1.156-0.215,2.252-0.645,3.287s-1.055,1.967-1.875,2.795c-0.82,0.82-1.748,1.445-2.783,1.875
316
+ s-2.131,0.645-3.287,0.645c-1.148,0-2.244-0.217-3.287-0.65s-1.971-1.057-2.783-1.869c-0.82-0.828-1.445-1.76-1.875-2.795
317
+ s-0.645-2.131-0.645-3.287c0-1.148,0.215-2.242,0.645-3.281s1.055-1.969,1.875-2.789c0.812-0.812,1.74-1.436,2.783-1.869
318
+ s2.139-0.65,3.287-0.65c1.156,0,2.252,0.215,3.287,0.645s1.963,1.055,2.783,1.875s1.445,1.75,1.875,2.789
319
+ S332.59,137.109,332.59,138.257z M321.574,138.621v-0.281c0-1.836,0.229-3.211,0.686-4.125s1.143-1.371,2.057-1.371
320
+ c0.352,0,0.654,0.088,0.908,0.264s0.381,0.381,0.381,0.615c0,0.078-0.031,0.213-0.094,0.404s-0.094,0.346-0.094,0.463
321
+ c0,0.375,0.115,0.678,0.346,0.908s0.529,0.346,0.896,0.346c0.391,0,0.701-0.125,0.932-0.375s0.346-0.582,0.346-0.996
322
+ c0-0.711-0.348-1.301-1.043-1.77s-1.582-0.703-2.66-0.703c-1.562,0-2.844,0.592-3.844,1.775s-1.5,2.713-1.5,4.588
323
+ c0,1.891,0.455,3.375,1.365,4.453s2.158,1.617,3.744,1.617c1.352,0,2.465-0.387,3.34-1.16s1.312-1.746,1.312-2.918
324
+ c0-1.016-0.354-1.871-1.061-2.566s-1.576-1.043-2.607-1.043c-0.695,0-1.318,0.15-1.869,0.451S322.051,137.972,321.574,138.621z
325
+ M326.203,140.66c0,0.891-0.205,1.605-0.615,2.145s-0.947,0.809-1.611,0.809c-0.656,0-1.201-0.258-1.635-0.773
326
+ s-0.65-1.176-0.65-1.98c0-0.852,0.223-1.541,0.668-2.068s1.023-0.791,1.734-0.791c0.625,0,1.133,0.244,1.523,0.732
327
+ S326.203,139.863,326.203,140.66z"/>
328
+ </g>
329
+ </svg>
@@ -0,0 +1,32 @@
1
+ class Calculator
2
+ # A simple, mutable calculator used for testing.
3
+ # referenced explicitly in ../spec/calculator.spec.rb
4
+
5
+ def initialize
6
+ @acc = 0.0
7
+ end
8
+
9
+ def clr
10
+ @acc = 0.0
11
+ end
12
+
13
+ def add(number)
14
+ @acc += number
15
+ end
16
+
17
+ def div(number)
18
+ @acc /= number
19
+ end
20
+
21
+ def mul(number)
22
+ @acc *= number
23
+ end
24
+
25
+ def sub(number)
26
+ @acc -= number
27
+ end
28
+
29
+ def val
30
+ return @acc
31
+ end
32
+ end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'redis'
4
+
5
+ require File.expand_path('../../lib/redisrpc', __FILE__)
6
+ require File.expand_path('../calc', __FILE__)
7
+
8
+ def assert(cond)
9
+ if not cond
10
+ fail 'assertion failed'
11
+ end
12
+ end
13
+
14
+ def do_calculations(calculator)
15
+ calculator.clr
16
+ calculator.add 5
17
+ calculator.sub 3
18
+ calculator.mul 4
19
+ calculator.div 2
20
+ assert calculator.val == 4
21
+ begin
22
+ calculator.missing_method
23
+ assert false
24
+ rescue NoMethodError
25
+ rescue RedisRpc::RemoteException
26
+ end
27
+ end
28
+
29
+ # 1. Local object
30
+ calculator = Calculator.new
31
+ do_calculations calculator
32
+
33
+ # 2. Remote object, should act like local object
34
+ redis_server = Redis.new
35
+ message_queue = 'calc'
36
+ timeout = 1
37
+ calculator = RedisRpc::Client.new redis_server, message_queue, timeout
38
+ do_calculations calculator
39
+ puts 'success!'
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'redis'
4
+
5
+ require File.expand_path('../../lib/redisrpc', __FILE__)
6
+ require File.expand_path('../calc', __FILE__)
7
+
8
+ redis_server = Redis.new
9
+ message_queue = 'calc'
10
+ local_object = Calculator.new
11
+ server = RedisRpc::Server.new redis_server, message_queue, local_object
12
+ server.run
@@ -0,0 +1,137 @@
1
+ # Copyright (C) 2012. Nathan Farrington <nfarring@gmail.com>
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License
14
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require File.expand_path('../redis-rpc/version',__FILE__)
17
+ require 'multi_json'
18
+
19
+ require 'redis'
20
+
21
+ module RedisRpc
22
+
23
+ class RemoteException < Exception; end
24
+ class TimeoutException < Exception; end
25
+ class MalformedResponseException < RemoteException
26
+ def initialize(response)
27
+ super "Malformed RPC Response message: #{response.inspect}"
28
+ end
29
+ end
30
+ class MalformedRequestException < ArgumentError
31
+ def initialize(reason)
32
+ super "Malformed RPC Request: #{reason.inspect}"
33
+ end
34
+ end
35
+
36
+ class Client
37
+ def initialize( redis_server, message_queue, timeout=0 )
38
+ @redis_server = redis_server
39
+ @message_queue = message_queue
40
+ @timeout = timeout
41
+ end
42
+
43
+ alias :send! :send
44
+ def send( method_name, *args)
45
+ raise MalformedRequestException, 'block not allowed over RPC' if block_given?
46
+
47
+ # request setup
48
+ function_call = {'name' => method_name.to_s, 'args' => args}
49
+ response_queue = @message_queue + ':rpc:' + rand_string
50
+ rpc_request = {'function_call' => function_call, 'response_queue' => response_queue}
51
+ rpc_raw_request = MultiJson.dump rpc_request
52
+
53
+ # transport
54
+ @redis_server.rpush @message_queue, rpc_raw_request
55
+ message_queue, rpc_raw_response = @redis_server.blpop response_queue, @timeout
56
+ raise TimeoutException if rpc_raw_response.nil?
57
+
58
+ # response handling
59
+ rpc_response = MultiJson.load rpc_raw_response
60
+ raise RemoteException, rpc_response['exception'] if rpc_response.has_key? 'exception'
61
+ raise MalformedResponseException, rpc_response unless rpc_response.has_key? 'return_value'
62
+ return rpc_response['return_value']
63
+
64
+ rescue TimeoutException
65
+ # stale request cleanup
66
+ @redis_server.lrem @message_queue, 0, rpc_raw_request
67
+ raise $!
68
+ end
69
+
70
+ alias :method_missing :send
71
+
72
+ def respond_to?( method_name )
73
+ send( :respond_to?, method_name )
74
+ end
75
+
76
+ private
77
+
78
+ def rand_string(size=8)
79
+ return rand(36**size).to_s(36).upcase.rjust(size,'0')
80
+ end
81
+ end
82
+
83
+ class Server
84
+ def initialize( redis_server, message_queue, local_object, timeout=nil )
85
+ @redis_server = redis_server
86
+ @message_queue = message_queue
87
+ @local_object = local_object
88
+ @timeout = timeout
89
+ end
90
+
91
+ def run
92
+ loop{ run_one }
93
+ end
94
+
95
+ def run!
96
+ flush_queue!
97
+ run
98
+ end
99
+
100
+ def flush_queue!
101
+ @redis_server.del @message_queue
102
+ end
103
+
104
+ private
105
+
106
+ def run_one
107
+ # request setup
108
+ message_queue, rpc_raw_request = @redis_server.blpop @message_queue, timeout
109
+ return nil if rpc_raw_request.nil?
110
+ rpc_request = MultiJson.load rpc_raw_request
111
+ response_queue = rpc_request['response_queue']
112
+ function_call = rpc_request['function_call']
113
+
114
+ # request execution
115
+ begin
116
+ return_value = @local_object.send( function_call['name'].to_sym, *function_call['args'] )
117
+ rpc_response = {'return_value' => return_value}
118
+ rescue Object => err
119
+ rpc_response = {'exception' => err.to_s, 'backtrace' => err.backtrace}
120
+ end
121
+
122
+ # response tansport
123
+ rpc_raw_response = MultiJson.dump rpc_response
124
+ @redis_server.multi do
125
+ @redis_server.rpush response_queue, rpc_raw_response
126
+ @redis_server.expire response_queue, 1
127
+ end
128
+ true
129
+ end
130
+
131
+ def timeout
132
+ @timeout or
133
+ $REDISRPC_SERVER_TIMEOUT or
134
+ 0
135
+ end
136
+ end
137
+ end