Commit 7f67a252 authored by Kirill Smelkov's avatar Kirill Smelkov

go/neo/proto: Sync GetObject and docstrings with NEO/py

- Rename GetObject .Tid    -> .Before
- Rename GetObject .Serial -> .At
- Sync docstrings

This corresponds to NEO/py commit 9f0f2afe (protocol: update packet
docstrings).
parent 5f13cc85
// Copyright (C) 2016-2018 Nexedi SA and Contributors. // Copyright (C) 2016-2020 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
...@@ -1015,8 +1015,8 @@ func benchmarkLinkRTT(b *testing.B, l1, l2 *NodeLink) { ...@@ -1015,8 +1015,8 @@ func benchmarkLinkRTT(b *testing.B, l1, l2 *NodeLink) {
case *proto.GetObject: case *proto.GetObject:
err = req.Reply(&proto.AnswerObject{ err = req.Reply(&proto.AnswerObject{
Oid: msg.Oid, Oid: msg.Oid,
Serial: msg.Serial, Serial: msg.At,
DataSerial: msg.Tid, DataSerial: msg.Before,
}) })
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
...@@ -1033,15 +1033,15 @@ func benchmarkLinkRTT(b *testing.B, l1, l2 *NodeLink) { ...@@ -1033,15 +1033,15 @@ func benchmarkLinkRTT(b *testing.B, l1, l2 *NodeLink) {
obj := &proto.AnswerObject{} obj := &proto.AnswerObject{}
get.Oid = zodb.Oid(i) get.Oid = zodb.Oid(i)
get.Serial = zodb.Tid(i+1) get.At = zodb.Tid(i+1)
get.Tid = zodb.Tid(i+2) get.Before = zodb.Tid(i+2)
err := l1.Ask1(get, obj) err := l1.Ask1(get, obj)
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
} }
if !(obj.Oid == get.Oid && obj.Serial == get.Serial && obj.DataSerial == get.Tid) { if !(obj.Oid == get.Oid && obj.Serial == get.At && obj.DataSerial == get.Before) {
b.Fatalf("read back: %v ; requested %v", obj, get) b.Fatalf("read back: %v ; requested %v", obj, get)
} }
......
This diff is collapsed.
...@@ -1907,8 +1907,8 @@ func (p *GetObject) NEOMsgEncodedLen() int { ...@@ -1907,8 +1907,8 @@ func (p *GetObject) NEOMsgEncodedLen() int {
func (p *GetObject) NEOMsgEncode(data []byte) { func (p *GetObject) NEOMsgEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[0:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Serial)) binary.BigEndian.PutUint64(data[8:], uint64(p.At))
binary.BigEndian.PutUint64(data[16:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[16:], uint64(p.Before))
} }
func (p *GetObject) NEOMsgDecode(data []byte) (int, error) { func (p *GetObject) NEOMsgDecode(data []byte) (int, error) {
...@@ -1916,8 +1916,8 @@ func (p *GetObject) NEOMsgDecode(data []byte) (int, error) { ...@@ -1916,8 +1916,8 @@ func (p *GetObject) NEOMsgDecode(data []byte) (int, error) {
goto overflow goto overflow
} }
p.Oid = zodb.Oid(binary.BigEndian.Uint64(data[0 : 0+8])) p.Oid = zodb.Oid(binary.BigEndian.Uint64(data[0 : 0+8]))
p.Serial = zodb.Tid(binary.BigEndian.Uint64(data[8 : 8+8])) p.At = zodb.Tid(binary.BigEndian.Uint64(data[8 : 8+8]))
p.Tid = zodb.Tid(binary.BigEndian.Uint64(data[16 : 16+8])) p.Before = zodb.Tid(binary.BigEndian.Uint64(data[16 : 16+8]))
return 24, nil return 24, nil
overflow: overflow:
......
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