fuseralib

package
v0.0.0-...-d6499d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const BufSize = 5 * 1024 * 1024
View Source
const MaxReadAhead = uint32(100 * 1024 * 1024)
View Source
const ReadAheadChunk = uint32(20 * 1024 * 1024)

Variables

This section is empty.

Functions

func MaxUInt64

func MaxUInt64(a, b uint64) uint64

func TryUnmount

func TryUnmount(mountPoint string) (err error)

Types

type API

type API interface {
	Retrieve(accession string) (*Accession, error)
	RetrieveAll() ([]*Accession, error)
	Sign(accession string) (*Accession, error)
	SignAll() ([]*Accession, error)
	SignAllInBatch(batch int) ([]*Accession, error)
	AddIdent(link string) (string, error)
}

API Describes the functions fuseralib needs in order to properly interact with the SDL API.

type Accession

type Accession struct {
	ID string `json:"accession,omitempty"`

	Files map[string]File `json:"files,omitempty"`
	// contains filtered or unexported fields
}

func FetchAccessions

func FetchAccessions(api API, accessions []string, batch int) ([]*Accession, error)

FetchAccessions A convenience function to serve the specific behavior of first calling the SDL API on start up.

func (*Accession) AppendError

func (a *Accession) AppendError(message string)

func (*Accession) ErrorLog

func (a *Accession) ErrorLog() string

func (*Accession) HasError

func (a *Accession) HasError() bool

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

func (*Buffer) Close

func (b *Buffer) Close() (err error)

func (Buffer) Init

func (b Buffer) Init(buf *MBuf, r ReaderProvider) *Buffer

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (n int, err error)

type BufferPool

type BufferPool struct {
	// contains filtered or unexported fields
}

func NewBufferPool

func NewBufferPool(maxSizeGlobal uint64) *BufferPool

for testing

func (*BufferPool) Free

func (pool *BufferPool) Free(buf []byte)

func (BufferPool) Init

func (pool BufferPool) Init() *BufferPool

func (*BufferPool) MaybeGC

func (pool *BufferPool) MaybeGC()

func (*BufferPool) RequestBuffer

func (pool *BufferPool) RequestBuffer() (buf []byte)

func (*BufferPool) RequestMultiple

func (pool *BufferPool) RequestMultiple(size uint64, block bool) (buffers [][]byte)

type DirHandle

type DirHandle struct {
	Entries    []*DirHandleEntry
	Marker     *string
	BaseOffset int
	// contains filtered or unexported fields
}

func NewDirHandle

func NewDirHandle(inode *Inode) (dh *DirHandle)

func (*DirHandle) CloseDir

func (dh *DirHandle) CloseDir() error

func (*DirHandle) ReadDir

func (dh *DirHandle) ReadDir(offset fuseops.DirOffset) (en *DirHandleEntry, err error)

LOCKS_REQUIRED(dh.mu)

type DirHandleEntry

type DirHandleEntry struct {
	Name   *string
	Inode  fuseops.InodeID
	Type   fuseutil.DirentType
	Offset fuseops.DirOffset

	Attributes   *InodeAttributes
	ETag         *string
	StorageClass *string
}

type DirInodeData

type DirInodeData struct {
	DirTime time.Time

	Children []*Inode
	// contains filtered or unexported fields
}

type File

type File struct {
	Name           string    `json:"name,omitempty"`
	Size           uint64    `json:"size,omitempty"`
	Type           string    `json:"type,omitempty"`
	ModifiedDate   time.Time `json:"modificationDate,omitempty"`
	Md5Hash        string    `json:"md5,omitempty"`
	Link           string    `json:"link,omitempty"`
	ExpirationDate time.Time `json:"expirationDate,omitempty"`
	Bucket         string    `json:"bucket,omitempty"`
	Key            string    `json:"key,omitempty"`
	Service        string    `json:"service,omitempty"`
	Region         string    `json:"region,omitempty"`
	PayRequired    bool      `json:"payRequired,omitempty"`
	CeRequired     bool      `json:"ceRequired,omitempty"`
}

type FileHandle

type FileHandle struct {
	// contains filtered or unexported fields
}

func NewFileHandle

func NewFileHandle(in *Inode) *FileHandle

func (*FileHandle) ReadFile

func (fh *FileHandle) ReadFile(offset int64, buf []byte) (bytesRead int, err error)

func (*FileHandle) Release

func (fh *FileHandle) Release()

type Fusera

type Fusera struct {
	fuseutil.NotImplementedFileSystem

	DirMode  os.FileMode
	FileMode os.FileMode
	// contains filtered or unexported fields
}

func Mount

func Mount(ctx context.Context, opt *Options) (*Fusera, *fuse.MountedFileSystem, error)

Mount the file system based on the supplied arguments, returning a fuse.MountedFileSystem that can be joined to wait for unmounting.

func NewFusera

func NewFusera(ctx context.Context, opt *Options) (*Fusera, error)

func (*Fusera) GetInodeAttributes

func (fs *Fusera) GetInodeAttributes(ctx context.Context, op *fuseops.GetInodeAttributesOp) (err error)

