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
36a24373
Commit
36a24373
authored
Sep 04, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b16b546c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
go/neo/error.go
go/neo/error.go
+10
-0
go/neo/neo.go
go/neo/neo.go
+10
-1
go/neo/t/t.sh
go/neo/t/t.sh
+5
-2
go/neo/t/zsha1.go
go/neo/t/zsha1.go
+2
-0
No files found.
go/neo/error.go
View file @
36a24373
...
...
@@ -37,6 +37,10 @@ func ErrEncode(err error) *Error {
// XXX abusing message for xid
return
&
Error
{
Code
:
OID_NOT_FOUND
,
Message
:
err
.
Xid
.
String
()}
case
*
zodb
.
ErrOidMissing
:
// XXX abusing message for oid
return
&
Error
{
Code
:
OID_DOES_NOT_EXIST
,
Message
:
err
.
Oid
.
String
()}
default
:
return
&
Error
{
Code
:
NOT_READY
/* XXX how to report 503? was BROKEN_NODE */
,
Message
:
err
.
Error
()}
}
...
...
@@ -52,6 +56,12 @@ func ErrDecode(e *Error) error {
if
err
==
nil
{
return
&
zodb
.
ErrXidMissing
{
xid
}
}
case
OID_DOES_NOT_EXIST
:
oid
,
err
:=
zodb
.
ParseOid
(
e
.
Message
)
// XXX abusing message for oid
if
err
==
nil
{
return
&
zodb
.
ErrOidMissing
{
oid
}
}
}
return
e
...
...
go/neo/neo.go
View file @
36a24373
...
...
@@ -30,6 +30,7 @@ package neo
import
(
"context"
"fmt"
"math"
"net"
"sync"
...
...
@@ -79,7 +80,7 @@ func NewNodeApp(net xnet.Networker, typ NodeType, clusterName, masterAddr, serve
}
app
:=
&
NodeApp
{
MyInfo
:
NodeInfo
{
Type
:
typ
,
Addr
:
addr
},
MyInfo
:
NodeInfo
{
Type
:
typ
,
Addr
:
addr
,
IdTimestamp
:
math
.
NaN
()
},
ClusterName
:
clusterName
,
Net
:
net
,
MasterAddr
:
masterAddr
,
...
...
@@ -335,6 +336,14 @@ func (app *NodeApp) UpdateNodeTab(ctx context.Context, msg *NotifyNodeInformatio
for
_
,
nodeInfo
:=
range
msg
.
NodeList
{
log
.
Infof
(
ctx
,
"rx node update: %v"
,
nodeInfo
)
app
.
NodeTab
.
Update
(
nodeInfo
)
// XXX we have to provide IdTimestamp when requesting identification to other peers
// (e.g. Spy checks this is what master broadcast them and if not replis "unknown by master")
if
nodeInfo
.
UUID
==
app
.
MyInfo
.
UUID
{
// XXX recheck locking
// XXX do .MyInfo = nodeInfo ?
app
.
MyInfo
.
IdTimestamp
=
nodeInfo
.
IdTimestamp
}
}
// FIXME logging under lock (if caller took e.g. .StateMu before applying updates)
...
...
go/neo/t/t.sh
View file @
36a24373
...
...
@@ -157,6 +157,7 @@ xmysql() {
mysql
--defaults-file
=
$mycnf
"
$@
"
}
# spawn neo/py cluster working on mariadb
neopysql
()
{
MDB
sleep
1
# XXX fragile
...
...
@@ -206,9 +207,11 @@ gensqlite() {
#neopylite
neopysql
time
demo-zbigarray
read
neo://
$cluster
@
$Mbind
#time demo-zbigarray read neo://$cluster@$Mbind
./zsha1.py neo://
$cluster
@
$Mbind
go run zsha1.go neo://
$cluster
@
$Mbind
xneoctl
set
cluster stopping
xmysql
-e
"SHUTDOWN"
wait
exit
...
...
go/neo/t/zsha1.go
View file @
36a24373
...
...
@@ -5,6 +5,7 @@ import (
"context"
"crypto/sha1"
"log"
"flag"
"fmt"
"os"
"time"
...
...
@@ -16,6 +17,7 @@ import (
)
func
main
()
{
flag
.
Parse
()
url
:=
os
.
Args
[
1
]
// XXX dirty
bg
:=
context
.
Background
()
...
...
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