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
e4125185
Commit
e4125185
authored
Oct 01, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
968a761e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
10 deletions
+30
-10
wcfs/wcfs.go
wcfs/wcfs.go
+30
-10
No files found.
wcfs/wcfs.go
View file @
e4125185
...
@@ -255,6 +255,9 @@ import (
...
@@ -255,6 +255,9 @@ import (
"sync"
"sync"
"syscall"
"syscall"
"lab.nexedi.com/kirr/go123/xcontext"
"lab.nexedi.com/kirr/neo/go/transaction"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
_
"lab.nexedi.com/kirr/neo/go/zodb/wks"
...
@@ -301,7 +304,13 @@ type BigFileData struct {
...
@@ -301,7 +304,13 @@ type BigFileData struct {
nodefs
.
Node
nodefs
.
Node
//parent *BigFileHead
//parent *BigFileHead
zconn
*
zodb
.
Connection
// ZODB connection via whcih .zbf is accessed
// current read-only transaction under which we access ZODB data
txnCtx
context
.
Context
// XXX -> directly store txn
// connection via which ZODB object for this bigfile are accessed
// XXX do we need to keep it here explicitly?
zconn
*
zodb
.
Connection
zbf
*
ZBigFile
zbf
*
ZBigFile
// TODO
// TODO
...
@@ -312,7 +321,7 @@ type BigFileData struct {
...
@@ -312,7 +321,7 @@ type BigFileData struct {
// /bigfile -> Mkdir receives client request to create /bigfile/<bigfileX>.
// /bigfile -> Mkdir receives client request to create /bigfile/<bigfileX>.
//
//
// It creates <bigfileX>/head/data along the way.
// It creates <bigfileX>/head/data along the way.
func
(
bfroot
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
*
nodefs
.
Inode
,
fuse
.
Status
)
{
func
(
bfroot
*
BigFileRoot
)
Mkdir
(
name
string
,
mode
uint32
,
fctx
*
fuse
.
Context
)
(
_
*
nodefs
.
Inode
,
status
fuse
.
Status
)
{
oid
,
err
:=
zodb
.
ParseOid
(
name
)
oid
,
err
:=
zodb
.
ParseOid
(
name
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"/bigfile: mkdir %q: not-oid"
,
name
)
log
.
Printf
(
"/bigfile: mkdir %q: not-oid"
,
name
)
...
@@ -330,11 +339,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
...
@@ -330,11 +339,23 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
return
nil
,
fuse
.
Status
(
syscall
.
EEXIST
)
return
nil
,
fuse
.
Status
(
syscall
.
EEXIST
)
}
}
// no - without bfroot lock proceed to load corresponding objects from ZODB
// not there - without bfroot lock proceed to load corresponding objects from ZODB:
ctx
:=
asctx
(
fctx
)
// create new read-only transaction for this bigfile
txn
,
txnCtx
:=
transaction
.
New
(
context
.
Background
())
defer
func
()
{
if
status
!=
fuse
.
OK
{
txn
.
Abort
()
}
}()
// XXX create txn
// create new DB/Connection for this bigfile
// create new DB/Connection for this bigfile
// XXX better ctx = transaction.PutIntoContext(ctx, txn)
ctx
,
cancel
:=
xcontext
.
Merge
(
asctx
(
fctx
),
txnCtx
)
defer
cancel
()
zdb
:=
zodb
.
NewDB
(
bfroot
.
zstor
)
zdb
:=
zodb
.
NewDB
(
bfroot
.
zstor
)
zconn
,
err
:=
zdb
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{})
// XXX .NoSync=true ?
zconn
,
err
:=
zdb
.
Open
(
ctx
,
&
zodb
.
ConnOptions
{})
// XXX .NoSync=true ?
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -342,8 +363,6 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
...
@@ -342,8 +363,6 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
return
nil
,
fuse
.
EIO
return
nil
,
fuse
.
EIO
}
}
// XXX txn.Abort(), put conn back on error
xzbf
,
err
:=
zconn
.
Get
(
ctx
,
oid
)
xzbf
,
err
:=
zconn
.
Get
(
ctx
,
oid
)
if
err
!=
nil
{
if
err
!=
nil
{
switch
errors
.
Cause
(
err
)
.
(
type
)
{
switch
errors
.
Cause
(
err
)
.
(
type
)
{
...
@@ -384,6 +403,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
...
@@ -384,6 +403,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
bfdata
:=
&
BigFileData
{
bfdata
:=
&
BigFileData
{
Node
:
nodefs
.
NewDefaultNode
(),
Node
:
nodefs
.
NewDefaultNode
(),
txnCtx
:
txnCtx
,
zconn
:
zconn
,
zconn
:
zconn
,
zbf
:
zbf
,
zbf
:
zbf
,
}
}
...
...
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