Commit cd63c735 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 82e11a32
// Copyright (C) 2006-2017 Nexedi SA and Contributors.
//
// 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 Free Software licenses or 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.
// See https://www.nexedi.com/licensing for rationale and options.
//go:generate sh -c "go run protogen.go >zproto-marshal.go" //go:generate sh -c "go run protogen.go >zproto-marshal.go"
package neo package neo
// protocol definition // protocol definition
// This file defines everything that relates to messages on the wire.
// In particular every type that is included in a message is defined here as well.
// XXX neo:proto justtype
// XXX neo:proto answerto x? (btw just needs "answer" flag)
// TODO regroup messages definitions to stay more close to 1 communication topic // TODO regroup messages definitions to stay more close to 1 communication topic
// TODO document protocol itself better (who sends who what with which semantic) // TODO document protocol itself better (who sends who what with which semantic)
......
...@@ -549,98 +549,3 @@ func TestMasterStorage(t *testing.T) { ...@@ -549,98 +549,3 @@ func TestMasterStorage(t *testing.T) {
Scancel() // ---- // ---- Scancel() // ---- // ----
xwait(gwg) xwait(gwg)
} }
// basic interaction between Client -- Storage
func _TestClientStorage(t *testing.T) {
// XXX temp disabled
return
/*
Cnl, Snl := NodeLinkPipe()
wg := &xsync.WorkGroup{}
Sctx, Scancel := context.WithCancel(bg)
net := pipenet.New("") // XXX here? (or a bit above?)
zstor := xfs1stor("../../zodb/storage/fs1/testdata/1.fs") // XXX +readonly
S := NewStorage("cluster", "Maddr", "Saddr", net, zstor)
wg.Gox(func() {
S.ServeLink(Sctx, Snl)
// XXX + test error return
})
C, err := client.NewClient(Cnl)
if err != nil {
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 == 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 {
_, dataIter, err := ziter.NextTxn()
if err == io.EOF {
break
}
if err != nil {
t.Fatalf("ziter.NextTxn: %v", err)
}
for {
datai, err := dataIter.NextData()
if err == io.EOF {
break
}
if err != nil {
t.Fatalf("ziter.NextData: %v", err)
}
for _, tidBefore := range []bool{false, true} {
xid := zodb.Xid{Oid: datai.Oid} // {=,<}tid:oid
xid.Tid = datai.Tid
xid.TidBefore = tidBefore
if tidBefore {
xid.Tid++
}
data, tid, err := C.Load(xid)
if datai.Data != nil {
if !(bytes.Equal(data, datai.Data) && tid == datai.Tid && err == nil) {
t.Fatalf("load: %v:\nhave: %v %v %q\nwant: %v nil %q",
xid, tid, err, data, datai.Tid, datai.Data)
}
} else {
// deleted
errWant := &zodb.ErrXidMissing{xid}
if !(data == nil && tid == 0 && reflect.DeepEqual(err, errWant)) {
t.Fatalf("load: %v:\nhave: %v, %#v, %#v\nwant: %v, %#v, %#v",
xid, tid, err, data, zodb.Tid(0), errWant, []byte(nil))
}
}
}
}
}
// TODO Iterate (not yet implemented for NEO)
// shutdown storage
// XXX wait for S to shutdown + verify shutdown error
Scancel()
xwait(wg)
*/
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment