Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
07c1722d
Commit
07c1722d
authored
8 years ago
by
Benjamin Bollen
Browse files
Options
Downloads
Patches
Plain Diff
rename ErisDBApp to ErisMint
parent
9dd20c8a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
manager/eris-mint/eris-mint.go
+13
-13
13 additions, 13 deletions
manager/eris-mint/eris-mint.go
with
13 additions
and
13 deletions
manager/eris-mint/eris-mint.go
+
13
−
13
View file @
07c1722d
...
...
@@ -34,7 +34,7 @@ import (
)
//--------------------------------------------------------------------------------
// Eris
DBApp
holds the current state, runs transactions, computes hashes.
// Eris
Mint
holds the current state, runs transactions, computes hashes.
// Typically two connections are opened by the tendermint core:
// one for mempool, one for consensus.
...
...
@@ -55,7 +55,7 @@ type ErisMint struct {
nTxs
int
// count txs in a block
}
func
(
app
*
Eris
DBApp
)
GetState
()
*
sm
.
State
{
func
(
app
*
Eris
Mint
)
GetState
()
*
sm
.
State
{
app
.
mtx
.
Lock
()
defer
app
.
mtx
.
Unlock
()
return
app
.
state
.
Copy
()
...
...
@@ -64,18 +64,18 @@ func (app *ErisDBApp) GetState() *sm.State {
// TODO: this is used for call/callcode and to get nonces during mempool.
// the former should work on last committed state only and the later should
// be handled by the client, or a separate wallet-like nonce tracker thats not part of the app
func
(
app
*
Eris
DBApp
)
GetCheckCache
()
*
sm
.
BlockCache
{
func
(
app
*
Eris
Mint
)
GetCheckCache
()
*
sm
.
BlockCache
{
return
app
.
checkCache
}
func
(
app
*
Eris
DBApp
)
SetHostAddress
(
host
string
)
{
func
(
app
*
Eris
Mint
)
SetHostAddress
(
host
string
)
{
app
.
host
=
host
app
.
client
=
client
.
NewClientURI
(
host
)
//fmt.Sprintf("http://%s", host))
}
// Broadcast a tx to the tendermint core
// NOTE: this assumes we know the address of core
func
(
app
*
Eris
DBApp
)
BroadcastTx
(
tx
types
.
Tx
)
error
{
func
(
app
*
Eris
Mint
)
BroadcastTx
(
tx
types
.
Tx
)
error
{
buf
:=
new
(
bytes
.
Buffer
)
var
n
int
var
err
error
...
...
@@ -93,8 +93,8 @@ func (app *ErisDBApp) BroadcastTx(tx types.Tx) error {
return
err
}
func
NewEris
DBApp
(
s
*
sm
.
State
,
evsw
*
events
.
EventSwitch
)
*
Eris
DBApp
{
return
&
Eris
DBApp
{
func
NewEris
Mint
(
s
*
sm
.
State
,
evsw
*
events
.
EventSwitch
)
*
Eris
Mint
{
return
&
Eris
Mint
{
state
:
s
,
cache
:
sm
.
NewBlockCache
(
s
),
checkCache
:
sm
.
NewBlockCache
(
s
),
...
...
@@ -104,17 +104,17 @@ func NewErisDBApp(s *sm.State, evsw *events.EventSwitch) *ErisDBApp {
}
// Implements tmsp.Application
func
(
app
*
Eris
DBApp
)
Info
()
(
info
string
)
{
func
(
app
*
Eris
Mint
)
Info
()
(
info
string
)
{
return
"ErisDB"
}
// Implements tmsp.Application
func
(
app
*
Eris
DBApp
)
SetOption
(
key
string
,
value
string
)
(
log
string
)
{
func
(
app
*
Eris
Mint
)
SetOption
(
key
string
,
value
string
)
(
log
string
)
{
return
""
}
// Implements tmsp.Application
func
(
app
*
Eris
DBApp
)
AppendTx
(
txBytes
[]
byte
)
(
res
tmsp
.
Result
)
{
func
(
app
*
Eris
Mint
)
AppendTx
(
txBytes
[]
byte
)
(
res
tmsp
.
Result
)
{
app
.
nTxs
+=
1
...
...
@@ -139,7 +139,7 @@ func (app *ErisDBApp) AppendTx(txBytes []byte) (res tmsp.Result) {
}
// Implements tmsp.Application
func
(
app
*
Eris
DBApp
)
CheckTx
(
txBytes
[]
byte
)
(
res
tmsp
.
Result
)
{
func
(
app
*
Eris
Mint
)
CheckTx
(
txBytes
[]
byte
)
(
res
tmsp
.
Result
)
{
var
n
int
var
err
error
tx
:=
new
(
types
.
Tx
)
...
...
@@ -165,7 +165,7 @@ func (app *ErisDBApp) CheckTx(txBytes []byte) (res tmsp.Result) {
// Commit the state (called at end of block)
// NOTE: CheckTx/AppendTx must not run concurrently with Commit -
// the mempool should run during AppendTxs, but lock for Commit and Update
func
(
app
*
Eris
DBApp
)
Commit
()
(
res
tmsp
.
Result
)
{
func
(
app
*
Eris
Mint
)
Commit
()
(
res
tmsp
.
Result
)
{
app
.
mtx
.
Lock
()
// the lock protects app.state
defer
app
.
mtx
.
Unlock
()
...
...
@@ -192,6 +192,6 @@ func (app *ErisDBApp) Commit() (res tmsp.Result) {
return
tmsp
.
NewResultOK
(
app
.
state
.
Hash
(),
"Success"
)
}
func
(
app
*
Eris
DBApp
)
Query
(
query
[]
byte
)
(
res
tmsp
.
Result
)
{
func
(
app
*
Eris
Mint
)
Query
(
query
[]
byte
)
(
res
tmsp
.
Result
)
{
return
tmsp
.
NewResultOK
(
nil
,
"Success"
)
}
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