Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
c70467a6
Commit
c70467a6
authored
Feb 15, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
aa17a79e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
17 deletions
+67
-17
go/neo/storage/sqlite/sqlite.go
go/neo/storage/sqlite/sqlite.go
+20
-3
go/neo/storage/storage.go
go/neo/storage/storage.go
+2
-0
go/neo/t/neotest
go/neo/t/neotest
+45
-14
No files found.
go/neo/storage/sqlite/sqlite.go
View file @
c70467a6
...
@@ -158,7 +158,6 @@ func (b *Backend) LastTid(ctx context.Context) (zodb.Tid, error) {
...
@@ -158,7 +158,6 @@ func (b *Backend) LastTid(ctx context.Context) (zodb.Tid, error) {
return
0
,
nil
return
0
,
nil
}
}
// XXX ok to reuse zodb.OpError here? or better it should be storage.OpError ?
return
0
,
&
zodb
.
OpError
{
URL
:
b
.
url
,
Op
:
"last_tid"
,
Err
:
err
}
return
0
,
&
zodb
.
OpError
{
URL
:
b
.
url
,
Op
:
"last_tid"
,
Err
:
err
}
}
}
...
@@ -166,7 +165,25 @@ func (b *Backend) LastTid(ctx context.Context) (zodb.Tid, error) {
...
@@ -166,7 +165,25 @@ func (b *Backend) LastTid(ctx context.Context) (zodb.Tid, error) {
}
}
func
(
b
*
Backend
)
LastOid
(
ctx
context
.
Context
)
(
zodb
.
Oid
,
error
)
{
func
(
b
*
Backend
)
LastOid
(
ctx
context
.
Context
)
(
zodb
.
Oid
,
error
)
{
panic
(
"TODO"
)
var
lastOid
zodb
.
Oid
// FIXME nodeID <- my node UUID
myID
:=
proto
.
UUID
(
proto
.
STORAGE
,
1
)
err
:=
b
.
query1
(
ctx
,
"SELECT MAX(oid) FROM pt, obj WHERE nid=? AND rid=partition"
,
myID
)
.
Scan
(
lastOid
)
if
err
!=
nil
{
// no objects
if
err
==
sql
.
ErrNoRows
{
return
proto
.
INVALID_OID
,
nil
}
return
0
,
&
zodb
.
OpError
{
URL
:
b
.
url
,
Op
:
"last_oid"
,
Err
:
err
}
}
return
lastOid
,
nil
}
}
func
(
b
*
Backend
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
_
*
proto
.
AnswerObject
,
err
error
)
{
func
(
b
*
Backend
)
Load
(
ctx
context
.
Context
,
xid
zodb
.
Xid
)
(
_
*
proto
.
AnswerObject
,
err
error
)
{
...
@@ -303,7 +320,7 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) {
...
@@ -303,7 +320,7 @@ func openURL(ctx context.Context, u *url.URL) (_ storage.Backend, err error) {
}
}
// config("version")
vs version
// config("version")
// config("nid")
// config("nid")
// config("partitions")
// config("partitions")
// config("replicas")
// config("replicas")
...
...
go/neo/storage/storage.go
View file @
c70467a6
...
@@ -32,6 +32,8 @@ import (
...
@@ -32,6 +32,8 @@ import (
)
)
// Backend is the interface for actual storage service that is used by neo.Storage node.
// Backend is the interface for actual storage service that is used by neo.Storage node.
//
// XXX ok to reuse zodb.OpError for errors? or better it should be storage.OpError?
type
Backend
interface
{
type
Backend
interface
{
// LastTid should return the id of the last committed transaction.
// LastTid should return the id of the last committed transaction.
//
//
...
...
go/neo/t/neotest
View file @
c70467a6
...
@@ -307,9 +307,16 @@ Zpy() {
...
@@ -307,9 +307,16 @@ Zpy() {
# ---- start NEO clusters ----
# ---- start NEO clusters ----
# spawn NEO/go cluster (Sgo+Mpy+Apy) working on data.fs
# spawn NEO/go cluster (Sgo+Mpy+Apy) working on data.fs
NEOgo
()
{
NEOgo
fs1
()
{
Mpy
--autostart
=
1
Mpy
--autostart
=
1
Sgo
$fs1
/data.fs
Sgo fs1://
$fs1
/data.fs
Apy
}
# spawn NEO/go cluster (Sgo+Mpy+Apy) working on sqlite db
NEOgolite
()
{
Mpy
--autostart
=
1
Sgo sqlite://
$neolite
Apy
Apy
}
}
...
@@ -1119,15 +1126,27 @@ zbench_local() {
...
@@ -1119,15 +1126,27 @@ zbench_local() {
xmysql
-e
"SHUTDOWN"
xmysql
-e
"SHUTDOWN"
wait
wait
echo
-e
"
\n
*** NEO/go"
echo
-e
"
\n
*** NEO/go fs1"
NEOgo
NEOgofs1
zbench neo://
$neocluster
@
$Mbind
`
hostname
`
/neo/go
$zhashok
zbench neo://
$neocluster
@
$Mbind
`
hostname
`
/neo/go/fs1
$zhashok
xneoctl
set
cluster stopping
wait
echo
-e
"
\n
*** NEO/go fs1 (sha1 disabled)"
X_NEOGO_SHA1_SKIP
=
y NEOgofs1
X_NEOGO_SHA1_SKIP
=
y zbench_go neo://
$neocluster
@
$Mbind
"
`
hostname
`
/neo/go/fs1(!sha1)"
$zhashok
xneoctl
set
cluster stopping
wait
echo
-e
"
\n
*** NEO/go sqlite"
NEOgolite
zbench neo://
$neocluster
@
$Mbind
`
hostname
`
/neo/go/sqlite
$zhashok
xneoctl
set
cluster stopping
xneoctl
set
cluster stopping
wait
wait
echo
-e
"
\n
*** NEO/go (sha1 disabled)"
echo
-e
"
\n
*** NEO/go
sqlite
(sha1 disabled)"
X_NEOGO_SHA1_SKIP
=
y NEOgo
X_NEOGO_SHA1_SKIP
=
y NEOgo
lite
X_NEOGO_SHA1_SKIP
=
y zbench_go neo://
$neocluster
@
$Mbind
"
`
hostname
`
/neo/go(!sha1)"
$zhashok
X_NEOGO_SHA1_SKIP
=
y zbench_go neo://
$neocluster
@
$Mbind
"
`
hostname
`
/neo/go
/sqlite
(!sha1)"
$zhashok
xneoctl
set
cluster stopping
xneoctl
set
cluster stopping
wait
wait
}
}
...
@@ -1215,15 +1234,27 @@ zbench_cluster() {
...
@@ -1215,15 +1234,27 @@ zbench_cluster() {
xmysql
-e
"SHUTDOWN"
xmysql
-e
"SHUTDOWN"
wait
wait
echo
-e
"
\n
*** NEO/go"
echo
-e
"
\n
*** NEO/go fs"
NEOgo
NEOgofs1
on
$url
./neotest zbench-client neo://
$neocluster
@
$Mbind
"
`
hostname
`
-
$peer
/neo/go"
$zhashok
on
$url
./neotest zbench-client neo://
$neocluster
@
$Mbind
"
`
hostname
`
-
$peer
/neo/go/fs1"
$zhashok
xneoctl
set
cluster stopping
wait
echo
-e
"
\n
*** NEO/go fs1 (sha1 disabled)"
X_NEOGO_SHA1_SKIP
=
y NEOgofs1
on
$url
X_NEOGO_SHA1_SKIP
=
y ./neotest zbench-client
--goonly
neo://
$neocluster
@
$Mbind
"
\\\"
`
hostname
`
-
$peer
/neo/go/fs1(!sha1)
\\\"
"
$zhashok
xneoctl
set
cluster stopping
wait
echo
-e
"
\n
*** NEO/go sqlite"
NEOgolite
on
$url
./neotest zbench-client neo://
$neocluster
@
$Mbind
"
`
hostname
`
-
$peer
/neo/go/sqlite"
$zhashok
xneoctl
set
cluster stopping
xneoctl
set
cluster stopping
wait
wait
echo
-e
"
\n
*** NEO/go (sha1 disabled)"
echo
-e
"
\n
*** NEO/go
sqlite
(sha1 disabled)"
X_NEOGO_SHA1_SKIP
=
y NEOgo
X_NEOGO_SHA1_SKIP
=
y NEOgo
lite
on
$url
X_NEOGO_SHA1_SKIP
=
y ./neotest zbench-client
--goonly
neo://
$neocluster
@
$Mbind
"
\\\"
`
hostname
`
-
$peer
/neo/go(!sha1)
\\\"
"
$zhashok
on
$url
X_NEOGO_SHA1_SKIP
=
y ./neotest zbench-client
--goonly
neo://
$neocluster
@
$Mbind
"
\\\"
`
hostname
`
-
$peer
/neo/go
/sqlite
(!sha1)
\\\"
"
$zhashok
xneoctl
set
cluster stopping
xneoctl
set
cluster stopping
wait
wait
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment