Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
cfc26e2b
Commit
cfc26e2b
authored
Oct 27, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
69fd5651
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
20 deletions
+39
-20
go/neo/client.go
go/neo/client.go
+39
-20
No files found.
go/neo/client.go
View file @
cfc26e2b
...
@@ -93,6 +93,7 @@ func NewClient(clusterName, masterAddr string, net xnet.Networker) *Client {
...
@@ -93,6 +93,7 @@ func NewClient(clusterName, masterAddr string, net xnet.Networker) *Client {
mlinkReady
:
make
(
chan
struct
{}),
mlinkReady
:
make
(
chan
struct
{}),
operational
:
false
,
operational
:
false
,
opReady
:
make
(
chan
struct
{}),
opReady
:
make
(
chan
struct
{}),
at0Ready
:
make
(
chan
struct
{}),
}
}
}
}
...
@@ -319,10 +320,9 @@ func (c *Client) initFromMaster(ctx context.Context, mlink *neonet.NodeLink) (er
...
@@ -319,10 +320,9 @@ func (c *Client) initFromMaster(ctx context.Context, mlink *neonet.NodeLink) (er
if
c
.
at0Initialized
{
if
c
.
at0Initialized
{
// XXX c.head locking?
// XXX c.head locking?
if
lastTxn
.
Tid
!=
c
.
head
{
if
lastTxn
.
Tid
!=
c
.
head
{
return
fmt
.
Errorf
(
"
N
ew transactions were committed while we were disconnected from master (%s -> %s)"
,
c
.
head
,
lastTxn
.
Tid
)
return
fmt
.
Errorf
(
"
n
ew transactions were committed while we were disconnected from master (%s -> %s)"
,
c
.
head
,
lastTxn
.
Tid
)
}
}
}
// XXX -> else?
}
else
{
// since we read lastTid, in separate protocol exchange there is a
// since we read lastTid, in separate protocol exchange there is a
// chance, that by the time when lastTid was read, some new transactions
// chance, that by the time when lastTid was read, some new transactions
// were committed. This way lastTid will be > than some first
// were committed. This way lastTid will be > than some first
...
@@ -337,8 +337,10 @@ func (c *Client) initFromMaster(ctx context.Context, mlink *neonet.NodeLink) (er
...
@@ -337,8 +337,10 @@ func (c *Client) initFromMaster(ctx context.Context, mlink *neonet.NodeLink) (er
c
.
at0Mu
.
Lock
()
c
.
at0Mu
.
Lock
()
c
.
at0
=
lastTxn
.
Tid
c
.
at0
=
lastTxn
.
Tid
c
.
at0Initialized
=
true
c
.
at0Initialized
=
true
// c.flushEventq0() XXX reenable
c
.
flushEventq0
()
c
.
at0Mu
.
Unlock
()
c
.
at0Mu
.
Unlock
()
close
(
c
.
at0Ready
)
}
// XXX what next?
// XXX what next?
...
@@ -402,6 +404,23 @@ func (c *Client) recvMaster1(ctx context.Context, req neonet.Request) error {
...
@@ -402,6 +404,23 @@ func (c *Client) recvMaster1(ctx context.Context, req neonet.Request) error {
return
nil
return
nil
}
}
// flushEventq0 flushes events queued in c.eventq0.
// must be called under .at0Mu
func
(
c
*
Client
)
flushEventq0
()
{
if
!
c
.
at0Initialized
{
panic
(
"flush, but .at0 not yet initialized"
)
}
if
c
.
watchq
!=
nil
{
for
_
,
e
:=
range
c
.
eventq0
{
if
e
.
Tid
>
c
.
at0
{
c
.
watchq
<-
e
}
}
}
c
.
eventq0
=
nil
}
// --- user API calls ---
// --- user API calls ---
func
(
c
*
Client
)
Sync
(
ctx
context
.
Context
)
(
_
zodb
.
Tid
,
err
error
)
{
func
(
c
*
Client
)
Sync
(
ctx
context
.
Context
)
(
_
zodb
.
Tid
,
err
error
)
{
...
@@ -564,7 +583,7 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (
...
@@ -564,7 +583,7 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (
c
.
at0Mu
.
Lock
()
c
.
at0Mu
.
Lock
()
defer
c
.
at0Mu
.
Unlock
()
defer
c
.
at0Mu
.
Unlock
()
if
c
.
at0Initialized
{
if
c
.
at0Initialized
{
//
c.flushEventq0()
c
.
flushEventq0
()
}
}
if
c
.
watchq
!=
nil
{
if
c
.
watchq
!=
nil
{
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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