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
0e4fc602
Commit
0e4fc602
authored
Jun 09, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
08a54443
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
go/neo/cluster_test.go
go/neo/cluster_test.go
+20
-17
go/neo/server/storage.go
go/neo/server/storage.go
+1
-1
No files found.
go/neo/cluster_test.go
View file @
0e4fc602
...
@@ -41,34 +41,36 @@ func xwait(w interface { Wait() error }) {
...
@@ -41,34 +41,36 @@ func xwait(w interface { Wait() error }) {
exc
.
Raiseif
(
err
)
exc
.
Raiseif
(
err
)
}
}
// xfs1stor creates new NEO storage node backed by fs1
func
xfs1stor
(
path
string
)
*
fs1
.
FileStorage
{
// XXX is this wrapper a good idea?
func
xfs1stor
(
net
Network
,
path
string
)
(
*
server
.
Storage
,
*
fs1
.
FileStorage
)
{
// TODO +readonly ?
zstor
,
err
:=
fs1
.
Open
(
context
.
Background
(),
path
)
zstor
,
err
:=
fs1
.
Open
(
context
.
Background
(),
path
)
exc
.
Raiseif
(
err
)
exc
.
Raiseif
(
err
)
return
zstor
return
server
.
NewStorage
(
"test cluster"
,
"TODO master"
,
""
,
net
,
zstor
),
zstor
}
}
// M drives cluster with 1 S through recovery -> verification -> service -> shutdown
// M drives cluster with 1 S through recovery -> verification -> service -> shutdown
func
TestMasterStorage
(
t
*
testing
.
T
)
{
func
TestMasterStorage
(
t
*
testing
.
T
)
{
// XXX temp disabled
net
:=
NetPipe
(
""
)
// test network
return
Maddr
:=
"0"
Saddr
:=
"1"
net
:=
NetPipe
(
""
)
// test network FIXME New registers to global table
M
:=
server
.
NewMaster
(
"abc1"
,
Maddr
,
net
)
M
:=
server
.
NewMaster
(
"abc1"
)
S
,
_
:=
xfs1stor
(
net
,
"../zodb/storage/fs1/testdata/1.fs"
)
// XXX +readonly
zstor
:=
xfs1stor
(
"../zodb/storage/fs1/testdata/1.fs"
)
S
:=
server
.
NewStorage
(
"abc1"
,
Maddr
,
Saddr
,
net
,
zstor
)
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
// XXX temp
_
=
Scancel
;
_
=
Mcancel
;
Sbind
:=
""
;
Mbind
:=
""
;
var
err
error
_
=
Scancel
;
_
=
Mcancel
;
_
=
err
err
=
server
.
ListenAndServe
(
Mctx
,
net
,
Mbind
,
M
)
// XXX go
err
:=
M
.
Run
(
Mctx
)
// XXX go
err
=
server
.
ListenAndServe
(
Sctx
,
net
,
Sbind
,
S
)
// XXX go
err
=
S
.
Run
(
Sctx
)
// XXX go
// XXX temp
if
err
!=
nil
{
panic
(
err
)
}
}
}
// basic interaction between Client -- Storage
// basic interaction between Client -- Storage
...
@@ -82,7 +84,8 @@ func TestClientStorage(t *testing.T) {
...
@@ -82,7 +84,8 @@ func TestClientStorage(t *testing.T) {
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
net
:=
NetPipe
(
""
)
// XXX here? (or a bit above?)
net
:=
NetPipe
(
""
)
// XXX here? (or a bit above?)
S
,
zstor
:=
xfs1stor
(
net
,
"../zodb/storage/fs1/testdata/1.fs"
)
// XXX +readonly
zstor
:=
xfs1stor
(
"../zodb/storage/fs1/testdata/1.fs"
)
// XXX +readonly
S
:=
server
.
NewStorage
(
"cluster"
,
"Maddr"
,
"Saddr"
,
net
,
zstor
)
wg
.
Gox
(
func
()
{
wg
.
Gox
(
func
()
{
S
.
ServeLink
(
Sctx
,
Snl
)
S
.
ServeLink
(
Sctx
,
Snl
)
// XXX + test error return
// XXX + test error return
...
...
go/neo/server/storage.go
View file @
0e4fc602
...
@@ -46,7 +46,7 @@ type Storage struct {
...
@@ -46,7 +46,7 @@ type Storage struct {
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr
// NewStorage creates new storage node that will listen on serveAddr and talk to master on masterAddr
// The storage uses zstor as underlying backend for storing data.
// The storage uses zstor as underlying backend for storing data.
// To actually start running the node - call Run. XXX text
// To actually start running the node - call Run. XXX text
func
NewStorage
(
cluster
string
,
masterAddr
string
,
serveAddr
string
,
net
neo
.
Network
,
zstor
zodb
.
IStorage
)
*
Storage
{
func
NewStorage
(
cluster
,
masterAddr
,
serveAddr
string
,
net
neo
.
Network
,
zstor
zodb
.
IStorage
)
*
Storage
{
// convert serveAddr into neo format
// convert serveAddr into neo format
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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