func (*Fusera) GetXattr

func (fs *Fusera) GetXattr(ctx context.Context, op *fuseops.GetXattrOp) (err error)

func (*Fusera) ListXattr

func (fs *Fusera) ListXattr(ctx context.Context, op *fuseops.ListXattrOp) (err error)

func (*Fusera) LookUpInode

func (fs *Fusera) LookUpInode(ctx context.Context, op *fuseops.LookUpInodeOp) (err error)

func (*Fusera) OpenDir

func (fs *Fusera) OpenDir(ctx context.Context, op *fuseops.OpenDirOp) (err error)

func (*Fusera) OpenFile

func (fs *Fusera) OpenFile(ctx context.Context, op *fuseops.OpenFileOp) (err error)

func (*Fusera) ReadDir

func (fs *Fusera) ReadDir(ctx context.Context, op *fuseops.ReadDirOp) (err error)

LOCKS_EXCLUDED(fs.mu)

func (*Fusera) ReadFile

func (fs *Fusera) ReadFile(ctx context.Context, op *fuseops.ReadFileOp) (err error)

func (*Fusera) ReleaseDirHandle

func (fs *Fusera) ReleaseDirHandle(ctx context.Context, op *fuseops.ReleaseDirHandleOp) (err error)

func (*Fusera) ReleaseFileHandle

func (fs *Fusera) ReleaseFileHandle(ctx context.Context, op *fuseops.ReleaseFileHandleOp) (err error)

func (*Fusera) SigUsr1

func (fs *Fusera) SigUsr1()

func (*Fusera) StatFS

func (fs *Fusera) StatFS(ctx context.Context, op *fuseops.StatFSOp) (err error)

func (*Fusera) SyncFile

func (fs *Fusera) SyncFile(ctx context.Context, op *fuseops.SyncFileOp) (err error)

type Inode

type Inode struct {
	ID          fuseops.InodeID
	Name        *string
	Link        string
	Acc         string
	ErrContents string

	Attributes InodeAttributes
	KnownSize  *uint64
	AttrTime   time.Time
	ReqPays    bool
	Bucket     string
	Key        string
	Region     string
	CeRequired bool

	Parent *Inode

	Invalid     bool
	ImplicitDir bool
	// contains filtered or unexported fields
}

func NewInode

func NewInode(fs *Fusera, parent *Inode, name *string, fullName *string) (inode *Inode)

func (*Inode) DeRef

func (inode *Inode) DeRef(n uint64) (stale bool)

LOCKS_REQUIRED(fs.mu)

func (*Inode) FullName

func (inode *Inode) FullName() *string

func (*Inode) GetAttributes

func (inode *Inode) GetAttributes() (*fuseops.InodeAttributes, error)

func (*Inode) GetXattr

func (inode *Inode) GetXattr(name string) ([]byte, error)

func (*Inode) InflateAttributes

func (inode *Inode) InflateAttributes() (attr fuseops.InodeAttributes)

func (*Inode) ListXattr

func (inode *Inode) ListXattr() ([]string, error)

func (*Inode) OpenDir

func (inode *Inode) OpenDir() (dh *DirHandle)

func (*Inode) OpenFile

func (inode *Inode) OpenFile() (fh *FileHandle, err error)

func (*Inode) Ref

func (inode *Inode) Ref()

LOCKS_REQUIRED(fs.mu) XXX why did I put lock required? This used to return a resurrect bool which no long does anything, need to look into that to see if that was legacy

func (*Inode) ToDir

func (inode *Inode) ToDir()

type InodeAttributes

type InodeAttributes struct {
	Size           uint64
	Mtime          time.Time
	ExpirationDate time.Time
}

type MBuf

type MBuf struct {
	// contains filtered or unexported fields
}

func (*MBuf) Free

func (mb *MBuf) Free()

func (*MBuf) Full

func (mb *MBuf) Full() bool

func (MBuf) Init

func (mb MBuf) Init(h *BufferPool, size uint64, block bool) *MBuf

func (*MBuf) Read

func (mb *MBuf) Read(p []byte) (n int, err error)

func (*MBuf) Seek

func (mb *MBuf) Seek(offset int64, whence int) (int64, error)

seek only seeks the reader

func (*MBuf) Write

func (mb *MBuf) Write(p []byte) (n int, err error)

func (*MBuf) WriteFrom

func (mb *MBuf) WriteFrom(r io.Reader) (n int, err error)

type Options

type Options struct {
	// The file used to authenticate with the SRA Data Locator API
	API          API
	Acc          []*Accession
	Region       string
	CloudProfile string

	// File system
	MountOptions      map[string]string
	MountPoint        string
	MountPointArg     string
	MountPointCreated string

	Cache []string
	UID   uint32
	GID   uint32

	// // Debugging
	Debug bool
}

Options is a collection of values that describe how Fusera should behave.

type ReaderProvider

type ReaderProvider func() (io.ReadCloser, error)

type S3ReadBuffer

type S3ReadBuffer struct {
	// contains filtered or unexported fields
}

func (*S3ReadBuffer) Read

func (b *S3ReadBuffer) Read(offset uint64, p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL