Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tapir
Manage
Activity
Members
Labels
Plan
Issues
8
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
syslab
tapir
Commits
0bce26cc
Commit
0bce26cc
authored
9 years ago
by
Irene Y Zhang
Browse files
Options
Downloads
Patches
Plain Diff
adding transactional store interface
parent
7876252a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
store/txnstore/lib/txnstore.cc
+71
-0
71 additions, 0 deletions
store/txnstore/lib/txnstore.cc
store/txnstore/lib/txnstore.h
+63
-0
63 additions, 0 deletions
store/txnstore/lib/txnstore.h
with
134 additions
and
0 deletions
store/txnstore/lib/txnstore.cc
0 → 100644
+
71
−
0
View file @
0bce26cc
// -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*-
// vim: set ts=4 sw=4:
/***********************************************************************
*
* common/txnstore.cc:
* Interface for a single node transactional store serving as a
* server-side backend
*
**********************************************************************/
#include
"common/txnstore.h"
using
namespace
std
;
TxnStore
::
TxnStore
()
{}
TxnStore
::~
TxnStore
()
{}
int
TxnStore
::
Get
(
uint64_t
id
,
const
string
&
key
,
pair
<
Timestamp
,
string
>
&
value
)
{
Panic
(
"Unimplemented GET"
);
return
0
;
}
int
TxnStore
::
Get
(
uint64_t
id
,
const
string
&
key
,
const
Timestamp
&
timestamp
,
pair
<
Timestamp
,
string
>
&
value
)
{
Panic
(
"Unimplemented GET"
);
return
0
;
}
int
TxnStore
::
Put
(
uint64_t
id
,
const
string
&
key
,
const
string
&
value
)
{
Panic
(
"Unimplemented PUT"
);
return
0
;
}
int
TxnStore
::
Prepare
(
uint64_t
id
,
const
Transaction
&
txn
)
{
Panic
(
"Unimplemented PREPARE"
);
return
0
;
}
int
TxnStore
::
Prepare
(
uint64_t
id
,
const
Transaction
&
txn
,
const
Timestamp
&
timestamp
,
Timestamp
&
proposed
)
{
Panic
(
"Unimplemented PREPARE"
);
return
0
;
}
void
TxnStore
::
Commit
(
uint64_t
id
,
uint64_t
timestamp
)
{
Panic
(
"Unimplemented COMMIT"
);
}
void
TxnStore
::
Abort
(
uint64_t
id
,
const
Transaction
&
txn
)
{
Panic
(
"Unimplemented ABORT"
);
}
void
TxnStore
::
Load
(
const
string
&
key
,
const
string
&
value
,
const
Timestamp
&
timestamp
)
{
Panic
(
"Unimplemented LOAD"
);
}
This diff is collapsed.
Click to expand it.
store/txnstore/lib/txnstore.h
0 → 100644
+
63
−
0
View file @
0bce26cc
// -*- mode: c++; c-file-style: "k&r"; c-basic-offset: 4 -*-
// vim: set ts=4 sw=4:
/***********************************************************************
*
* common/txnstore.h:
* Interface for a single node transactional store serving as a
* server-side backend
*
**********************************************************************/
#ifndef _TXN_STORE_H_
#define _TXN_STORE_H_
#include
"paxos-lib/lib/assert.h"
#include
"paxos-lib/lib/message.h"
#include
"common/transaction.h"
#include
"common/timestamp.h"
// Reply types
#define REPLY_OK 0
#define REPLY_FAIL 1
#define REPLY_RETRY 2
#define REPLY_ABSTAIN 3
#define REPLY_TIMEOUT 4
#define REPLY_NETWORK_FAILURE 5
#define REPLY_MAX 6
class
TxnStore
{
public:
TxnStore
();
virtual
~
TxnStore
();
// add key to read set
virtual
int
Get
(
uint64_t
id
,
const
std
::
string
&
key
,
std
::
pair
<
Timestamp
,
std
::
string
>
&
value
);
virtual
int
Get
(
uint64_t
id
,
const
std
::
string
&
key
,
const
Timestamp
&
timestamp
,
std
::
pair
<
Timestamp
,
std
::
string
>
&
value
);
// add key to write set
virtual
int
Put
(
uint64_t
id
,
const
std
::
string
&
key
,
const
std
::
string
&
value
);
// check whether we can commit this transaction (and lock the read/write set)
virtual
int
Prepare
(
uint64_t
id
,
const
Transaction
&
txn
);
virtual
int
Prepare
(
uint64_t
id
,
const
Transaction
&
txn
,
const
Timestamp
&
timestamp
,
Timestamp
&
proposed
);
// commit the transaction
virtual
void
Commit
(
uint64_t
id
,
uint64_t
timestamp
=
0
);
// abort a running transaction
virtual
void
Abort
(
uint64_t
id
,
const
Transaction
&
txn
=
Transaction
());
// load keys
virtual
void
Load
(
const
std
::
string
&
key
,
const
std
::
string
&
value
,
const
Timestamp
&
timestamp
);
};
#endif
/* _TXN_STORE_H_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment