internal

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 18, 2017 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

System permissions-related code.

Index

Constants

View Source
const BUF_SIZE = 5 * 1024 * 1024
View Source
const MAX_READAHEAD = uint32(100 * 1024 * 1024)
View Source
const READAHEAD_CHUNK = uint32(20 * 1024 * 1024)

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(name string) *logHandle

func GetStdLogger

func GetStdLogger(l *logHandle, lvl logrus.Level) *glog.Logger

func InitLoggers added in v0.0.3

func InitLoggers(logToSyslog bool)

func MassageMountFlags added in v0.0.3

func MassageMountFlags(args []string) (ret []string)

func MaxInt added in v0.0.4

func MaxInt(a, b int) int

func MaxUInt32 added in v0.0.11

func MaxUInt32(a, b uint32) uint32

func MaxUInt64 added in v0.0.4

func MaxUInt64(a, b uint64) uint64

func MinInt added in v0.0.4

func MinInt(a, b int) int

func MinUInt32 added in v0.0.11

func MinUInt32(a, b uint32) uint32

func MinUInt64 added in v0.0.4

func MinUInt64(a, b uint64) uint64

func MyUserAndGroup

func MyUserAndGroup() (uid int, gid int)

Return the UID and GID of this process.

func NewApp

func NewApp() (app *cli.App)

func NewLogger

func NewLogger(name string) *logHandle

func SignV2 added in v0.0.4

func SignV2(req *request.Request)

Sign requests with signature version 2.

Will sign the requests with the service config's Credentials object Signing is skipped if the credentials is the credentials.AnonymousCredentials object.

Types

type Buffer added in v0.0.4

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

func (*Buffer) Close added in v0.0.4

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

func (Buffer) Init added in v0.0.4

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

func (*Buffer) Read added in v0.0.4

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 added in v0.0.7

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

func (BufferPool) Init added in v0.0.4

func (pool BufferPool) Init() *BufferPool

func (*BufferPool) MaybeGC added in v0.0.6

func (pool *BufferPool) MaybeGC()

func (*BufferPool) RequestBuffer added in v0.0.7

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

func (*BufferPool) RequestMultiple added in v0.0.7

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

type DirHandle

