Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
791fd2da
Commit
791fd2da
authored
Feb 21, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
81fe88df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
wcfs/__init__.py
wcfs/__init__.py
+4
-3
wcfs/wcfs.go
wcfs/wcfs.go
+23
-10
No files found.
wcfs/__init__.py
View file @
791fd2da
...
...
@@ -25,7 +25,8 @@ will be automatically started if `autostart=True` parameter is passed to join.
It will also be automatically started by default unless
$WENDELIN_CORE_WCFS_AUTOSTART=no is specified in environment.
XXX Conn.
Conn represents connection to wcfs server obtained by join.
XXX
"""
import
os
,
sys
,
hashlib
,
tempfile
,
subprocess
,
time
...
...
@@ -41,7 +42,7 @@ from ZODB.FileStorage import FileStorage
# Conn represents connection to wcfs server.
class
Conn
(
object
):
# .mountpoint path to mountpoint
# .mountpoint path to
wcfs
mountpoint
# ._fwcfs /.wcfs/zurl opened to keep the server from going away (at least cleanly)
def
__init__
(
self
,
mountpoint
,
fwcfs
):
...
...
@@ -98,7 +99,7 @@ def _default_autostart():
# join connects to wcfs server for ZODB @ zurl.
#
# If wcfs for that
service
was already started, join connects to it.
# If wcfs for that
zurl
was already started, join connects to it.
# Otherwise it starts wcfs for zurl if autostart is True.
#
# join(zurl) -> Conn.
...
...
wcfs/wcfs.go
View file @
791fd2da
...
...
@@ -587,12 +587,12 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
traceWatch
(
">>>"
)
zwatchq
:=
make
(
chan
zodb
.
Commit
Event
)
zwatchq
:=
make
(
chan
zodb
.
Event
)
at0
:=
root
.
zstor
.
AddWatch
(
zwatchq
)
// XXX -> to main thread to avoid race
defer
root
.
zstor
.
DelWatch
(
zwatchq
)
_
=
at0
// XXX
var
zevent
zodb
.
Commit
Event
var
zevent
zodb
.
Event
var
ok
bool
for
{
...
...
@@ -609,15 +609,28 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
return
nil
// closed XXX ok?
}
}
traceWatch
(
"zevent: %s"
,
zevent
)
var
zδ
*
zodb
.
EventCommit
switch
zevent
:=
zevent
.
(
type
)
{
default
:
return
fmt
.
Errorf
(
"unexpected event: %T"
,
zevent
)
case
*
zodb
.
EventError
:
return
zevent
.
Err
case
*
zodb
.
EventCommit
:
zδ
=
zevent
}
root
.
zδhandle1
(
z
event
)
root
.
zδhandle1
(
z
δ
)
}
}
// zδhandle1 handles 1 change event from ZODB notification.
func
(
root
*
Root
)
zδhandle1
(
z
event
zodb
.
CommitEven
t
)
{
func
(
root
*
Root
)
zδhandle1
(
z
δ
*
zodb
.
EventCommi
t
)
{
head
:=
root
.
head
// while we are invalidating OS cache, make sure that nothing, that
...
...
@@ -662,8 +675,8 @@ retry:
fmt
.
Printf
(
"
\n\n\n
"
)
// z
event
= (tid↑, []oid)
for
_
,
oid
:=
range
z
event
.
Changev
{
// z
δ
= (tid↑, []oid)
for
_
,
oid
:=
range
z
δ
.
Changev
{
// XXX zhead.Cache() lock/unlock + comment it is not really needed
obj
:=
zhead
.
Cache
()
.
Get
(
oid
)
if
obj
==
nil
{
...
...
@@ -772,7 +785,7 @@ retry:
panic
(
err
)
// XXX
}
// resync .zhead to z
event
.tid
// resync .zhead to z
δ
.tid
// XXX -> Head.Resync() ?
// 1. deactivate changed ZBigFile (we keep all ZBigFiles activated during whole txn)
...
...
@@ -785,7 +798,7 @@ retry:
// 2. abort old and resync to new txn/at
transaction
.
Current
(
zhead
.
txnCtx
)
.
Abort
()
txn
,
ctx
:=
transaction
.
New
(
context
.
Background
())
// XXX bg ok?
zhead
.
Resync
(
txn
,
z
event
.
Tid
)
zhead
.
Resync
(
txn
,
z
δ
.
Tid
)
zhead
.
txnCtx
=
ctx
// 3. reactivate/restat invalidated ZBigFile
...
...
@@ -808,7 +821,7 @@ retry:
// notify .wcfs/zhead
for
sk
:=
range
gdebug
.
zheadSockTab
{
_
,
err
:=
fmt
.
Fprintf
(
sk
,
"%s
\n
"
,
z
event
.
Tid
)
_
,
err
:=
fmt
.
Fprintf
(
sk
,
"%s
\n
"
,
z
δ
.
Tid
)
if
err
!=
nil
{
log
.
Error
(
err
)
// XXX errctx, -> warning?
sk
.
Close
()
...
...
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