Commit 5114dc42 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 771aca2e
...@@ -483,15 +483,6 @@ type AnswerTransactionFinished struct { ...@@ -483,15 +483,6 @@ type AnswerTransactionFinished struct {
Tid zodb.Tid Tid zodb.Tid
} }
/* XXX move vvv
// Notify that a transaction blocking a replication is now finished
// M -> S
type NotifyTransactionFinished struct {
TTID zodb.Tid
MaxTID zodb.Tid
}
*/
// Lock information on a transaction. PM -> S. // Lock information on a transaction. PM -> S.
// Notify information on a transaction locked. S -> PM. // Notify information on a transaction locked. S -> PM.
type LockInformation struct { type LockInformation struct {
...@@ -810,26 +801,6 @@ type AnswerTIDsFrom struct { ...@@ -810,26 +801,6 @@ type AnswerTIDsFrom struct {
} }
/*
// 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
// transaction ends).
// Answer to AskCheckCurrentSerial.
// Same structure as AnswerStoreObject, to handle the same way, except there
// is nothing to invalidate in any client's cache.
type CheckCurrentSerial struct {
Tid zodb.Tid
Oid zodb.Oid
Serial zodb.Tid
}
// XXX answer_store_object ? (was _answer = StoreObject._answer in py)
type AnswerCheckCurrentSerial AnswerStoreObject
//type AnswerCheckCurrentSerial struct {
// Conflict bool
//}
*/
// Request a pack at given TID. // Request a pack at given TID.
// C -> M // C -> M
// M -> S // M -> S
...@@ -918,6 +889,11 @@ type PartitionCorrupted struct { ...@@ -918,6 +889,11 @@ type PartitionCorrupted struct {
CellList []NodeUUID CellList []NodeUUID
} }
// Notify that node is ready to serve requests.
// S -> M
type NotifyReady struct {
}
// Ask last committed TID. // Ask last committed TID.
// C -> M // C -> M
...@@ -930,12 +906,32 @@ type AnswerLastTransaction struct { ...@@ -930,12 +906,32 @@ type AnswerLastTransaction struct {
Tid zodb.Tid Tid zodb.Tid
} }
// 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
// transaction ends).
// Answer to AskCheckCurrentSerial.
// Same structure as AnswerStoreObject, to handle the same way, except there
// is nothing to invalidate in any client's cache.
type CheckCurrentSerial struct {
Tid zodb.Tid
Oid zodb.Oid
Serial zodb.Tid
}
// Notify that node is ready to serve requests. type AnswerCheckCurrentSerial struct {
// S -> M // was _answer = StoreObject._answer in py
type NotifyReady struct { // XXX can we do without embedding e.g. `type AnswerCheckCurrentSerial AnswerStoreObject` ?
AnswerStoreObject
}
// Notify that a transaction blocking a replication is now finished
// M -> S
type NotifyTransactionFinished struct {
TTID zodb.Tid
MaxTID zodb.Tid
} }
// replication // replication
// TODO // TODO
...@@ -49,6 +49,9 @@ noask('ObjectUndoSerial') ...@@ -49,6 +49,9 @@ noask('ObjectUndoSerial')
noask('Pack') noask('Pack')
noask('CheckTIDRange') noask('CheckTIDRange')
noask('CheckSerialRange') noask('CheckSerialRange')
nonotify('PartitionCorrupted')
noask('LastTransaction')
noask('CheckCurrentSerial')
_ = renames _ = renames
_['AskPrimary'] = 'PrimaryMaster' _['AskPrimary'] = 'PrimaryMaster'
......
...@@ -3307,12 +3307,29 @@ overflow: ...@@ -3307,12 +3307,29 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 84. LastTransaction // 84. NotifyReady
func (*LastTransaction) neoMsgCode() uint16 { func (*NotifyReady) neoMsgCode() uint16 {
return 84 return 84
} }
func (p *NotifyReady) neoMsgEncodedLen() int {
return 0
}
func (p *NotifyReady) neoMsgEncode(data []byte) {
}
func (p *NotifyReady) neoMsgDecode(data []byte) (int, error) {
return 0, nil
}
// 85. LastTransaction
func (*LastTransaction) neoMsgCode() uint16 {
return 85
}
func (p *LastTransaction) neoMsgEncodedLen() int { func (p *LastTransaction) neoMsgEncodedLen() int {
return 0 return 0
} }
...@@ -3324,10 +3341,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) { ...@@ -3324,10 +3341,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 85. AnswerLastTransaction // 86. AnswerLastTransaction
func (*AnswerLastTransaction) neoMsgCode() uint16 { func (*AnswerLastTransaction) neoMsgCode() uint16 {
return 85 | answerBit return 86 | answerBit
} }
func (p *AnswerLastTransaction) neoMsgEncodedLen() int { func (p *AnswerLastTransaction) neoMsgEncodedLen() int {
...@@ -3349,21 +3366,85 @@ overflow: ...@@ -3349,21 +3366,85 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 86. NotifyReady // 87. CheckCurrentSerial
func (*NotifyReady) neoMsgCode() uint16 { func (*CheckCurrentSerial) neoMsgCode() uint16 {
return 86 return 87
} }
func (p *NotifyReady) neoMsgEncodedLen() int { func (p *CheckCurrentSerial) neoMsgEncodedLen() int {
return 0 return 24
} }
func (p *NotifyReady) neoMsgEncode(data []byte) { func (p *CheckCurrentSerial) neoMsgEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.Tid))
binary.BigEndian.PutUint64(data[8:], uint64(p.Oid))
binary.BigEndian.PutUint64(data[16:], uint64(p.Serial))
} }
func (p *NotifyReady) neoMsgDecode(data []byte) (int, error) { func (p *CheckCurrentSerial) neoMsgDecode(data []byte) (int, error) {
return 0, nil if uint32(len(data)) < 24 {
goto overflow
}
p.Tid = zodb.Tid(binary.BigEndian.Uint64(data[0:]))
p.Oid = zodb.Oid(binary.BigEndian.Uint64(data[8:]))
p.Serial = zodb.Tid(binary.BigEndian.Uint64(data[16:]))
return 24, nil
overflow:
return 0, ErrDecodeOverflow
}
// 88. AnswerCheckCurrentSerial
func (*AnswerCheckCurrentSerial) neoMsgCode() uint16 {
return 88 | answerBit
}
func (p *AnswerCheckCurrentSerial) neoMsgEncodedLen() int {
return 8
}
func (p *AnswerCheckCurrentSerial) neoMsgEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.AnswerStoreObject.Conflict))
}
func (p *AnswerCheckCurrentSerial) neoMsgDecode(data []byte) (int, error) {
if uint32(len(data)) < 8 {
goto overflow
}
p.AnswerStoreObject.Conflict = zodb.Tid(binary.BigEndian.Uint64(data[0:]))
return 8, nil
overflow:
return 0, ErrDecodeOverflow
}
// 89. NotifyTransactionFinished
func (*NotifyTransactionFinished) neoMsgCode() uint16 {
return 89
}
func (p *NotifyTransactionFinished) neoMsgEncodedLen() int {
return 16
}
func (p *NotifyTransactionFinished) neoMsgEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.TTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.MaxTID))
}
func (p *NotifyTransactionFinished) neoMsgDecode(data []byte) (int, error) {
if uint32(len(data)) < 16 {
goto overflow
}
p.TTID = zodb.Tid(binary.BigEndian.Uint64(data[0:]))
p.MaxTID = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
return 16, nil
overflow:
return 0, ErrDecodeOverflow
} }
// registry of message types // registry of message types
...@@ -3452,7 +3533,10 @@ var msgTypeRegistry = map[uint16]reflect.Type{ ...@@ -3452,7 +3533,10 @@ var msgTypeRegistry = map[uint16]reflect.Type{
81: reflect.TypeOf(CheckSerialRange{}), 81: reflect.TypeOf(CheckSerialRange{}),
82 | answerBit: reflect.TypeOf(AnswerCheckSerialRange{}), 82 | answerBit: reflect.TypeOf(AnswerCheckSerialRange{}),
83: reflect.TypeOf(PartitionCorrupted{}), 83: reflect.TypeOf(PartitionCorrupted{}),
84: reflect.TypeOf(LastTransaction{}), 84: reflect.TypeOf(NotifyReady{}),
85 | answerBit: reflect.TypeOf(AnswerLastTransaction{}), 85: reflect.TypeOf(LastTransaction{}),
86: reflect.TypeOf(NotifyReady{}), 86 | answerBit: reflect.TypeOf(AnswerLastTransaction{}),
87: reflect.TypeOf(CheckCurrentSerial{}),
88 | answerBit: reflect.TypeOf(AnswerCheckCurrentSerial{}),
89: reflect.TypeOf(NotifyTransactionFinished{}),
} }
...@@ -54,10 +54,10 @@ var pyMsgRegistry = map[uint16]string{ ...@@ -54,10 +54,10 @@ var pyMsgRegistry = map[uint16]string{
78: "CheckPartition", 78: "CheckPartition",
79: "CheckTIDRange", 79: "CheckTIDRange",
81: "CheckSerialRange", 81: "CheckSerialRange",
83: "NotifyPartitionCorrupted", 83: "PartitionCorrupted",
84: "NotifyReady", 84: "NotifyReady",
85: "AskLastTransaction", 85: "LastTransaction",
87: "AskCheckCurrentSerial", 87: "CheckCurrentSerial",
89: "NotifyTransactionFinished", 89: "NotifyTransactionFinished",
90: "Replicate", 90: "Replicate",
91: "NotifyReplicationDone", 91: "NotifyReplicationDone",
......
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