type DirHandle struct {
	Entries     []fuseutil.Dirent
	NameToEntry map[string]fuseops.InodeAttributes // XXX use a smaller struct
	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(fs *Goofys, offset fuseops.DirOffset) (*fuseutil.Dirent, error)

LOCKS_REQUIRED(dh.mu)

type FileHandle

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

func NewFileHandle

func NewFileHandle(in *Inode) *FileHandle

func (*FileHandle) FlushFile

func (fh *FileHandle) FlushFile(fs *Goofys) (err error)

func (*FileHandle) ReadFile

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

func (*FileHandle) Release added in v0.0.4

func (fh *FileHandle) Release()

func (*FileHandle) WriteFile

func (fh *FileHandle) WriteFile(fs *Goofys, offset int64, data []byte) (err error)

type FlagStorage

type FlagStorage struct {
	// File system
	MountOptions map[string]string
	DirMode      os.FileMode
	FileMode     os.FileMode
	Uid          uint32
	Gid          uint32

	// S3
	Endpoint       string
	Region         string
	RegionSet      bool
	StorageClass   string
	Profile        string
	UseContentType bool
	UseSSE         bool
	UseKMS         bool
	KMSKeyID       string
	ACL            string

	// Tuning
	Cheap        bool
	StatCacheTTL time.Duration
	TypeCacheTTL time.Duration

	// Debugging
	DebugFuse  bool
	DebugS3    bool
	Foreground bool
}

func PopulateFlags

func PopulateFlags(c *cli.Context) (flags *FlagStorage)

Add the flags accepted by run to the supplied flag set, returning the variables into which the flags will parse.

type Goofys

type Goofys struct {
	fuseutil.NotImplementedFileSystem
	// contains filtered or unexported fields
}

func NewGoofys

func NewGoofys(bucket string, awsConfig *aws.Config, flags *FlagStorage) *Goofys

func (*Goofys) CreateFile

func (fs *Goofys) CreateFile(
	ctx context.Context,
	op *fuseops.CreateFileOp) (err error)

func (*Goofys) FlushFile

func (fs *Goofys) FlushFile(
	ctx context.Context,
	op *fuseops.FlushFileOp) (err error)

func (*Goofys) ForgetInode

func (fs *Goofys) ForgetInode(
	ctx context.Context,
	op *fuseops.ForgetInodeOp) (err error)

LOCKS_EXCLUDED(fs.mu)

func (*Goofys) GetInodeAttributes

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

func (*Goofys) LookUpInode

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

func (*Goofys) LookUpInodeDir

func (fs *Goofys) LookUpInodeDir(name string, c chan s3.ListObjectsOutput, errc chan error)

func (*Goofys) LookUpInodeMaybeDir

func (fs *Goofys) LookUpInodeMaybeDir(name string, fullName string) (inode *Inode, err error)

returned inode has nil Id

func (*Goofys) LookUpInodeNotDir

func (fs *Goofys) LookUpInodeNotDir(name string, c chan s3.HeadObjectOutput, errc chan error)

func (*Goofys) MkDir

func (fs *Goofys) MkDir(
	ctx context.Context,
	op *fuseops.MkDirOp) (err error)

func (*Goofys) OpenDir

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

func (*Goofys) OpenFile

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

func (*Goofys) ReadDir

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

LOCKS_EXCLUDED(fs.mu)

func (*Goofys) ReadFile

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

func (*Goofys) ReleaseDirHandle

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

func (*Goofys) ReleaseFileHandle

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

func (*Goofys) Rename

func (fs *Goofys) Rename(
	ctx context.Context,
	op *fuseops.RenameOp) (err error)

func (*Goofys) RmDir

func (fs *Goofys) RmDir(
	ctx context.Context,
	op *fuseops.RmDirOp) (err error)

func (*Goofys) SetInodeAttributes

func (fs *Goofys) SetInodeAttributes(
	ctx context.Context,
	op *fuseops.SetInodeAttributesOp) (err error)

func (*Goofys) StatFS

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

func (*Goofys) SyncFile

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

func (*Goofys) WriteFile

func (fs *Goofys) WriteFile(
	ctx context.Context,
	op *fuseops.WriteFileOp) (err error)

type Inode

type Inode struct {
	Id       fuseops.InodeID
	Name     *string
	FullName *string

	Attributes *fuseops.InodeAttributes
	KnownSize  *uint64
	Invalid    bool
	AttrTime   time.Time

	Metadata map[string]*string
	// contains filtered or unexported fields
}

func NewInode

func NewInode(name *string, fullName *string, flags *FlagStorage) (inode *Inode)

func (*Inode) Create

func (parent *Inode) Create(
	fs *Goofys,
	name string) (inode *Inode, fh *FileHandle)

func (*Inode) DeRef

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

LOCKS_REQUIRED(fs.mu)

func (*Inode) GetAttributes

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

func (*Inode) LookUp

func (parent *Inode) LookUp(fs *Goofys, name string) (inode *Inode, err error)

func (*Inode) MkDir

func (parent *Inode) MkDir(
	fs *Goofys,
	name string) (inode *Inode, err error)

func (*Inode) OpenDir

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

func (*Inode) OpenFile

func (inode *Inode) OpenFile(fs *Goofys) *FileHandle

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) Rename

func (parent *Inode) Rename(fs *Goofys, from string, newParent *Inode, to string) (err error)

func (*Inode) RmDir

func (parent *Inode) RmDir(
	fs *Goofys,
	name string) (err error)
func (parent *Inode) Unlink(fs *Goofys, name string) (err error)

type MBuf added in v0.0.4

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

func (*MBuf) Free added in v0.0.4

func (mb *MBuf) Free()

func (*MBuf) Full added in v0.0.7

func (mb *MBuf) Full() bool

func (MBuf) Init added in v0.0.4

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

func (*MBuf) Read added in v0.0.4

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

func (*MBuf) Seek added in v0.0.7

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

seek only seeks the reader

func (*MBuf) Write added in v0.0.7

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

func (*MBuf) WriteFrom added in v0.0.4

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

type ReaderProvider added in v0.0.4

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

type S3ReadBuffer added in v0.0.4

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

func (S3ReadBuffer) Init added in v0.0.4

func (b S3ReadBuffer) Init(fs *Goofys, fh *FileHandle, offset uint64, size uint32) *S3ReadBuffer

func (*S3ReadBuffer) Read added in v0.0.4

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

type Ticket added in v0.0.7

type Ticket struct {
	Total uint32
	// contains filtered or unexported fields
}

func (Ticket) Init added in v0.0.7

func (ticket Ticket) Init() *Ticket

func (*Ticket) Return added in v0.0.7

func (ticket *Ticket) Return(howmany uint32)

func (*Ticket) Take added in v0.0.7

func (ticket *Ticket) Take(howmany uint32, block bool) (took bool)

Jump to

Keyboard shortcuts

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