Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
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
Hide 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 }) {
exc
.
Raiseif
(
err
)
}
// xfs1stor creates new NEO storage node backed by fs1
// XXX is this wrapper a good idea?
func
xfs1stor
(
net
Network
,
path
string
)
(
*
server
.
Storage
,
*
fs1
.
FileStorage
)
{
// TODO +readonly ?
func
xfs1stor
(
path
string
)
*
fs1
.
FileStorage
{
zstor
,
err
:=
fs1
.
Open
(
context
.
Background
(),
path
)
exc
.
Raiseif
(
err
)
return
server
.
NewStorage
(
"test cluster"
,
"TODO master"
,
""
,
net
,
zstor
),
zstor
return
zstor
}
// M drives cluster with 1 S through recovery -> verification -> service -> shutdown
func
TestMasterStorage
(
t
*
testing
.
T
)
{
// XXX temp disabled
return
net
:=
NetPipe
(
""
)
// test network
Maddr
:=
"0"
Saddr
:=
"1"
net
:=
NetPipe
(
""
)
// test network FIXME New registers to global table
M
:=
server
.
NewMaster
(
"abc1"
)
S
,
_
:=
xfs1stor
(
net
,
"../zodb/storage/fs1/testdata/1.fs"
)
// XXX +readonly
M
:=
server
.
NewMaster
(
"abc1"
,
Maddr
,
net
)
zstor
:=
xfs1stor
(
"../zodb/storage/fs1/testdata/1.fs"
)
S
:=
server
.
NewStorage
(
"abc1"
,
Maddr
,
Saddr
,
net
,
zstor
)
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
// XXX temp
Sbind
:=
""
;
Mbind
:=
""
;
var
err
error
_
=
Scancel
;
_
=
Mcancel
;
_
=
err
_
=
Scancel
;
_
=
Mcancel
;
err
=
server
.
ListenAndServe
(
Mctx
,
net
,
Mbind
,
M
)
// XXX go
err
=
server
.
ListenAndServe
(
Sctx
,
net
,
Sbind
,
S
)
// XXX go
err
:=
M
.
Run
(
Mctx
)
// XXX go
err
=
S
.
Run
(
Sctx
)
// XXX go
// XXX temp
if
err
!=
nil
{
panic
(
err
)
}
}
// basic interaction between Client -- Storage
...
...
@@ -82,7 +84,8 @@ func TestClientStorage(t *testing.T) {
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
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
()
{
S
.
ServeLink
(
Sctx
,
Snl
)
// XXX + test error return
...
...
go/neo/server/storage.go
View file @
0e4fc602
...
...
@@ -46,7 +46,7 @@ type Storage struct {
// 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.
// 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
addr
,
err
:=
neo
.
AddrString
(
net
.
Network
(),
serveAddr
)
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