Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
javadsaberlatibari authored Mar 27, 2024
1 parent 32af7b1 commit c91a926
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions wellcoordination/benchmark/rubis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class Rubis : public ReplicatedObject
//registerUser 2 1(id) by leader
//openAuction 1(id) by default consider 100 auctions are open.
//placeBid 3 3(auctionid+userid+value)
//query 4 like movie does not consider read.
//openauction 4
//closeauction
//query 6 like movie does not consider read.
private:

public:
Expand Down Expand Up @@ -96,7 +98,9 @@ class Rubis : public ReplicatedObject
// 0
void sellItem(int s_id, int value)
{
auction[s_id][0]=value;
if(auction[a_id][3]==1){
auction[s_id][0]=value;
}
}
// 1
void storeBuyNow(int s_id, int value)
Expand All @@ -113,7 +117,7 @@ class Rubis : public ReplicatedObject
// 3
void placeBid(int a_id, int u_id, int value)
{
if(registeredusers[u_id]){
if(registeredusers[u_id] && auction[a_id][3]==1){
if(auction[a_id][2]<value){
auction[a_id][1]=u_id;
auction[a_id][2]=value;
Expand All @@ -123,8 +127,10 @@ class Rubis : public ReplicatedObject

void openAction(int a_id, int stock)
{
if(auction[a_id][3]==0){
auction[a_id][0]=stock;
auction[a_id][3]=1;
}
}
void closeAction(int a_id)
{
Expand Down

0 comments on commit c91a926

Please sign in to comment.