Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
65ff2232
Commit
65ff2232
authored
May 02, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X notes on iteration in NEO
parent
d2c0cef3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
108 deletions
+146
-108
go/NOTES
go/NOTES
+140
-108
go/neo/connection.go
go/neo/connection.go
+6
-0
No files found.
go/NOTES
View file @
65ff2232
Wire proto
On iteration
----------
------------
# 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
All ZODB/NEO iterations can be unified into one scheme:
.value float64 // '\xff' * 8 if None
- 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 []
- tid
type NodeType
- meta (user/description/ext) (+ status ?)
address Address
- []oid changed by this txn
uuid UUID
state NodeState
id_timestamp Float
CellList []
via 1 packet per 1 txn.
uuid UUID
state CellState
RowList []
Objects content is sent via 1 obj packet via 1 object:
offset Number // u32
cell_list CellList
HistoryList []
- tid:oid
serial TID
- data (+ sha1 ?)
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
- 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
Storage related messages
...
@@ -766,3 +679,122 @@ NodeManager
...
@@ -766,3 +679,122 @@ NodeManager
{} uuid -> Node
{} uuid -> Node
{} type -> set<Node>
{} type -> set<Node>
{} state -> 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
go/neo/connection.go
View file @
65ff2232
...
@@ -234,6 +234,9 @@ func (c *Conn) shutdown() {
...
@@ -234,6 +234,9 @@ func (c *Conn) shutdown() {
//
//
// NOTE for Send() - once transmission was started - it will complete in the
// NOTE for Send() - once transmission was started - it will complete in the
// background on the wire not to break node-node link framing.
// 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
{
func
(
c
*
Conn
)
Close
()
error
{
// adjust nodeLink.connTab
// adjust nodeLink.connTab
// (if nodelink was already shut down and connTab=nil - delete will be noop)
// (if nodelink was already shut down and connTab=nil - delete will be noop)
...
@@ -363,6 +366,9 @@ func (nl *NodeLink) serveRecv() {
...
@@ -363,6 +366,9 @@ func (nl *NodeLink) serveRecv() {
}
}
// route packet to serving goroutine handler
// 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
conn
.
rxq
<-
pkt
// keep connMu locked until here: so that ^^^ `conn.rxq <- pkt` can be
// keep connMu locked until here: so that ^^^ `conn.rxq <- pkt` can be
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment