Documentation ¶
Overview ¶
Accept commands from the dxfuse_tools program. The only command
* right now is sync, but this is the place to implement additional * ones to come in the future.
Index ¶
- Constants
- func BytesToString(numBytes int64) string
- func DxDescribeBulkObjects(ctx context.Context, httpClient *http.Client, dxEnv *dxda.DXEnvironment, ...) (map[string]DxDescribeDataObject, error)
- func DxFindProject(ctx context.Context, dxEnv *dxda.DXEnvironment, projName string) (string, error)
- func FilenameIsPosixCompliant(filename string) bool
- func GetTgid(pid uint32) (tgid int32, err error)
- func LogMsg(moduleName string, a string, args ...interface{})
- func MakeFSBaseDir() string
- func MaxInt(x, y int) int
- func MaxInt64(x, y int64) int64
- func MinInt(x, y int) int
- func MinInt64(x, y int64) int64
- func SecondsToTime(t int64) time.Time
- func Time2string(t time.Time) string
- type Cache
- type Chunk
- type CmdClient
- type CmdServer
- type CmdServerBox
- type DeadFile
- type Dir
- type DirHandle
- type Dirs
- type DirtyFileInfo
- type DxDescribeDataObject
- type DxDescribePrj
- type DxDescribeRaw
- type DxDescribeRawTop
- type DxDownloadURL
- type DxFolder
- type DxListFolder
- type DxOps
- func (ops *DxOps) DxAddTags(ctx context.Context, httpClient *http.Client, projId string, objId string, ...) error
- func (ops *DxOps) DxClone(ctx context.Context, httpClient *http.Client, srcProjId string, srcId string, ...) (bool, error)
- func (ops *DxOps) DxFileCloseAndWait(ctx context.Context, httpClient *http.Client, projectId string, fid string) error
- func (ops *DxOps) DxFileNew(ctx context.Context, httpClient *http.Client, nonceStr string, projId string, ...) (string, error)
- func (ops *DxOps) DxFileUploadPart(ctx context.Context, httpClient *http.Client, fileId string, index int, ...) error
- func (ops *DxOps) DxFolderNew(ctx context.Context, httpClient *http.Client, projId string, folder string) error
- func (ops *DxOps) DxFolderRemove(ctx context.Context, httpClient *http.Client, projId string, folder string) error
- func (ops *DxOps) DxMove(ctx context.Context, httpClient *http.Client, projId string, ...) error
- func (ops *DxOps) DxRemoveObjects(ctx context.Context, httpClient *http.Client, projId string, ...) error
- func (ops *DxOps) DxRemoveTags(ctx context.Context, httpClient *http.Client, projId string, objId string, ...) error
- func (ops *DxOps) DxRename(ctx context.Context, httpClient *http.Client, projId string, fileId string, ...) error
- func (ops *DxOps) DxRenameFolder(ctx context.Context, httpClient *http.Client, projId string, folder string, ...) error
- func (ops *DxOps) DxSetProperties(ctx context.Context, httpClient *http.Client, projId string, objId string, ...) error
- type File
- type FileHandle
- type FileUpdateReq
- type FileUploadParameters
- type FileUploader
- type Filesys
- func (fsys *Filesys) CreateFile(ctx context.Context, op *fuseops.CreateFileOp) error
- func (fsys *Filesys) CreateLink(ctx context.Context, op *fuseops.CreateLinkOp) error
- func (fsys *Filesys) FlushFile(ctx context.Context, op *fuseops.FlushFileOp) error
- func (fsys *Filesys) ForgetInode(ctx context.Context, op *fuseops.ForgetInodeOp) error
- func (fsys *Filesys) GetInodeAttributes(ctx context.Context, op *fuseops.GetInodeAttributesOp) error
- func (fsys *Filesys) GetXattr(ctx context.Context, op *fuseops.GetXattrOp) error
- func (fsys *Filesys) ListXattr(ctx context.Context, op *fuseops.ListXattrOp) error
- func (fsys *Filesys) LookUpInode(ctx context.Context, op *fuseops.LookUpInodeOp) error
- func (fsys *Filesys) MkDir(ctx context.Context, op *fuseops.MkDirOp) error
- func (fsys *Filesys) OpenDir(ctx context.Context, op *fuseops.OpenDirOp) error
- func (fsys *Filesys) OpenFile(ctx context.Context, op *fuseops.OpenFileOp) error
- func (fsys *Filesys) ReadDir(ctx context.Context, op *fuseops.ReadDirOp) (err error)
- func (fsys *Filesys) ReadFile(ctx context.Context, op *fuseops.ReadFileOp) error
- func (fsys *Filesys) ReleaseDirHandle(ctx context.Context, op *fuseops.ReleaseDirHandleOp) error
- func (fsys *Filesys) ReleaseFileHandle(ctx context.Context, op *fuseops.ReleaseFileHandleOp) error
- func (fsys *Filesys) RemoveXattr(ctx context.Context, op *fuseops.RemoveXattrOp) error
- func (fsys *Filesys) Rename(ctx context.Context, op *fuseops.RenameOp) error
- func (fsys *Filesys) RmDir(ctx context.Context, op *fuseops.RmDirOp) error
- func (fsys *Filesys) SetInodeAttributes(ctx context.Context, op *fuseops.SetInodeAttributesOp) error
- func (fsys *Filesys) SetXattr(ctx context.Context, op *fuseops.SetXattrOp) error
- func (fsys *Filesys) Shutdown()
- func (fsys *Filesys) StatFS(ctx context.Context, op *fuseops.StatFSOp) error
- func (fsys *Filesys) SyncFile(ctx context.Context, op *fuseops.SyncFileOp) error
- func (fsys *Filesys) Unlink(ctx context.Context, op *fuseops.UnlinkOp) error
- func (fsys *Filesys) WriteFile(ctx context.Context, op *fuseops.WriteFileOp) error
- type FindProjectReply
- type FindProjectRequest
- type FindResult
- type IoReq
- type Iovec
- type ListFolderRequest
- type ListFolderResponse
- type MProperties
- type MTags
- type Manifest
- type ManifestDir
- type ManifestFile
- type MeasureWindow
- type MetadataDb
- func (mdb *MetadataDb) BeginTxn() (*sql.Tx, error)
- func (mdb *MetadataDb) CreateDir(oph *OpHandle, projId string, projFolder string, ctime int64, mtime int64, ...) (int64, error)
- func (mdb *MetadataDb) CreateFile(ctx context.Context, oph *OpHandle, dir *Dir, fname string, mode os.FileMode) (File, error)
- func (mdb *MetadataDb) DirtyFilesGetAndReset(flag int) ([]DirtyFileInfo, error)
- func (mdb *MetadataDb) Init() error
- func (mdb *MetadataDb) LookupByInode(ctx context.Context, oph *OpHandle, inode int64) (Node, bool, error)
- func (mdb *MetadataDb) LookupDirByInode(ctx context.Context, oph *OpHandle, inode int64) (Dir, bool, error)
- func (mdb *MetadataDb) LookupInDir(ctx context.Context, oph *OpHandle, dir *Dir, dirOrFileName string) (Node, bool, error)
- func (mdb *MetadataDb) MoveDir(ctx context.Context, oph *OpHandle, oldParentDir Dir, newParentDir Dir, ...) error
- func (mdb *MetadataDb) MoveFile(ctx context.Context, oph *OpHandle, inode int64, newParentDir Dir, ...) error
- func (mdb *MetadataDb) PopulateRoot(ctx context.Context, oph *OpHandle, manifest Manifest) error
- func (mdb *MetadataDb) ReadDirAll(ctx context.Context, oph *OpHandle, dir *Dir) (map[string]File, map[string]Dir, error)
- func (mdb *MetadataDb) RemoveEmptyDir(oph *OpHandle, inode int64) error
- func (mdb *MetadataDb) Shutdown()
- func (mdb *MetadataDb) Unlink(ctx context.Context, oph *OpHandle, file File) error
- func (mdb *MetadataDb) UpdateClosedFileMetadata(ctx context.Context, oph *OpHandle, inode int64) error
- func (mdb *MetadataDb) UpdateFileAttrs(ctx context.Context, oph *OpHandle, inode int64, fileSize int64, ...) error
- func (mdb *MetadataDb) UpdateFileLocalPath(ctx context.Context, oph *OpHandle, inode int64, localPath string) error
- func (mdb *MetadataDb) UpdateFileTagsAndProperties(ctx context.Context, oph *OpHandle, file File) error
- func (mdb *MetadataDb) UpdateInodeFileId(inode int64, fileId string) error
- type MoveRecord
- type Node
- type Nonce
- type ObjInfo
- type OpHandle
- type Options
- type Posix
- type PosixDir
- type PrefetchFileMetadata
- type PrefetchGlobalState
- func (pgs *PrefetchGlobalState) CacheLookup(hid fuseops.HandleID, startOfs int64, endOfs int64, data []byte) int
- func (pgs *PrefetchGlobalState) CreateStreamEntry(hid fuseops.HandleID, f File, url DxDownloadURL)
- func (pgs *PrefetchGlobalState) DownloadEntireFile(client *http.Client, inode int64, size int64, url DxDownloadURL, fd *os.File, ...) error
- func (pgs *PrefetchGlobalState) RemoveStreamEntry(hid fuseops.HandleID)
- func (pgs *PrefetchGlobalState) Shutdown()
- type Reply
- type ReplyAddTags
- type ReplyClone
- type ReplyDescribeProject
- type ReplyFolderNew
- type ReplyFolderRemove
- type ReplyMove
- type ReplyNewFile
- type ReplyRemoveObjects
- type ReplyRemoveTags
- type ReplyRename
- type ReplyRenameFolder
- type ReplySetProperties
- type ReplyUploadChunk
- type Request
- type RequestAddTags
- type RequestClone
- type RequestDescribeProject
- type RequestFolderNew
- type RequestFolderRemove
- type RequestMove
- type RequestNewFile
- type RequestRemoveObjects
- type RequestRemoveTags
- type RequestRename
- type RequestRenameFolder
- type RequestSetProperties
- type RequestUploadChunk
- type RequestWithScope
- type SyncDbDx
- type UploadRequest
Constants ¶
const ( // namespace for xattrs XATTR_TAG = "tag" XATTR_PROP = "prop" XATTR_BASE = "base" )
const ( // read only file that is on the cloud AM_RO_Remote = 1 // 'open' file that is being appended to on the platform // file is not readable until it is in the 'closed' state // at which point it is set to readonly and AM_RO_Remote AM_AO_Remote = 2 )
Files can be in two access modes: remote-read-only or remote-append-only
const ( PFM_NIL = 1 // No IOs have been seen yet, cache is empty PFM_DETECT_SEQ = 2 // First accesses, detecting if access is sequential PFM_PREFETCH_IN_PROGRESS = 3 // prefetch is ongoing PFM_EOF = 4 // reached the end of the file )
enumerated type for the state of a PFM (file metadata)
const ( IOV_HOLE = 1 // empty IOV_IN_FLIGHT = 2 // in progress IOV_DONE = 3 // completed successfully IOV_ERRORED = 4 // completed with an error )
state of an io-vector
const ( DATA_OUTSIDE_CACHE = 1 // data not in cache DATA_IN_CACHE = 2 // data is in cache DATA_HOLE = 3 // we would have the data if we were doing caching DATA_WAIT = 4 // need to wait for some of the IOs )
const ( KiB = 1024 MiB = 1024 * KiB GiB = 1024 * MiB )
const ( DatabaseFile = "metadata.db" LogFile = "dxfuse.log" )
const ( MinHttpClientPoolSize = 30 FileWriteInactivityThresh = 5 * time.Minute MaxDirSize = 255 * 1000 MaxNumFileHandles = 1000 * 1000 NumRetriesDefault = 10 InitialUploadPartSize = 16 * MiB MaxUploadPartSize = 700 * MiB Version = "v1.4.0" )
const ( InodeInvalid = 0 InodeRoot = fuseops.RootInodeID // This is an OS constant )
const ( // flags for writing files to disk DIRTY_FILES_ALL = 14 // all modified files DIRTY_FILES_INACTIVE = 15 // only files there were unmodified recently )
const ( // Permissions PERM_VIEW = 1 PERM_UPLOAD = 2 PERM_CONTRIBUTE = 3 PERM_ADMINISTER = 4 )
const ( FK_Regular = 10 FK_Applet = 12 FK_Workflow = 13 FK_Record = 14 FK_Database = 15 FK_Other = 16 )
Kinds of files
const (
// A port number for accepting commands
CmdPort = 7205
)
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
1024 => 1KB 10240 => 10KB 1100000 => 1MB
func DxDescribeBulkObjects ¶
func DxFindProject ¶
func DxFindProject( ctx context.Context, dxEnv *dxda.DXEnvironment, projName string) (string, error)
Find the project-id for a project name. Return nil if the project does not exist
func MakeFSBaseDir ¶
func MakeFSBaseDir() string
create a directory for all the dxfuse files in $HOME/.dxfuse
func SecondsToTime ¶
convert time in seconds since 1-Jan 1970, to the equivalent golang structure
func Time2string ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
A cache of all the data retrieved from the platform, for one file. It is a contiguous range of chunks. All IOs are the same size.
type CmdServer ¶
type CmdServer struct {
// contains filtered or unexported fields
}
func NewCmdServer ¶
type CmdServerBox ¶
type CmdServerBox struct {
// contains filtered or unexported fields
}
A separate structure used for exporting through RPC
type DeadFile ¶
type DeadFile struct { Kind int // Kind of object this is Id string // Required to build a download URL ProjId string // Note: this could be a container Inode int64 LocalPath string }
A file that is scheduled for removal
type Dir ¶
type Dir struct { Parent string // the parent directory, used for debugging Dname string // This is the last part of the full path FullPath string // combine parent and dname, then normalize Inode int64 Ctime time.Time // DNAx does not record times per directory. Mtime time.Time // we use the project creation time, and mtime as an approximation. Mode os.FileMode // uint32 Uid uint32 Gid uint32 // extra information, used internally ProjId string ProjFolder string Populated bool // contains filtered or unexported fields }
directories
func (Dir) GetAttrs ¶
func (d Dir) GetAttrs() (a fuseops.InodeAttributes)
type DirtyFileInfo ¶
type DirtyFileInfo struct { Inode int64 // will be "" for files created locally, and not uploaded yet Id string FileSize int64 Mtime int64 LocalPath string Tags []string Properties map[string]string Name string Directory string ProjFolder string ProjId string // contains filtered or unexported fields }
Information required to upload file data to the platform. It also includes updated tags and properties of a data-object.
Not that not only files have attributes, applets and workflows have them too.
type DxDescribeDataObject ¶
type DxDescribeDataObject struct { Id string ProjId string Name string State string ArchivalState string Folder string Size int64 CtimeSeconds int64 MtimeSeconds int64 Tags []string Properties map[string]string }
------------------------------------------------------------------- Description of a DNAx data object
func DxDescribe ¶
func DxDescribe( ctx context.Context, httpClient *http.Client, dxEnv *dxda.DXEnvironment, projectId string, objId string) (DxDescribeDataObject, error)
Describe just one object. Retrieve state even if the object is not closed.
type DxDescribePrj ¶
type DxDescribePrj struct { Id string Name string Region string Version int DataUsageGiB float64 CtimeSeconds int64 MtimeSeconds int64 UploadParams FileUploadParameters Level int // one of VIEW, UPLOAD, CONTRIBUTE, ADMINISTER }
func DxDescribeProject ¶
func DxDescribeProject( ctx context.Context, httpClient *http.Client, dxEnv *dxda.DXEnvironment, projectId string) (*DxDescribePrj, error)
type DxDescribeRaw ¶
type DxDescribeRaw struct { Id string `json:"id"` ProjId string `json:"project"` Name string `json:"name"` State string `json:"state"` ArchivalState string `json:"archivalState"` Folder string `json:"folder"` CreatedMillisec int64 `json:"created"` ModifiedMillisec int64 `json:"modified"` Size int64 `json:"size"` Tags []string `json:"tags"` Properties map[string]string `json:"properties"` }
type DxDescribeRawTop ¶
type DxDescribeRawTop struct {
Describe DxDescribeRaw `json:"describe"`
}
type DxDownloadURL ¶
A URL generated with the /file-xxxx/download API call, that is used to download file ranges.
type DxFolder ¶
type DxFolder struct {
// contains filtered or unexported fields
}
a DNAx directory. It holds files and sub-directories.
type DxListFolder ¶
type DxListFolder struct {
// contains filtered or unexported fields
}
type DxOps ¶
type DxOps struct {
// contains filtered or unexported fields
}
func (*DxOps) DxFileCloseAndWait ¶
func (*DxOps) DxFileUploadPart ¶
func (*DxOps) DxFolderNew ¶
func (*DxOps) DxFolderRemove ¶
func (*DxOps) DxMove ¶
func (ops *DxOps) DxMove( ctx context.Context, httpClient *http.Client, projId string, objectIds []string, folders []string, destination string) error
API method: /class-xxxx/move
Moves the specified data objects and folders to a destination folder in the same container.
func (*DxOps) DxRemoveObjects ¶
func (*DxOps) DxRemoveTags ¶
func (*DxOps) DxRename ¶
func (ops *DxOps) DxRename( ctx context.Context, httpClient *http.Client, projId string, fileId string, newName string) error
API method: /class-xxxx/rename
rename a data object
func (*DxOps) DxRenameFolder ¶
type File ¶
type File struct { Kind int // Kind of object this is Id string // Required to build a download URL ProjId string // Note: this could be a container // One of {open, closing, closed}. // Closed is the only state where the file can be read State string // One of {live, archival, archived, unarchiving}. // Live is the only state where the file can be read. ArchivalState string Name string Size int64 Inode int64 Ctime time.Time Mtime time.Time Mode os.FileMode // uint32 Uid uint32 Gid uint32 // tags and properties Tags []string Properties map[string]string // contains filtered or unexported fields }
A Unix file can stand for any DNAx data object. For example, it could be a workflow or an applet. We distinguish between them based on the Id (file-xxxx, applet-xxxx, workflow-xxxx, ...).
Note: this struct is immutable by convention. The up-to-date data is always on the database, not in memory.
func (File) GetAttrs ¶
func (f File) GetAttrs() (a fuseops.InodeAttributes)
type FileHandle ¶
type FileUpdateReq ¶
type FileUpdateReq struct {
// contains filtered or unexported fields
}
type FileUploadParameters ¶
type FileUploader ¶ added in v1.0.0
type FileUploader struct {
// contains filtered or unexported fields
}
func NewFileUploader ¶ added in v1.0.0
func NewFileUploader(verboseLevel int, options Options, dxEnv dxda.DXEnvironment) *FileUploader
func (*FileUploader) AllocateWriteBuffer ¶ added in v1.0.0
func (uploader *FileUploader) AllocateWriteBuffer(partId int, block bool) []byte
TODO replace this with a more reasonble buffer pool for managing memory use
func (*FileUploader) Shutdown ¶ added in v1.0.0
func (uploader *FileUploader) Shutdown()
type Filesys ¶
type Filesys struct { // inherit empty implementations for all the filesystem // methods we do not implement fuseutil.NotImplementedFileSystem // contains filtered or unexported fields }
func (*Filesys) CreateFile ¶
A CreateRequest asks to create and open a file (not a directory).
func (*Filesys) CreateLink ¶
func (*Filesys) ForgetInode ¶
This may be the wrong way to do it. We may need to actually delete the inode at this point, instead of inside RmDir/Unlink.
func (*Filesys) GetInodeAttributes ¶
func (*Filesys) LookUpInode ¶
func (*Filesys) ReleaseDirHandle ¶
ReleaseDirHandle deletes file handle entry
func (*Filesys) ReleaseFileHandle ¶
func (*Filesys) RemoveXattr ¶
func (*Filesys) SetInodeAttributes ¶
func (fsys *Filesys) SetInodeAttributes(ctx context.Context, op *fuseops.SetInodeAttributesOp) error
if the file is writable, we can modify some of the attributes. otherwise, this is a permission error.
type FindProjectReply ¶
type FindProjectReply struct {
Results []FindResult `json:"results"`
}
type FindProjectRequest ¶
type FindResult ¶
type FindResult struct {
Id string `json:"id"`
}
type IoReq ¶
type IoReq struct {
// contains filtered or unexported fields
}
A request that one of the IO-threads will pick up
type ListFolderRequest ¶
type ListFolderResponse ¶
type MProperties ¶
Marshal a DNAx object properties to/from a string that is stored in a database table. We use base64 encoding for the same reason as tags (see above).
type MTags ¶
type MTags struct {
Elements []string `json:"elements"`
}
Marshal a DNAx object tags to/from a string that is stored in a database table.
We use base64 encoding to avoid problematic characters (`) when putting this string into SQL statements
type Manifest ¶
type Manifest struct { Files []ManifestFile `json:"files"` Directories []ManifestDir `json:"directories"` }
func ReadManifest ¶
read the manifest from a file into a memory structure
func (*Manifest) DirSkeleton ¶
Figure out the directory structure needed to support the leaf nodes. For example, if we need to create:
["/A/B/C", "/D", "/D/E"]
then the skeleton is:
["/A", "/A/B", "/D"]
The root directory is not reported in the skeleton.
func (*Manifest) FillInMissingFields ¶
type ManifestDir ¶
type ManifestFile ¶
type ManifestFile struct { ProjId string `json:"proj_id"` FileId string `json:"file_id"` Parent string `json:"parent"` // These may not be provided by the user. Then, we // need to query DNAx for the information. State string `json:"state,omitempty"` ArchivalState string `json:"archivalState,omitempty"` Fname string `json:"fname,omitempty"` Size int64 `json:"size,omitempty"` CtimeSeconds int64 `json:"ctime,omitempty"` MtimeSeconds int64 `json:"mtime,omitempty"` }
type MeasureWindow ¶
type MeasureWindow struct {
// contains filtered or unexported fields
}
type MetadataDb ¶
type MetadataDb struct {
// contains filtered or unexported fields
}
func NewMetadataDb ¶
func NewMetadataDb( dbFullPath string, dxEnv dxda.DXEnvironment, options Options) (*MetadataDb, error)
func (*MetadataDb) CreateDir ¶
func (mdb *MetadataDb) CreateDir( oph *OpHandle, projId string, projFolder string, ctime int64, mtime int64, mode os.FileMode, dirPath string) (int64, error)
Assumption: the directory does not already exist in the database.
func (*MetadataDb) CreateFile ¶
func (mdb *MetadataDb) CreateFile( ctx context.Context, oph *OpHandle, dir *Dir, fname string, mode os.FileMode) (File, error)
We know that the parent directory exists, is populated, and the file does not exist
func (*MetadataDb) DirtyFilesGetAndReset ¶
func (mdb *MetadataDb) DirtyFilesGetAndReset(flag int) ([]DirtyFileInfo, error)
Get a list of all the dirty files, and reset the table. The files can be modified again, which will set the flag to true.
func (*MetadataDb) Init ¶
func (mdb *MetadataDb) Init() error
construct an initial empty database, representing an entire project.
func (*MetadataDb) LookupByInode ¶
func (mdb *MetadataDb) LookupByInode(ctx context.Context, oph *OpHandle, inode int64) (Node, bool, error)
search for a file with a particular inode.
func (*MetadataDb) LookupDirByInode ¶
func (*MetadataDb) LookupInDir ¶
func (mdb *MetadataDb) LookupInDir(ctx context.Context, oph *OpHandle, dir *Dir, dirOrFileName string) (Node, bool, error)
Search for a file/subdir in a directory Look for file [filename] in directory [parent]/[dname].
1. Look if the directory has already been downloaded and placed in the DB 2. If not, populate it 3. Do a lookup in the directory.
Note: the file might not exist.
func (*MetadataDb) MoveDir ¶
func (mdb *MetadataDb) MoveDir( ctx context.Context, oph *OpHandle, oldParentDir Dir, newParentDir Dir, oldDir Dir, newName string) error
As a running example:
say we have a directory structure: A ├── fruit │ ├── grapes.txt │ └── melon.txt ├── X.txt └── Y.txt
We also have: D └── K
From the shell we issue the command: $ mv A D/K/
func (*MetadataDb) MoveFile ¶
func (mdb *MetadataDb) MoveFile( ctx context.Context, oph *OpHandle, inode int64, newParentDir Dir, newName string) error
Move a file
- Can move a file from one directory to another, or leave it in the same directory
- Can change the filename.
func (*MetadataDb) PopulateRoot ¶
Build a toplevel directory for each project.
func (*MetadataDb) ReadDirAll ¶
func (mdb *MetadataDb) ReadDirAll(ctx context.Context, oph *OpHandle, dir *Dir) (map[string]File, map[string]Dir, error)
Add a directory with its contents to an exisiting database
func (*MetadataDb) RemoveEmptyDir ¶
func (mdb *MetadataDb) RemoveEmptyDir(oph *OpHandle, inode int64) error
Remove a directory from the database
func (*MetadataDb) Shutdown ¶
func (mdb *MetadataDb) Shutdown()
func (*MetadataDb) Unlink ¶
TODO: take into account the case of ForgetInode, and files that are open, but unlinked.
on this file system, since we don't keep track of link count, this amount to removing the file.
func (*MetadataDb) UpdateClosedFileMetadata ¶ added in v1.0.0
func (*MetadataDb) UpdateFileAttrs ¶
func (*MetadataDb) UpdateFileLocalPath ¶
func (*MetadataDb) UpdateFileTagsAndProperties ¶
func (*MetadataDb) UpdateInodeFileId ¶
func (mdb *MetadataDb) UpdateInodeFileId(inode int64, fileId string) error
We wrote a new version of this file, creating a new file-id.
type MoveRecord ¶
type MoveRecord struct {
// contains filtered or unexported fields
}
type Node ¶
type Node interface { GetInode() fuseops.InodeID GetAttrs() fuseops.InodeAttributes }
A node is a generalization over files and directories
type OpHandle ¶
type OpHandle struct {
// contains filtered or unexported fields
}
A handle used when operating on a filesystem operation. We normally need a transaction and an http client.
func (*OpHandle) RecordError ¶
type Posix ¶
type Posix struct {
// contains filtered or unexported fields
}
func (*Posix) FixDir ¶
main entry point
1. Keep directory names fixed 2. Change file names to not collide with directories, or with each other.
func (*Posix) SortObjectsByCtime ¶ added in v0.24.0
func (px *Posix) SortObjectsByCtime(dxObjs []DxDescribeDataObject) []DxDescribeDataObject
pick all the objects with "name" from the list. Return an empty array if none exist. Sort them from newest to oldest.
type PosixDir ¶
type PosixDir struct {
// contains filtered or unexported fields
}
Try to fix a DNAx directory, so it will adhere to POSIX.
If several files share the same name, make them unique by moving into an extra subdirectory. For example:
src name file-id new name X.txt file-0001 X.txt X.txt file-0005 1/X.txt X.txt file-0012 2/X.txt
2. DNAx files can include slashes. Drop these files, with a put note in the log.
A directory and a file can have the same name. For example: ROOT/ zoo/ sub-directory zoo regular file
Is converted into: ROOT zoo/ sub-directory 1/ faux sub-directory zoo regular file
type PrefetchFileMetadata ¶
type PrefetchFileMetadata struct {
// contains filtered or unexported fields
}
type PrefetchGlobalState ¶
type PrefetchGlobalState struct {
// contains filtered or unexported fields
}
global limits
func NewPrefetchGlobalState ¶
func NewPrefetchGlobalState(verboseLevel int, dxEnv dxda.DXEnvironment) *PrefetchGlobalState
func (*PrefetchGlobalState) CacheLookup ¶
func (pgs *PrefetchGlobalState) CacheLookup(hid fuseops.HandleID, startOfs int64, endOfs int64, data []byte) int
This is done on behalf of a user read request. If this range has been prefetched, copy the data. Return how much data was copied. Return zero length if the data isn't in cache.
func (*PrefetchGlobalState) CreateStreamEntry ¶
func (pgs *PrefetchGlobalState) CreateStreamEntry(hid fuseops.HandleID, f File, url DxDownloadURL)
func (*PrefetchGlobalState) DownloadEntireFile ¶
func (pgs *PrefetchGlobalState) DownloadEntireFile( client *http.Client, inode int64, size int64, url DxDownloadURL, fd *os.File, localPath string) error
Download an entire file, and write it to disk.
func (*PrefetchGlobalState) RemoveStreamEntry ¶
func (pgs *PrefetchGlobalState) RemoveStreamEntry(hid fuseops.HandleID)
func (*PrefetchGlobalState) Shutdown ¶
func (pgs *PrefetchGlobalState) Shutdown()
type Reply ¶
type Reply struct {
Results []DxDescribeRawTop `json:"results"`
}
type ReplyAddTags ¶
type ReplyAddTags struct {
Id string `json:"id"`
}
type ReplyClone ¶
type ReplyDescribeProject ¶
type ReplyDescribeProject struct { Id string `json:"id"` Name string `json:"name"` Region string `json:"region"` Version int `json:"version"` DataUsage float64 `json:"dataUsage"` CreatedMillisec int64 `json:"created"` ModifiedMillisec int64 `json:"modified"` UploadParams FileUploadParameters `json:"fileUploadParameters"` Level string `json:"level"` }
type ReplyFolderNew ¶
type ReplyFolderNew struct {
Id string `json:"id"`
}
type ReplyFolderRemove ¶
type ReplyFolderRemove struct {
Id string `json:"id"`
}
type ReplyNewFile ¶
type ReplyNewFile struct {
Id string `json:"id"`
}
type ReplyRemoveObjects ¶
type ReplyRemoveObjects struct {
Id string `json:"id"`
}
type ReplyRemoveTags ¶
type ReplyRemoveTags struct {
Id string `json:"id"`
}
type ReplyRename ¶
type ReplyRename struct {
Id string `json:"id"`
}
type ReplyRenameFolder ¶
type ReplyRenameFolder struct {
Id string `json:"id"`
}
type ReplySetProperties ¶
type ReplySetProperties struct {
Id string `json:"id"`
}
type ReplyUploadChunk ¶
type RequestAddTags ¶
type RequestClone ¶
type RequestDescribeProject ¶
type RequestFolderNew ¶
type RequestFolderRemove ¶
type RequestMove ¶
type RequestNewFile ¶
type RequestRemoveObjects ¶
type RequestRemoveTags ¶
type RequestRename ¶
type RequestRenameFolder ¶
type RequestSetProperties ¶
type RequestUploadChunk ¶
type RequestWithScope ¶ added in v0.22.2
type SyncDbDx ¶
type SyncDbDx struct {
// contains filtered or unexported fields
}
func NewSyncDbDx ¶
func NewSyncDbDx( options Options, dxEnv dxda.DXEnvironment, projId2Desc map[string]DxDescribePrj, mdb *MetadataDb, mutex *sync.Mutex) *SyncDbDx
type UploadRequest ¶ added in v1.0.0
type UploadRequest struct {
// contains filtered or unexported fields
}