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
cb2ce72c
Commit
cb2ce72c
authored
May 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
abed4adb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
3 deletions
+91
-3
go/neo/cluster_test.go
go/neo/cluster_test.go
+54
-3
go/zodb/storage/mem/memstorage.go
go/zodb/storage/mem/memstorage.go
+36
-0
go/zodb/wks/wks.go
go/zodb/wks/wks.go
+1
-0
No files found.
go/neo/cluster_test.go
View file @
cb2ce72c
...
...
@@ -21,6 +21,9 @@ package neo
import
(
"context"
"testing"
"../zodb"
"../zodb/storage/fs1"
)
// basic interaction between Client -- Storage
...
...
@@ -30,7 +33,13 @@ func TestClientStorage(t *testing.T) {
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
S
:=
NewStorage
(
nil
)
// TODO zodb.storage.mem
// TODO +readonly ?
zstor
,
err
:=
fs1
.
Open
(
context
.
Background
(),
"../zodb/storage/fs1/testdata/1.fs"
)
if
err
!=
nil
{
t
.
Fatalf
(
"zstor: %v"
,
err
)
// XXX err ctx ?
}
S
:=
NewStorage
(
zstor
)
wg
.
Gox
(
func
()
{
S
.
ServeLink
(
Sctx
,
Snl
)
// XXX + test error return
...
...
@@ -41,9 +50,51 @@ func TestClientStorage(t *testing.T) {
t
.
Fatalf
(
"creating/identifying client: %v"
,
err
)
}
// verify LastTid
lastTidOk
,
err
:=
zstor
.
LastTid
()
if
err
!=
nil
{
t
.
Fatalf
(
"zstor: lastTid: %v"
,
err
)
}
lastTid
,
err
:=
C
.
LastTid
()
if
!
(
lastTid
==
111
&&
err
==
nil
)
{
// XXX 111
t
.
Fatalf
(
"C.LastTid -> %v, %v ; want %v, nil"
,
lastTid
,
err
,
111
,
err
)
if
!
(
lastTid
==
lastTidOk
&&
err
==
nil
)
{
t
.
Fatalf
(
"C.LastTid -> %v, %v ; want %v, nil"
,
lastTid
,
err
,
lastTidOk
)
}
// verify Load for all {<,=}serial:oid
ziter
:=
zstor
.
Iterate
(
zodb
.
Tid
(
0
),
zodb
.
TidMax
)
for
{
txni
,
dataIter
,
err
:=
ziter
.
NextTxn
()
if
err
==
io
.
EOF
{
break
}
if
err
!=
nil
{
t
.
Fatalf
(
"ziter.NextTxn: %v"
,
err
)
}
txni
.
Tid
for
{
datai
,
err
:=
dataIter
.
NextData
()
if
err
==
io
.
EOF
{
break
}
if
err
!=
nil
{
t
.
Fatalf
(
"ziter.NextData: %v"
,
err
)
}
datai
.
Oid
datai
.
Tid
.
Data
.
DataTid
// XXX .Data = nil means deleted
zodb
.
Xid
{
zodb
.
XTid
{
datai
.
Tid
,
false
},
datai
.
Oid
}
// =tid:oid
// TODO check Load
}
}
// shutdown storage
...
...
go/zodb/storage/mem/memstorage.go
0 → 100644
View file @
cb2ce72c
// Copyright (C) 2017 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Open Source Initiative approved licenses and Convey
// the resulting work. Corresponding source of such a combination shall include
// the source code for all other software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
//
// XXX partly based on code from ZODB ?
// Package mem implements in-memory ZODB storage
package
mem
// XXX not yet really needed
/*
import (
"../../../zodb"
)
// Storage is a ZODB storage which stores data in RAM.
type Storage struct {
}
var _ zodb.IStorage = (*Storage)(nil)
*/
go/zodb/wks/wks.go
View file @
cb2ce72c
...
...
@@ -25,6 +25,7 @@
package
wks
import
(
_
"../../zodb/storage/mem"
_
"../../zodb/storage/fs1"
_
"../../neo"
// XXX split into neo/client ?
)
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