Commit 7f4eb022 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 15123fbf
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
// Each wendelin.core array (ZBigArray) is actually a linear file (ZBigFile) // Each wendelin.core array (ZBigArray) is actually a linear file (ZBigFile)
// and array metadata like dtype, shape and strides associated with it. This // and array metadata like dtype, shape and strides associated with it. This
// program exposes as files only ZBigFile data and leaves rest of // program exposes as files only ZBigFile data and leaves rest of
// array-specific handling to client. Every ZBigFile is exposed as one separate // array-specific handling to clients. Every ZBigFile is exposed as one separate
// file that represents whole ZBigFile's data. // file that represents whole ZBigFile's data.
// //
// For a client, the primary way to access a bigfile should be to mmap // For a client, the primary way to access a bigfile should be to mmap
...@@ -227,6 +227,8 @@ package main ...@@ -227,6 +227,8 @@ package main
// timings depending on clients). No harm here as different bigfiles use // timings depending on clients). No harm here as different bigfiles use
// completely different ZODB BTree and data objects. // completely different ZODB BTree and data objects.
// //
// For every ZODB connection a dedicated read-only transaction is maintained.
//
// //
// Notes on OS pagecache control: // Notes on OS pagecache control:
// //
...@@ -273,7 +275,7 @@ import ( ...@@ -273,7 +275,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
// /bigfile/ - represented by BigFileRoot. // /bigfile/ - served by BigFileRoot.
type BigFileRoot struct { type BigFileRoot struct {
nodefs.Node nodefs.Node
zstor zodb.IStorage zstor zodb.IStorage
...@@ -283,29 +285,25 @@ type BigFileRoot struct { ...@@ -283,29 +285,25 @@ type BigFileRoot struct {
tab map[zodb.Oid]*BigFileDir tab map[zodb.Oid]*BigFileDir
} }
// /bigfile/<bigfileX>/ - represented by BigFileDir. // /bigfile/<bigfileX>/ - served by BigFileDir.
type BigFileDir struct { type BigFileDir struct {
nodefs.Node nodefs.Node
zdb *zodb.DB zdb *zodb.DB
// head/ (XXX just by fs entry) // head/ is implicitly linked to by fs
// {} rev -> @<rev>/ bigfile snapshot // {} rev -> @<rev>/ bigfile snapshot
revMu sync.Mutex revMu sync.Mutex
//revTab map[zodb.Tid]*BigFileRev revTab map[zodb.Tid]*BigFileRev
} }
// /bigfile/<bigfileX>/head/ - represented by BigFileHead. // /bigfile/<bigfileX>/(head|<rev>)/ - served by BigFileRev.
// XXX -> BigFileRev (with head | @tid) ? type BigFileRev struct {
type BigFileHead struct {
nodefs.Node nodefs.Node
// data, at, invalidations, etc - all implicitly linked to by fs
data *BigFileData
//inv *BigFileInvalidations
} }
// /bigfile/<bigfileX>/(head|<rev>)/{data,at} - internally served by BigFile. // /bigfile/<bigfileX>/(head|<rev>)/* - internally served by BigFile.
type BigFile struct { type BigFile struct {
// current read-only transaction under which we access ZODB data // current read-only transaction under which we access ZODB data
txnCtx context.Context // XXX -> better directly store txn txnCtx context.Context // XXX -> better directly store txn
...@@ -317,15 +315,14 @@ type BigFile struct { ...@@ -317,15 +315,14 @@ type BigFile struct {
// ZBigFile top-level object. Kept activated during lifetime of current transaction. // ZBigFile top-level object. Kept activated during lifetime of current transaction.
zbf *ZBigFile zbf *ZBigFile
// zbf.Size(). It is constant during liftime of a transaction // zbf.Size(). It is constant during liftime of current transaction.
// (we do only read-only txn) XXX -> organization overview.
zbfSize int64 zbfSize int64
// TODO // TODO
// lastChange zodb.Tid // last change to whole bigfile as of .zconn.At view // lastChange zodb.Tid // last change to whole bigfile as of .zconn.At view
} }
// /bigfile/<bigfileX>/(head|<rev>)/data - represented by BigFileData. // /bigfile/<bigfileX>/(head|<rev>)/data - served by BigFileData.
type BigFileData struct { type BigFileData struct {
nodefs.Node nodefs.Node
...@@ -333,6 +330,8 @@ type BigFileData struct { ...@@ -333,6 +330,8 @@ type BigFileData struct {
// inflight loadings of ZBigFile from ZODB. // inflight loadings of ZBigFile from ZODB.
// successfull load results are kept here until blkdata is put into OS pagecache. // successfull load results are kept here until blkdata is put into OS pagecache.
//
// XXX -> BigFile ?
loadMu sync.Mutex loadMu sync.Mutex
loading map[int64]*blkLoadState // #blk -> {... blkdata} loading map[int64]*blkLoadState // #blk -> {... blkdata}
} }
...@@ -354,7 +353,7 @@ type blkLoadState struct { ...@@ -354,7 +353,7 @@ type blkLoadState 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/* along the way.
func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (_ *nodefs.Inode, status 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 {
...@@ -448,7 +447,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -448,7 +447,7 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
zdb: zdb, zdb: zdb,
} }
bfhead := &BigFileHead{ bfhead := &BigFileRev{
Node: nodefs.NewDefaultNode(), Node: nodefs.NewDefaultNode(),
} }
...@@ -465,8 +464,6 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) ( ...@@ -465,8 +464,6 @@ func (bfroot *BigFileRoot) Mkdir(name string, mode uint32, fctx *fuse.Context) (
loading: make(map[int64]*blkLoadState), loading: make(map[int64]*blkLoadState),
} }
bfhead.data = bfdata
bfroot.tab[oid] = bfdir bfroot.tab[oid] = bfdir
bfroot.mu.Unlock() bfroot.mu.Unlock()
......
...@@ -125,7 +125,7 @@ func (zd *zDataState) DropState() { ...@@ -125,7 +125,7 @@ func (zd *zDataState) DropState() {
} }
func (zd *zDataState) PySetState(pystate interface{}) error { func (zd *zDataState) PySetState(pystate interface{}) error {
log.Printf("ZData.PySetState") //log.Printf("ZData.PySetState")
data, ok := pystate.(string) data, ok := pystate.(string)
if !ok { if !ok {
return fmt.Errorf("expect str; got %s", typeOf(pystate)) return fmt.Errorf("expect str; got %s", typeOf(pystate))
......
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