Commit 65ff2232 authored by Kirill Smelkov's avatar Kirill Smelkov

X notes on iteration in NEO

parent d2c0cef3
Wire proto
----------
# all in network byte-order
PktHeader
.id u32 // autoincrement on ask (?)
.code u16 // defined by seqno if register(...) call in Packets
.length u32 // whole pkt length
# response_code = 0x8000 | code
List
.len u32
[len]items
Dict
.len u32
[len] key, value
Enum
.value s32 // None -> -1
String
.len u32
[len] strdata
Address
.host String
.port u16 // present only if .host != ''
Bool
.value u8
Number
.value u32
Index
.value u64
PTID
.value u64 // 0 <-> None
Protocol
Number // encode <- version, decode -> check version
Checksum
.checksum [20]u8
UUID
.uuid s32 // 0 <-> None
TID
.tid [8]byte // None <-> \xff*8
POID = PTID
On iteration
------------
Float
.value float64 // '\xff' * 8 if None
All ZODB/NEO iterations can be unified into one scheme:
- iterator(): tid↑ flags = objects intermixed
- history(oid): tid↓ flags = filter by oid (on server)
- undoLog: tid↓ flags = no objects content needed;
which tid is undoable is computed on _client_
- replication: tid↑ flags = objects intermixed
~~~~~~~~
each iteration yields all information about txn:
NodeList []
type NodeType
address Address
uuid UUID
state NodeState
id_timestamp Float
- tid
- meta (user/description/ext) (+ status ?)
- []oid changed by this txn
CellList []
uuid UUID
state CellState
via 1 packet per 1 txn.
RowList []
offset Number // u32
cell_list CellList
Objects content is sent via 1 obj packet via 1 object:
HistoryList []
serial TID
size Number // u32
UUIDList []
uuid UUID
- tid:oid
- data (+ sha1 ?)
TidList []
tid TID
OidList []
oid OID
~~~~~~~~
Notify
.message String
Error
.code Number
.message String
Ping
ø
_answer = PFEmpty
CloseClient
ø
RequestIdentification
.protocol_version PProtocol
.node_type NodeType
.uuid UUID
.address Address
.name String
.id_timestamp Float
TODO
~~~
- iterator() - not used at all in Zope/ERP5
- history(oid) - used in "ZODB history" tab & like
- undoLog - (zope/src/App/Undo.py)
- replication - internal to NEO
Storage related messages
......@@ -766,3 +679,122 @@ NodeManager
{} uuid -> Node
{} type -> set<Node>
{} state -> set<Node>
Wire proto
----------
# all in network byte-order
PktHeader
.id u32 // autoincrement on ask (?)
.code u16 // defined by seqno if register(...) call in Packets
.length u32 // whole pkt length
# response_code = 0x8000 | code
List
.len u32
[len]items
Dict
.len u32
[len] key, value
Enum
.value s32 // None -> -1
String
.len u32
[len] strdata
Address
.host String
.port u16 // present only if .host != ''
Bool
.value u8
Number
.value u32
Index
.value u64
PTID
.value u64 // 0 <-> None
Protocol
Number // encode <- version, decode -> check version
Checksum
.checksum [20]u8
UUID
.uuid s32 // 0 <-> None
TID
.tid [8]byte // None <-> \xff*8
POID = PTID
Float
.value float64 // '\xff' * 8 if None
~~~~~~~~
NodeList []
type NodeType
address Address
uuid UUID
state NodeState
id_timestamp Float
CellList []
uuid UUID
state CellState
RowList []
offset Number // u32
cell_list CellList
HistoryList []
serial TID
size Number // u32
UUIDList []
uuid UUID
TidList []
tid TID
OidList []
oid OID
~~~~~~~~
Notify
.message String
Error
.code Number
.message String
Ping
ø
_answer = PFEmpty
CloseClient
ø
RequestIdentification
.protocol_version PProtocol
.node_type NodeType
.uuid UUID
.address Address
.name String
.id_timestamp Float
TODO
......@@ -234,6 +234,9 @@ func (c *Conn) shutdown() {
//
// NOTE for Send() - once transmission was started - it will complete in the
// background on the wire not to break node-node link framing.
//
// TODO Close on one end must make Recv/Send on another end fail
// (UC: sending []txn-info)
func (c *Conn) Close() error {
// adjust nodeLink.connTab
// (if nodelink was already shut down and connTab=nil - delete will be noop)
......@@ -363,6 +366,9 @@ func (nl *NodeLink) serveRecv() {
}
// route packet to serving goroutine handler
//
// TODO backpressure when Recv is not keeping up with Send on peer side?
// (not to let whole nodelink starve because of one connection)
conn.rxq <- pkt
// keep connMu locked until here: so that ^^^ `conn.rxq <- pkt` can be
......
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