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
547a6fa9
Commit
547a6fa9
authored
Jul 17, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bca096a5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
130 additions
and
153 deletions
+130
-153
go/neo/connection.go
go/neo/connection.go
+4
-6
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+92
-92
go/neo/protogen.go
go/neo/protogen.go
+1
-1
go/neo/server/cluster_test.go
go/neo/server/cluster_test.go
+18
-10
go/neo/ztrace.go
go/neo/ztrace.go
+12
-38
go/neo/ztrace.s
go/neo/ztrace.s
+0
-2
go/xcommon/xtesting/xtesting.go
go/xcommon/xtesting/xtesting.go
+3
-4
No files found.
go/neo/connection.go
View file @
547a6fa9
...
...
@@ -736,11 +736,9 @@ func (c *Conn) err(op string, e error) error {
// ---- exchange of messages ----
//trace:event traceConnRecv(c *Conn /*aaa*/, msg Msg)
//trace:event traceConnSend(c *Conn, msg Msg) // XXX -> traceConnSendPre ?
//XXX temp
//trace:import "lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
//trace:event traceConnRecv(c *Conn, msg Msg)
//trace:event traceConnSendPre(c *Conn, msg Msg)
// XXX do we also need traceConnSend?
// Recv receives message
// it receives packet and decodes message from it
...
...
@@ -775,7 +773,7 @@ func (c *Conn) Recv() (Msg, error) {
// Send sends message
// it encodes message into packet and sends it
func
(
c
*
Conn
)
Send
(
msg
Msg
)
error
{
traceConnSend
(
c
,
msg
)
traceConnSend
Pre
(
c
,
msg
)
l
:=
msg
.
NEOMsgEncodedLen
()
buf
:=
PktBuf
{
make
([]
byte
,
PktHeadLen
+
l
)}
// TODO -> freelist
...
...
go/neo/proto-marshal.go
View file @
547a6fa9
This diff is collapsed.
Click to expand it.
go/neo/protogen.go
View file @
547a6fa9
...
...
@@ -216,7 +216,7 @@ import (
case
*
ast
.
StructType
:
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
msgCode
,
typename
)
buf
.
emit
(
"func (
_
*%s) NEOMsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"func (*%s) NEOMsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"return %d"
,
msgCode
)
buf
.
emit
(
"}
\n
"
)
...
...
go/neo/server/cluster_test.go
View file @
547a6fa9
...
...
@@ -47,8 +47,6 @@ import (
"fmt"
)
var
_
=
fmt
.
Print
// XXX dup from connection_test
func
xwait
(
w
interface
{
Wait
()
error
})
{
err
:=
w
.
Wait
()
...
...
@@ -75,7 +73,11 @@ func (t *MyTracer) TraceNetTx(ev *xnet.TraceTx) {} // { t.Trace1(ev) }
type
traceNeoRecv
struct
{
conn
*
neo
.
Conn
;
msg
neo
.
Msg
}
func
(
t
*
MyTracer
)
traceNeoConnRecv
(
c
*
neo
.
Conn
,
msg
neo
.
Msg
)
{
t
.
Trace1
(
&
traceNeoRecv
{
c
,
msg
})
}
type
traceNeoSend
struct
{
conn
*
neo
.
Conn
;
msg
neo
.
Msg
}
type
traceNeoSend
struct
{
Src
,
Dst
net
.
Addr
ConnID
uint32
Msg
neo
.
Msg
}
func
(
t
*
MyTracer
)
traceNeoConnSend
(
c
*
neo
.
Conn
,
msg
neo
.
Msg
)
{
t
.
Trace1
(
&
traceNeoSend
{
c
,
msg
})
}
...
...
@@ -140,7 +142,7 @@ func TestMasterStorage(t *testing.T) {
tracing
.
Lock
()
neo_traceConnRecv_Attach
(
pg
,
tracer
.
traceNeoConnRecv
)
neo_traceConnSend
_Attach
(
pg
,
tracer
.
traceNeoConnSend
)
neo_traceConnSend
Pre_Attach
(
pg
,
tracer
.
traceNeoConnSendPre
)
tracing
.
Unlock
()
...
...
@@ -177,7 +179,7 @@ func TestMasterStorage(t *testing.T) {
Mctx
,
Mcancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
.
Gox
(
func
()
{
err
:=
M
.
Run
(
Mctx
)
fmt
.
Println
(
"err: "
,
err
)
fmt
.
Println
(
"
M
err: "
,
err
)
_
=
err
// XXX
})
...
...
@@ -193,6 +195,7 @@ func TestMasterStorage(t *testing.T) {
Sctx
,
Scancel
:=
context
.
WithCancel
(
context
.
Background
())
wg
.
Gox
(
func
()
{
err
:=
S
.
Run
(
Sctx
)
fmt
.
Println
(
"S err: "
,
err
)
_
=
err
// XXX
})
...
...
@@ -206,15 +209,20 @@ func TestMasterStorage(t *testing.T) {
//)
_
=
nettx
tc
.
Expect
(
conntx
(
"s:1"
,
"m:1"
,
1
,
RequestIdentification
{
...
})
// ... M adjust nodetab...
conntx
(
"m:1"
,
"s:1"
,
1
,
AcceptIdentification
{
...
})
)
// XXX temp
//return
// M <- S .? RequestIdentification{...} + TODO test ID rejects
println
(
"111"
)
tc
.
Expect
(
netlisten
(
"s:0"
))
// XXX no -> temp only to get complate
println
(
"222"
)
// XXX temp
return
// M.nodeTab <- Node(S) XXX order can be racy?
...
...
go/neo/ztrace.go
View file @
547a6fa9
...
...
@@ -6,9 +6,6 @@ package neo
import
(
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
"unsafe"
"lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
"net"
)
// traceevent: traceConnRecv(c *Conn, msg Msg)
...
...
@@ -38,55 +35,32 @@ func traceConnRecv_Attach(pg *tracing.ProbeGroup, probe func(c *Conn, msg Msg))
return
&
p
.
Probe
}
// traceevent: traceConnSend(c *Conn, msg Msg)
// traceevent: traceConnSend
Pre
(c *Conn, msg Msg)
type
_t_traceConnSend
struct
{
type
_t_traceConnSend
Pre
struct
{
tracing
.
Probe
probefunc
func
(
c
*
Conn
,
msg
Msg
)
}
var
_traceConnSend
*
_t_traceConnSend
var
_traceConnSend
Pre
*
_t_traceConnSendPre
func
traceConnSend
(
c
*
Conn
,
msg
Msg
)
{
if
_traceConnSend
!=
nil
{
_traceConnSend_run
(
c
,
msg
)
func
traceConnSend
Pre
(
c
*
Conn
,
msg
Msg
)
{
if
_traceConnSend
Pre
!=
nil
{
_traceConnSend
Pre
_run
(
c
,
msg
)
}
}
func
_traceConnSend_run
(
c
*
Conn
,
msg
Msg
)
{
for
p
:=
_traceConnSend
;
p
!=
nil
;
p
=
(
*
_t_traceConnSend
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
func
_traceConnSend
Pre
_run
(
c
*
Conn
,
msg
Msg
)
{
for
p
:=
_traceConnSend
Pre
;
p
!=
nil
;
p
=
(
*
_t_traceConnSendPre
)(
unsafe
.
Pointer
(
p
.
Next
()))
{
p
.
probefunc
(
c
,
msg
)
}
}
func
traceConnSend_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
c
*
Conn
,
msg
Msg
))
*
tracing
.
Probe
{
p
:=
_t_traceConnSend
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceConnSend
)),
&
p
.
Probe
)
func
traceConnSend
Pre
_Attach
(
pg
*
tracing
.
ProbeGroup
,
probe
func
(
c
*
Conn
,
msg
Msg
))
*
tracing
.
Probe
{
p
:=
_t_traceConnSend
Pre
{
probefunc
:
probe
}
tracing
.
AttachProbe
(
pg
,
(
**
tracing
.
Probe
)(
unsafe
.
Pointer
(
&
_traceConnSend
Pre
)),
&
p
.
Probe
)
return
&
p
.
Probe
}
// trace export signature
func
_trace_exporthash_bc56cd7a9caf82c14d9586243f763e65afb91ea0
()
{}
// traceimport: "lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
// rerun "gotrace gen" if you see link failure ↓↓↓
//go:linkname pipenet_trace_exporthash lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet._trace_exporthash_e77a134646e20f099af466ab3192282237d2e547
func
pipenet_trace_exporthash
()
func
init
()
{
pipenet_trace_exporthash
()
}
//go:linkname pipenet_traceAccept_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceAccept_Attach
func
pipenet_traceAccept_Attach
(
*
tracing
.
ProbeGroup
,
func
(
conn
net
.
Conn
))
*
tracing
.
Probe
//go:linkname pipenet_traceDial_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceDial_Attach
func
pipenet_traceDial_Attach
(
*
tracing
.
ProbeGroup
,
func
(
addr
string
))
*
tracing
.
Probe
//go:linkname pipenet_traceListen_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceListen_Attach
func
pipenet_traceListen_Attach
(
*
tracing
.
ProbeGroup
,
func
(
laddr
string
))
*
tracing
.
Probe
//go:linkname pipenet_traceNew_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceNew_Attach
func
pipenet_traceNew_Attach
(
*
tracing
.
ProbeGroup
,
func
(
name
string
))
*
tracing
.
Probe
//go:linkname pipenet_traceNewHost_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceNewHost_Attach
func
pipenet_traceNewHost_Attach
(
*
tracing
.
ProbeGroup
,
func
(
host
*
pipenet
.
Host
))
*
tracing
.
Probe
func
_trace_exporthash_d2fa0ebb37c3e2bf54309859a1eeb0e831edd435
()
{}
go/neo/ztrace.s
deleted
100644 → 0
View file @
bca096a5
//
Code
generated
by
lab
.
nexedi
.
com
/
kirr
/
go123
/
tracing
/
cmd
/
gotrace
; DO NOT EDIT.
//
empty
.
s
so
`
go
build
`
does
not
use
-
complete
for
go
:
linkname
to
work
go/xcommon/xtesting/xtesting.go
View file @
547a6fa9
...
...
@@ -63,10 +63,9 @@ func (st *SyncTracer) Trace1(event interface{}) {
// Get1 receives message with 1 tracing event from a producer
// The consumer, after dealing with the message, must send back an ack.
func
(
st
*
SyncTracer
)
Get1
()
*
SyncTraceMsg
{
return
<-
st
.
tracech
//msg := <-st.tracech
//fmt.Printf("trace: get1: %T %v\n", msg.Event, msg.Event)
//return msg
msg
:=
<-
st
.
tracech
fmt
.
Printf
(
"trace: get1: %T %v
\n
"
,
msg
.
Event
,
msg
.
Event
)
return
msg
}
...
...
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