Unifying simple & complex resources.
[aquarium] / src / main / scala / gr / grnet / aquarium / store / WalletEntryStore.scala
1 package gr.grnet.aquarium.store
2
3 import gr.grnet.aquarium.logic.events.{WalletEntry}
4 import java.util.Date
5 import com.ckkloverdos.maybe.Maybe
6
7 /**
8  * A store for Wallet entries.
9  *
10  * @author Georgios Gousios <gousiosg@gmail.com>
11  * @author Christos KK Loverdos <loverdos@gmail.com>
12  */
13 trait WalletEntryStore {
14
15   def storeWalletEntry(entry: WalletEntry): Maybe[RecordID]
16
17   def findWalletEntryById(id: String): Maybe[WalletEntry]
18
19   def findUserWalletEntries(userId: String): List[WalletEntry]
20
21   def findUserWalletEntriesFromTo(userId: String, from: Date, to: Date): List[WalletEntry]
22
23   /**
24    * Finds latest wallet entries with same timestamp.
25    */
26   def findLatestUserWalletEntries(userId: String): Maybe[List[WalletEntry]]
27
28   /**
29    * Find the previous entry in the user's wallet for the provided resource
30    * instance id.
31    */
32   def findPreviousEntry(userId: String, resource: String,
33                         instanceId: String, finalized: Option[Boolean]): List[WalletEntry]
34
35   def findWalletEntriesAfter(userId: String, from: Date): List[WalletEntry]
36 }