root / src / main / avro / aquarium-user-state.avdl @ 4b8ff3e0
History | View | Annotate | Download (5.3 kB)
1 |
/* |
---|---|
2 |
* Copyright 2011-2012 GRNET S.A. All rights reserved. |
3 |
* |
4 |
* Redistribution and use in source and binary forms, with or |
5 |
* without modification, are permitted provided that the following |
6 |
* conditions are met: |
7 |
* |
8 |
* 1. Redistributions of source code must retain the above |
9 |
* copyright notice, this list of conditions and the following |
10 |
* disclaimer. |
11 |
* |
12 |
* 2. Redistributions in binary form must reproduce the above |
13 |
* copyright notice, this list of conditions and the following |
14 |
* disclaimer in the documentation and/or other materials |
15 |
* provided with the distribution. |
16 |
* |
17 |
* THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS |
18 |
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR |
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
24 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
25 |
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
26 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
27 |
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 |
* POSSIBILITY OF SUCH DAMAGE. |
29 |
* |
30 |
* The views and conclusions contained in the software and |
31 |
* documentation are those of the authors and should not be |
32 |
* interpreted as representing official policies, either expressed |
33 |
* or implied, of GRNET S.A. |
34 |
*/ |
35 |
|
36 |
@namespace("gr.grnet.aquarium.message.avro.gen") |
37 |
protocol AquariumUserState { |
38 |
import idl "aquarium-policy.avdl"; |
39 |
import idl "aquarium-anyvalue.avdl"; |
40 |
import idl "aquarium-events.avdl"; |
41 |
|
42 |
record UserAgreementMsg { |
43 |
string id; |
44 |
union {string, null} relatedIMEventOriginalID; |
45 |
string userID; |
46 |
long occurredMillis = 0; // when was this agreement created inside Aquarium |
47 |
long @order("ascending") validFromMillis; |
48 |
long validToMillis; |
49 |
string role; |
50 |
union {FullPriceTableMsg, null} fullPriceTableRef; // If null, then get from aquarium policy |
51 |
union {IMEventMsg, null} relatedIMEventMsg; // non-null if there is a related IMEvent |
52 |
} |
53 |
|
54 |
record ResourceInstanceChargingStateMsg { |
55 |
string clientID; // who sent me? |
56 |
string resource; // what kind of resource am I? |
57 |
string instanceID; // who am I? |
58 |
map<AnyValueMsg> details; |
59 |
array<ResourceEventMsg> previousEvents; |
60 |
array<ResourceEventMsg> implicitlyIssuedStartEvents; |
61 |
string accumulatingAmount; |
62 |
string oldAccumulatingAmount; |
63 |
string previousValue; |
64 |
string currentValue; |
65 |
} |
66 |
|
67 |
record ResourcesChargingStateMsg { |
68 |
string resource; // who am I? |
69 |
map<AnyValueMsg> details; |
70 |
map<ResourceInstanceChargingStateMsg> stateOfResourceInstance; |
71 |
} |
72 |
|
73 |
record UserAgreementHistoryMsg { |
74 |
string originalID; |
75 |
union {string, null} inStoreID; |
76 |
string userID; |
77 |
long latestOccurredMillis; // the latest occurredMillis of all underlying agreements |
78 |
long latestValidFromMillis; // the latest validFromMillis of all underlying agreements |
79 |
long userCreationTimeMillis = 0; |
80 |
array<UserAgreementMsg> agreements; |
81 |
} |
82 |
|
83 |
record ChargeslotMsg { |
84 |
long startMillis; |
85 |
long stopMillis; |
86 |
string unitPrice; |
87 |
string explanation = ""; |
88 |
string creditsToSubtract = 0.0; |
89 |
} |
90 |
|
91 |
// The following equation must hold (within a very small error): |
92 |
// `newTotalCredits = oldTotalCredits - sumOfCreditsToSubtract`. |
93 |
record WalletEntryMsg { |
94 |
string userID; // The user ID this wallet entry is related to. |
95 |
string sumOfCreditsToSubtract; // The credit amount generated for this wallet entry. |
96 |
string oldTotalCredits; |
97 |
string newTotalCredits; |
98 |
long whenComputedMillis; // When the computation took place |
99 |
long referenceStartMillis; // start of period this entry refers to |
100 |
long referenceStopMillis; // end of period this entry refers to |
101 |
int billingYear; |
102 |
int billingMonth; |
103 |
int billingMonthDay; |
104 |
array<ChargeslotMsg> chargeslots; // The details of the credit computation |
105 |
array<ResourceEventMsg> resourceEvents; // The events used to make this computation. The current is the last one |
106 |
ResourceTypeMsg resourceType; |
107 |
boolean isSynthetic = false; |
108 |
boolean isForRealtimeCalc = false; |
109 |
} |
110 |
|
111 |
// convenient wrapper for a list of wallet entries |
112 |
record WalletEntriesMsg { |
113 |
array<WalletEntryMsg> entries; |
114 |
} |
115 |
|
116 |
record UserStateMsg { |
117 |
string originalID; // internal Aquarium ID |
118 |
union {string, null} inStoreID; // From Aquarium store |
119 |
string userID; |
120 |
long occurredMillis; // When we created the event |
121 |
union {string, null} parentOriginalID; |
122 |
union {string, null} parentInStoreID; |
123 |
boolean isFirst = false; // True only for the very first user state |
124 |
boolean isForFullMonth = false; // True when computed as a reference for a month's billing state |
125 |
map<ResourcesChargingStateMsg> stateOfResources; // Map[ResourceTypeMsg.name.type, ] |
126 |
string totalCredits = "0"; |
127 |
long latestUpdateMillis; // // last update of this working user state |
128 |
long latestResourceEventOccurredMillis; |
129 |
long billingPeriodOutOfSyncResourceEventsCounter = 0; |
130 |
int billingYear; // The billing year this snapshot refers to |
131 |
int billingMonth; // The billing month this year refers to |
132 |
int billingMonthDay; |
133 |
UserAgreementHistoryMsg userAgreementHistory; |
134 |
array<WalletEntryMsg> walletEntries; |
135 |
} |
136 |
} |