Commit 771aca2e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 97e2f8df
...@@ -638,23 +638,6 @@ type AnswerTIDs struct { ...@@ -638,23 +638,6 @@ type AnswerTIDs struct {
TIDList []zodb.Tid TIDList []zodb.Tid
} }
/*
// Ask for length TIDs starting at min_tid. The order of TIDs is ascending.
// C -> S.
// Answer the requested TIDs. S -> C
type TIDListFrom struct {
MinTID zodb.Tid
MaxTID zodb.Tid
Length uint32 // PNumber
Partition uint32 // PNumber
}
// XXX answer_tids ?
type AnswerTIDListFrom struct {
TidList []zodb.Tid
}
*/
// Ask information about a transaction. Any -> S. // Ask information about a transaction. Any -> S.
// Answer information (user, description) about a transaction. S -> Any. // Answer information (user, description) about a transaction. S -> Any.
type TransactionInformation struct { type TransactionInformation struct {
...@@ -804,7 +787,6 @@ type ObjectUndoSerial struct { ...@@ -804,7 +787,6 @@ type ObjectUndoSerial struct {
OidList []zodb.Oid OidList []zodb.Oid
} }
// XXX answer_undo_transaction ?
type AnswerObjectUndoSerial struct { type AnswerObjectUndoSerial struct {
ObjectTIDDict map[zodb.Oid]struct { ObjectTIDDict map[zodb.Oid]struct {
CurrentSerial zodb.Tid CurrentSerial zodb.Tid
...@@ -813,7 +795,22 @@ type AnswerObjectUndoSerial struct { ...@@ -813,7 +795,22 @@ type AnswerObjectUndoSerial struct {
} }
} }
// Ask for length TIDs starting at min_tid. The order of TIDs is ascending.
// C -> S.
// Answer the requested TIDs. S -> C
type AskTIDsFrom struct {
MinTID zodb.Tid
MaxTID zodb.Tid
Length uint32 // PNumber
Partition uint32 // PNumber
}
type AnswerTIDsFrom struct {
TidList []zodb.Tid
}
/*
// Verifies if given serial is current for object oid in the database, and // Verifies if given serial is current for object oid in the database, and
// take a write lock on it (so that this state is not altered until // take a write lock on it (so that this state is not altered until
// transaction ends). // transaction ends).
...@@ -831,6 +828,7 @@ type AnswerCheckCurrentSerial AnswerStoreObject ...@@ -831,6 +828,7 @@ type AnswerCheckCurrentSerial AnswerStoreObject
//type AnswerCheckCurrentSerial struct { //type AnswerCheckCurrentSerial struct {
// Conflict bool // Conflict bool
//} //}
*/
// Request a pack at given TID. // Request a pack at given TID.
// C -> M // C -> M
......
...@@ -45,6 +45,10 @@ noask('TransactionInformation') ...@@ -45,6 +45,10 @@ noask('TransactionInformation')
noask('ObjectHistory') noask('ObjectHistory')
noask('PartitionList') noask('PartitionList')
noask('NodeList') noask('NodeList')
noask('ObjectUndoSerial')
noask('Pack')
noask('CheckTIDRange')
noask('CheckSerialRange')
_ = renames _ = renames
_['AskPrimary'] = 'PrimaryMaster' _['AskPrimary'] = 'PrimaryMaster'
......
...@@ -2878,39 +2878,89 @@ overflow: ...@@ -2878,39 +2878,89 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 73. CheckCurrentSerial // 73. AskTIDsFrom
func (*CheckCurrentSerial) neoMsgCode() uint16 { func (*AskTIDsFrom) neoMsgCode() uint16 {
return 73 return 73
} }
func (p *CheckCurrentSerial) neoMsgEncodedLen() int { func (p *AskTIDsFrom) neoMsgEncodedLen() int {
return 24 return 24
} }
func (p *CheckCurrentSerial) neoMsgEncode(data []byte) { func (p *AskTIDsFrom) neoMsgEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid)) binary.BigEndian.PutUint64(data[0:], uint64(p.MinTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.Oid)) binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
binary.BigEndian.PutUint64(data[16:], uint64(p.Serial)) binary.BigEndian.PutUint32(data[16:], p.Length)
binary.BigEndian.PutUint32(data[20:], p.Partition)
} }
func (p *CheckCurrentSerial) neoMsgDecode(data []byte) (int, error) { func (p *AskTIDsFrom) neoMsgDecode(data []byte) (int, error) {
if uint32(len(data)) < 24 { if uint32(len(data)) < 24 {
goto overflow goto overflow
} }
p.Tid = zodb.Tid(binary.BigEndian.Uint64(data[0:])) p.MinTID = zodb.Tid(binary.BigEndian.Uint64(data[0:]))
p.Oid = zodb.Oid(binary.BigEndian.Uint64(data[8:])) p.MaxTID = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
p.Serial = zodb.Tid(binary.BigEndian.Uint64(data[16:])) p.Length = binary.BigEndian.Uint32(data[16:])
p.Partition = binary.BigEndian.Uint32(data[20:])
return 24, nil return 24, nil
overflow: overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 74. Pack // 74. AnswerTIDsFrom
func (*AnswerTIDsFrom) neoMsgCode() uint16 {
return 74 | answerBit
}
func (p *AnswerTIDsFrom) neoMsgEncodedLen() int {
return 4 + len(p.TidList)*8
}
func (p *AnswerTIDsFrom) neoMsgEncode(data []byte) {
{
l := uint32(len(p.TidList))
binary.BigEndian.PutUint32(data[0:], l)
data = data[4:]
for i := 0; uint32(i) < l; i++ {
a := &p.TidList[i]
binary.BigEndian.PutUint64(data[0:], uint64((*a)))
data = data[8:]
}
}
}
func (p *AnswerTIDsFrom) neoMsgDecode(data []byte) (int, error) {
var nread uint32
if uint32(len(data)) < 4 {
goto overflow
}
{
l := binary.BigEndian.Uint32(data[0:])
data = data[4:]
if uint32(len(data)) < l*8 {
goto overflow
}
nread += l * 8
p.TidList = make([]zodb.Tid, l)
for i := 0; uint32(i) < l; i++ {
a := &p.TidList[i]
(*a) = zodb.Tid(binary.BigEndian.Uint64(data[0:]))
data = data[8:]
}
}
return 4 + int(nread), nil
overflow:
return 0, ErrDecodeOverflow
}
// 75. Pack
func (*Pack) neoMsgCode() uint16 { func (*Pack) neoMsgCode() uint16 {
return 74 return 75
} }
func (p *Pack) neoMsgEncodedLen() int { func (p *Pack) neoMsgEncodedLen() int {
...@@ -2932,10 +2982,10 @@ overflow: ...@@ -2932,10 +2982,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 75. AnswerPack // 76. AnswerPack
func (*AnswerPack) neoMsgCode() uint16 { func (*AnswerPack) neoMsgCode() uint16 {
return 75 | answerBit return 76 | answerBit
} }
func (p *AnswerPack) neoMsgEncodedLen() int { func (p *AnswerPack) neoMsgEncodedLen() int {
...@@ -2957,10 +3007,10 @@ overflow: ...@@ -2957,10 +3007,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 76. CheckReplicas // 77. CheckReplicas
func (*CheckReplicas) neoMsgCode() uint16 { func (*CheckReplicas) neoMsgCode() uint16 {
return 76 return 77
} }
func (p *CheckReplicas) neoMsgEncodedLen() int { func (p *CheckReplicas) neoMsgEncodedLen() int {
...@@ -3015,10 +3065,10 @@ overflow: ...@@ -3015,10 +3065,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 77. CheckPartition // 78. CheckPartition
func (*CheckPartition) neoMsgCode() uint16 { func (*CheckPartition) neoMsgCode() uint16 {
return 77 return 78
} }
func (p *CheckPartition) neoMsgEncodedLen() int { func (p *CheckPartition) neoMsgEncodedLen() int {
...@@ -3081,10 +3131,10 @@ overflow: ...@@ -3081,10 +3131,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 78. CheckTIDRange // 79. CheckTIDRange
func (*CheckTIDRange) neoMsgCode() uint16 { func (*CheckTIDRange) neoMsgCode() uint16 {
return 78 return 79
} }
func (p *CheckTIDRange) neoMsgEncodedLen() int { func (p *CheckTIDRange) neoMsgEncodedLen() int {
...@@ -3112,10 +3162,10 @@ overflow: ...@@ -3112,10 +3162,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 79. AnswerCheckTIDRange // 80. AnswerCheckTIDRange
func (*AnswerCheckTIDRange) neoMsgCode() uint16 { func (*AnswerCheckTIDRange) neoMsgCode() uint16 {
return 79 | answerBit return 80 | answerBit
} }
func (p *AnswerCheckTIDRange) neoMsgEncodedLen() int { func (p *AnswerCheckTIDRange) neoMsgEncodedLen() int {
...@@ -3141,10 +3191,10 @@ overflow: ...@@ -3141,10 +3191,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 80. CheckSerialRange // 81. CheckSerialRange
func (*CheckSerialRange) neoMsgCode() uint16 { func (*CheckSerialRange) neoMsgCode() uint16 {
return 80 return 81
} }
func (p *CheckSerialRange) neoMsgEncodedLen() int { func (p *CheckSerialRange) neoMsgEncodedLen() int {
...@@ -3174,10 +3224,10 @@ overflow: ...@@ -3174,10 +3224,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 81. AnswerCheckSerialRange // 82. AnswerCheckSerialRange
func (*AnswerCheckSerialRange) neoMsgCode() uint16 { func (*AnswerCheckSerialRange) neoMsgCode() uint16 {
return 81 | answerBit return 82 | answerBit
} }
func (p *AnswerCheckSerialRange) neoMsgEncodedLen() int { func (p *AnswerCheckSerialRange) neoMsgEncodedLen() int {
...@@ -3207,10 +3257,10 @@ overflow: ...@@ -3207,10 +3257,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 82. PartitionCorrupted // 83. PartitionCorrupted
func (*PartitionCorrupted) neoMsgCode() uint16 { func (*PartitionCorrupted) neoMsgCode() uint16 {
return 82 return 83
} }
func (p *PartitionCorrupted) neoMsgEncodedLen() int { func (p *PartitionCorrupted) neoMsgEncodedLen() int {
...@@ -3257,10 +3307,10 @@ overflow: ...@@ -3257,10 +3307,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 83. LastTransaction // 84. LastTransaction
func (*LastTransaction) neoMsgCode() uint16 { func (*LastTransaction) neoMsgCode() uint16 {
return 83 return 84
} }
func (p *LastTransaction) neoMsgEncodedLen() int { func (p *LastTransaction) neoMsgEncodedLen() int {
...@@ -3274,10 +3324,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) { ...@@ -3274,10 +3324,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 84. AnswerLastTransaction // 85. AnswerLastTransaction
func (*AnswerLastTransaction) neoMsgCode() uint16 { func (*AnswerLastTransaction) neoMsgCode() uint16 {
return 84 | answerBit return 85 | answerBit
} }
func (p *AnswerLastTransaction) neoMsgEncodedLen() int { func (p *AnswerLastTransaction) neoMsgEncodedLen() int {
...@@ -3299,10 +3349,10 @@ overflow: ...@@ -3299,10 +3349,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 85. NotifyReady // 86. NotifyReady
func (*NotifyReady) neoMsgCode() uint16 { func (*NotifyReady) neoMsgCode() uint16 {
return 85 return 86
} }
func (p *NotifyReady) neoMsgEncodedLen() int { func (p *NotifyReady) neoMsgEncodedLen() int {
...@@ -3391,17 +3441,18 @@ var msgTypeRegistry = map[uint16]reflect.Type{ ...@@ -3391,17 +3441,18 @@ var msgTypeRegistry = map[uint16]reflect.Type{
70 | answerBit: reflect.TypeOf(AnswerClusterState{}), 70 | answerBit: reflect.TypeOf(AnswerClusterState{}),
71: reflect.TypeOf(ObjectUndoSerial{}), 71: reflect.TypeOf(ObjectUndoSerial{}),
72 | answerBit: reflect.TypeOf(AnswerObjectUndoSerial{}), 72 | answerBit: reflect.TypeOf(AnswerObjectUndoSerial{}),
73: reflect.TypeOf(CheckCurrentSerial{}), 73: reflect.TypeOf(AskTIDsFrom{}),
74: reflect.TypeOf(Pack{}), 74 | answerBit: reflect.TypeOf(AnswerTIDsFrom{}),
75 | answerBit: reflect.TypeOf(AnswerPack{}), 75: reflect.TypeOf(Pack{}),
76: reflect.TypeOf(CheckReplicas{}), 76 | answerBit: reflect.TypeOf(AnswerPack{}),
77: reflect.TypeOf(CheckPartition{}), 77: reflect.TypeOf(CheckReplicas{}),
78: reflect.TypeOf(CheckTIDRange{}), 78: reflect.TypeOf(CheckPartition{}),
79 | answerBit: reflect.TypeOf(AnswerCheckTIDRange{}), 79: reflect.TypeOf(CheckTIDRange{}),
80: reflect.TypeOf(CheckSerialRange{}), 80 | answerBit: reflect.TypeOf(AnswerCheckTIDRange{}),
81 | answerBit: reflect.TypeOf(AnswerCheckSerialRange{}), 81: reflect.TypeOf(CheckSerialRange{}),
82: reflect.TypeOf(PartitionCorrupted{}), 82 | answerBit: reflect.TypeOf(AnswerCheckSerialRange{}),
83: reflect.TypeOf(LastTransaction{}), 83: reflect.TypeOf(PartitionCorrupted{}),
84 | answerBit: reflect.TypeOf(AnswerLastTransaction{}), 84: reflect.TypeOf(LastTransaction{}),
85: reflect.TypeOf(NotifyReady{}), 85 | answerBit: reflect.TypeOf(AnswerLastTransaction{}),
86: reflect.TypeOf(NotifyReady{}),
} }
...@@ -47,13 +47,13 @@ var pyMsgRegistry = map[uint16]string{ ...@@ -47,13 +47,13 @@ var pyMsgRegistry = map[uint16]string{
67: "RepairOne", 67: "RepairOne",
68: "NotifyClusterState", 68: "NotifyClusterState",
69: "AskClusterState", 69: "AskClusterState",
71: "AskObjectUndoSerial", 71: "ObjectUndoSerial",
73: "AskTIDsFrom", 73: "AskTIDsFrom",
75: "AskPack", 75: "Pack",
77: "CheckReplicas", 77: "CheckReplicas",
78: "CheckPartition", 78: "CheckPartition",
79: "AskCheckTIDRange", 79: "CheckTIDRange",
81: "AskCheckSerialRange", 81: "CheckSerialRange",
83: "NotifyPartitionCorrupted", 83: "NotifyPartitionCorrupted",
84: "NotifyReady", 84: "NotifyReady",
85: "AskLastTransaction", 85: "AskLastTransaction",
......
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