Commit c64268eb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent abcec3cb
...@@ -33,6 +33,7 @@ import ( ...@@ -33,6 +33,7 @@ import (
"lab.nexedi.com/kirr/go123/mem" "lab.nexedi.com/kirr/go123/mem"
"lab.nexedi.com/kirr/go123/xerr" "lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xsync"
"lab.nexedi.com/kirr/neo/go/internal/task" "lab.nexedi.com/kirr/neo/go/internal/task"
"lab.nexedi.com/kirr/neo/go/zodb" "lab.nexedi.com/kirr/neo/go/zodb"
) )
...@@ -61,14 +62,27 @@ func (d *Storage) Close() (err error) { ...@@ -61,14 +62,27 @@ func (d *Storage) Close() (err error) {
} }
// Sync implements zodb.IStorageDriver . // Sync implements zodb.IStorageDriver .
func (d *Storage) Sync(ctx context.Context) (head zodb.Tid, err error) { func (d *Storage) Sync(ctx context.Context) (_ zodb.Tid, err error) {
defer func() { defer func() {
if err != nil { if err != nil {
err = &zodb.OpError{URL: d.URL(), Op: "sync", Err: err} err = &zodb.OpError{URL: d.URL(), Op: "sync", Err: err}
} }
}() }()
head, err = d.δ.Sync(ctx) var head zodb.Tid
wg := xsync.NewWorkGroup(ctx)
wg.Go(func(ctx context.Context) error {
h, err := d.δ.Sync(ctx)
head = h
return err
})
wg.Go(func(ctx context.Context) error {
baseHead, err := d.base.Sync(ctx)
// XXX baseHead != .baseAt0 -> fail
return err
})
err = wg.Wait()
if err != nil { if err != nil {
return zodb.InvalidTid, err return zodb.InvalidTid, err
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment