fs

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugTrace = false
)
View Source
const (
	UnmountFlag = syscall.MNT_FORCE | syscall.MNT_DETACH
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ByAccessTime

type ByAccessTime []*TraceItem

func (ByAccessTime) Len

func (b ByAccessTime) Len() int

func (ByAccessTime) Less

func (b ByAccessTime) Less(i, j int) bool

func (ByAccessTime) Swap

func (b ByAccessTime) Swap(i, j int)

type ByAccessTimeOptimized

type ByAccessTimeOptimized []*OptimizedTraceItem

func (ByAccessTimeOptimized) Len

func (bo ByAccessTimeOptimized) Len() int

func (ByAccessTimeOptimized) Less

func (bo ByAccessTimeOptimized) Less(i, j int) bool

func (ByAccessTimeOptimized) Swap

func (bo ByAccessTimeOptimized) Swap(i, j int)

type ImageManager

type ImageManager interface {
	GetPathByStack(stack int64) string
	GetPathBySerial(stack int64) string
	LookUpFile(stack int64, filename string) ReceivedFile
	LogTrace(stack int64, filename string, access, complete time.Time)
}

type Instance

type Instance struct {
	Root ReceivedFile
	// contains filtered or unexported fields
}

Instance should be created using

func NewInstance

func NewInstance(ctx context.Context, m ImageManager, root ReceivedFile, stack int64, dir string, options *fs.Options, debug bool) (fi *Instance, err error)

func (*Instance) GetMountPoint

func (fi *Instance) GetMountPoint() string

func (*Instance) GetServer

func (fi *Instance) GetServer() *fuse.Server

func (*Instance) Serve

func (fi *Instance) Serve()

func (*Instance) Teardown

func (fi *Instance) Teardown() error

Teardown unmounts the file system and close the logging file if there is one writing should you need this function, please consider using Manager.Teardown instead.

type OptimizedGroup

type OptimizedGroup struct {
	History []*OptimizedTraceItem `json:"h"`
	Images  []string              `json:"i"`
}

type OptimizedTraceItem

type OptimizedTraceItem struct {
	TraceItem
	Rank        int `json:"rank"`
	SourceImage int `json:"img"`
}

OptimizedTraceItem with ranking

func (OptimizedTraceItem) Key

func (oti OptimizedTraceItem) Key() string

type ReceivedFile

type ReceivedFile interface {
	GetChildren() []ReceivedFile
	AppendChild(children ReceivedFile)
	IsReady() bool
	GetAttr(out *fuse.Attr) syscall.Errno
	GetXAttrs() map[string][]byte
	GetName() string
	GetStableAttr() *fs.StableAttr
	GetLinkName() string
	GetRealPath() string
	WaitForReady()

	// IsReferencingRequestedImage returns stack number where the actual content located
	// if the file is available in the local filesystem then yes is false
	IsReferencingRequestedImage() (stack int64, yes bool)

	// IsReferencingLocalFilesystem can not return true if IsReferencingRequestedImage returns true
	IsReferencingLocalFilesystem() (serial int64, yes bool)
}

type StarlightFsNode

type StarlightFsNode struct {
	fs.Inode
	ReceivedFile
	// contains filtered or unexported fields
}

func (*StarlightFsNode) Fsync

func (n *StarlightFsNode) Fsync(ctx context.Context, f fs.FileHandle, flags uint32) syscall.Errno

func (*StarlightFsNode) Getattr

func (n *StarlightFsNode) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno

func (*StarlightFsNode) Getxattr

func (n *StarlightFsNode) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno)

func (*StarlightFsNode) Listxattr

func (n *StarlightFsNode) Listxattr(ctx context.Context, dest []byte) (uint32, syscall.Errno)

func (*StarlightFsNode) Lookup

func (n *StarlightFsNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*StarlightFsNode) Open

func (*StarlightFsNode) Readdir

func (n *StarlightFsNode) Readlink(ctx context.Context) ([]byte, syscall.Errno)

type TraceCollection

type TraceCollection struct {
	Groups []*OptimizedGroup
	// contains filtered or unexported fields
}

func NewTraceCollection

func NewTraceCollection(ctx context.Context, p string) (*TraceCollection, error)

NewTraceCollection create a new trace collection with multiple optimize groups

func NewTraceCollectionFromBuffer

func NewTraceCollectionFromBuffer(buf io.ReadCloser) (*TraceCollection, error)

func (TraceCollection) ToJSONBuffer

func (tc TraceCollection) ToJSONBuffer() []byte

type TraceItem

type TraceItem struct {
	FileName string        `json:"f"`
	Stack    int64         `json:"s"`
	Access   time.Duration `json:"a"`
	Wait     time.Duration `json:"w"`
}

type Tracer

type Tracer struct {

	// label could be the name of the application or the workload.
	// Different workload might have
	OptimizeGroup string    `json:"group"`
	Image         string    `json:"image"`
	StartTime     time.Time `json:"start"`
	EndTime       time.Time `json:"end"`

	Seq []*TraceItem `json:"seq"`
	// contains filtered or unexported fields
}

Tracer collects filesystem access traces. It should belongs to a manager.

func NewTracer

func NewTracer(ctx context.Context, optimizeGroup, digest, outputDir string) (*Tracer, error)

func (*Tracer) Close

func (t *Tracer) Close() (time.Duration, error)

func (*Tracer) Log

func (t *Tracer) Log(fileName string, stack int64, accessTime, completeTime time.Time)

Jump to

Keyboard shortcuts

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