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
dc1ad0d9
Commit
dc1ad0d9
authored
Dec 18, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
26e8e3d3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
14 deletions
+22
-14
go/neo/client.go
go/neo/client.go
+2
-2
go/neo/storage/fs1/fs1.go
go/neo/storage/fs1/fs1.go
+1
-1
go/neo/t_misc_test.go
go/neo/t_misc_test.go
+2
-1
go/zodb/open.go
go/zodb/open.go
+4
-3
go/zodb/storage/fs1/filestorage.go
go/zodb/storage/fs1/filestorage.go
+6
-2
go/zodb/storage/fs1/filestorage_test.go
go/zodb/storage/fs1/filestorage_test.go
+5
-3
go/zodb/storage/zeo/zeo.go
go/zodb/storage/zeo/zeo.go
+2
-2
No files found.
go/neo/client.go
View file @
dc1ad0d9
...
...
@@ -507,8 +507,8 @@ func openClientByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (
return
nil
,
fmt
.
Errorf
(
"neo: %s: TODO write mode not implemented"
,
u
)
}
// XXX handle opt.Watch
Q
if
opt
.
Watch
Q
!=
nil
{
// XXX handle opt.Watch
q
if
opt
.
Watch
q
!=
nil
{
panic
(
"TODO watchq"
)
}
...
...
go/neo/storage/fs1/fs1.go
View file @
dc1ad0d9
...
...
@@ -49,7 +49,7 @@ type Backend struct {
var
_
storage
.
Backend
=
(
*
Backend
)(
nil
)
func
Open
(
ctx
context
.
Context
,
path
string
)
(
*
Backend
,
error
)
{
zstor
,
err
:=
fs1
.
Open
(
ctx
,
path
)
zstor
,
err
:=
fs1
.
Open
(
ctx
,
path
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
})
// XXX RO? +Watchq?
if
err
!=
nil
{
return
nil
,
err
}
...
...
go/neo/t_misc_test.go
View file @
dc1ad0d9
...
...
@@ -24,6 +24,7 @@ import (
"context"
"math"
"lab.nexedi.com/kirr/neo/go/zodb"
zfs1
"lab.nexedi.com/kirr/neo/go/zodb/storage/fs1"
bfs1
"lab.nexedi.com/kirr/neo/go/neo/storage/fs1"
"lab.nexedi.com/kirr/go123/exc"
...
...
@@ -40,7 +41,7 @@ func gox(wg interface { Go(func() error) }, xf func()) {
}
func
xfs1stor
(
path
string
)
*
zfs1
.
FileStorage
{
stor
,
err
:=
zfs1
.
Open
(
bg
,
path
)
stor
,
err
:=
zfs1
.
Open
(
bg
,
path
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
})
// XXX opts = ?
exc
.
Raiseif
(
err
)
return
stor
}
...
...
go/zodb/open.go
View file @
dc1ad0d9
...
...
@@ -40,12 +40,13 @@ type DriverOptions struct {
ReadOnly
bool
// whether to open storage as read-only
// Channel where watched storage events have to be delivered.
// WatchQ can be nil to ignore such events. However if WatchQ != nil, the events
//
// Watchq can be nil to ignore such events. However if Watchq != nil, the events
// have to be consumed or else the storage driver will misbehave - e.g.
// it can get out of sync with the on-disk database file.
//
//
XXX the channel will be closed after ... ?
Watch
Q
chan
WatchEvent
//
The storage driver closes !nil Watchq when the driver is closed.
Watch
q
chan
<-
WatchEvent
}
// DriverOpener is a function to open a storage driver.
...
...
go/zodb/storage/fs1/filestorage.go
View file @
dc1ad0d9
...
...
@@ -97,7 +97,7 @@ type FileStorage struct {
txnhMax
TxnHeader
// (both with .Len=0 & .Tid=0 if database is empty)
// driver client <- watcher: data file updates.
watchq
chan
zodb
.
WatchEvent
watchq
chan
<-
zodb
.
WatchEvent
down
chan
struct
{}
// ready when FileStorage is no longer operational
downOnce
sync
.
Once
...
...
@@ -464,6 +464,10 @@ func (fs *FileStorage) watcher(w *fsnotify.Watcher) {
if
err
!=
nil
{
log
.
Print
(
err
)
}
if
fs
.
watchq
!=
nil
{
close
(
fs
.
watchq
)
}
}
func
(
fs
*
FileStorage
)
_watcher
(
w
*
fsnotify
.
Watcher
)
(
err
error
)
{
...
...
@@ -666,7 +670,7 @@ func Open(ctx context.Context, path string, opt *zodb.DriverOptions) (_ *FileSto
}
fs
:=
&
FileStorage
{
watchq
:
opt
.
Watch
Q
,
watchq
:
opt
.
Watch
q
,
down
:
make
(
chan
struct
{}),
}
...
...
go/zodb/storage/fs1/filestorage_test.go
View file @
dc1ad0d9
...
...
@@ -426,7 +426,7 @@ func TestWatch(t *testing.T) {
at
:=
xcommit
(
0
,
Object
{
0
,
"data0"
})
watchq
:=
make
(
chan
zodb
.
WatchEvent
)
fs
:=
xfsopenopt
(
t
,
tfs
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
,
Watch
Q
:
watchq
})
fs
:=
xfsopenopt
(
t
,
tfs
,
&
zodb
.
DriverOptions
{
ReadOnly
:
true
,
Watch
q
:
watchq
})
ctx
:=
context
.
Background
()
checkLastTid
:=
func
(
lastOk
zodb
.
Tid
)
{
...
...
@@ -471,8 +471,10 @@ func TestWatch(t *testing.T) {
t
.
Fatal
(
err
)
}
e
:=
<-
watchq
_
=
e
e
,
ok
:=
<-
watchq
if
ok
{
t
.
Fatalf
(
"watch after close -> %v; want closed"
,
e
)
}
_
=
errors
.
Cause
(
nil
)
// XXX e.Err == ErrClosed
...
...
go/zodb/storage/zeo/zeo.go
View file @
dc1ad0d9
...
...
@@ -310,8 +310,8 @@ func openByURL(ctx context.Context, u *url.URL, opt *zodb.DriverOptions) (_ zodb
return
nil
,
fmt
.
Errorf
(
"TODO write mode not implemented"
)
}
// XXX handle opt.Watch
Q
if
opt
.
Watch
Q
!=
nil
{
// XXX handle opt.Watch
q
if
opt
.
Watch
q
!=
nil
{
panic
(
"TODO watchq"
)
}
...
...
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