fusestream

package
v0.0.0-...-394d779 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogging

func InitLogging(level zerolog.Level)

func SetupOTelSDK

func SetupOTelSDK(exporter sdktrace.SpanExporter)

Types

type Fault

type Fault struct {
	ReturnCode    *int64
	Err           *error
	DelayDuration *time.Duration
}

func (*Fault) AppendTrace

func (f *Fault) AppendTrace(e *zerolog.Event) *zerolog.Event

func (*Fault) Delay

func (f *Fault) Delay()

func (*Fault) FromFuse

func (f *Fault) FromFuse(s *FuseFault)

func (*Fault) FromNbd

func (f *Fault) FromNbd(s *NbdFault)

func (*Fault) HasValue

func (f *Fault) HasValue() bool

func (*Fault) MayReplaceError

func (f *Fault) MayReplaceError(err error) error

func (*Fault) MayReplaceErrorCode

func (f *Fault) MayReplaceErrorCode(rc int64) int64

type FaultExecute

type FaultExecute interface {
	Delay()
	MayReplaceErrorCode(rc int64) int64
	MayReplaceError(err error) error
}

type FaultManager

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

func NewFaultManager

func NewFaultManager() *FaultManager

func (*FaultManager) DeleteAll

func (f *FaultManager) DeleteAll() []int32

func (*FaultManager) DeleteByID

func (f *FaultManager) DeleteByID(ids []int32) []int32

func (*FaultManager) DeleteByPathRegex

func (f *FaultManager) DeleteByPathRegex(pathRe string) []int32

func (*FaultManager) FuseInject

func (f *FaultManager) FuseInject(s *FuseFault) int32

func (*FaultManager) GetFuseFault

func (f *FaultManager) GetFuseFault(path string, op pb.FuseOp) FaultExecute

func (*FaultManager) GetNbdFault

func (f *FaultManager) GetNbdFault(op pb.NbdOp, offset int64, len int) FaultExecute

func (*FaultManager) ListFaults

func (f *FaultManager) ListFaults() ([]*FuseFault, []*NbdFault)

func (*FaultManager) NbdInject

func (f *FaultManager) NbdInject(s *NbdFault) int32

type FileBackend

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

func NewFileBackend

func NewFileBackend(file *os.File, faults *FaultManager) *FileBackend

func (*FileBackend) ReadAt

func (f *FileBackend) ReadAt(p []byte, off int64) (n int, err error)

func (*FileBackend) Size

func (f *FileBackend) Size() (size int64, err error)

func (*FileBackend) Sync

func (f *FileBackend) Sync() (err error)

func (*FileBackend) WriteAt

func (f *FileBackend) WriteAt(p []byte, off int64) (n int, err error)

type FuseFault

type FuseFault struct {
	ID     int32
	PathRe string
	Op     pb.FuseOp

	ReturnValue            *int32
	ReturnValuePossibility float32

	Delay            *time.Duration
	DelayPossibility float32
}

func (*FuseFault) Clone

func (f *FuseFault) Clone() *FuseFault

type FuseFaultKey

type FuseFaultKey struct {
	Path string
	Op   pb.FuseOp
}

type IORecord

type IORecord struct {
	Name        string
	StartTimeNs int64
	ElapsedNs   int64
	Offset      int64
	Length      int32
	Path        string
}

func NewIORecord

func NewIORecord(span sdktrace.ReadOnlySpan) IORecord

func (*IORecord) FromAttributes

func (r *IORecord) FromAttributes(attrs []attribute.KeyValue)

type NbdFault

type NbdFault struct {
	ID int32
	Op pb.NbdOp

	ReturnValue            *int64
	ReturnValuePossibility float32

	Err            *error
	ErrPossibility float32

	Delay            *time.Duration
	DelayPossibility float32
	// contains filtered or unexported fields
}

func (*NbdFault) Clone

func (f *NbdFault) Clone() *NbdFault

type RawFS

type RawFS struct {
	fuse.FileSystemBase
	BaseDir          string
	DisableReadAhead bool
}

func NewRawFS

func NewRawFS(baseDir string) *RawFS

func (*RawFS) Chmod

func (f *RawFS) Chmod(path string, mode uint32) (errc int)

func (*RawFS) Chown

func (f *RawFS) Chown(path string, uid uint32, gid uint32) (errc int)

func (*RawFS) Create

func (f *RawFS) Create(path string, flags int, mode uint32) (errc int, fh uint64)

func (*RawFS) Fsync

func (f *RawFS) Fsync(path string, datasync bool, fh uint64) (errc int)

func (*RawFS) Getattr

func (f *RawFS) Getattr(path string, stat *fuse.Stat_t, fh uint64) (errc int)

func (*RawFS) Init

func (f *RawFS) Init()
func (f *RawFS) Link(oldpath string, newpath string) (errc int)

func (*RawFS) Mkdir

func (f *RawFS) Mkdir(path string, mode uint32) (errc int)

func (*RawFS) Mknod

func (f *RawFS) Mknod(path string, mode uint32, dev uint64) (errc int)

func (*RawFS) Open

func (f *RawFS) Open(path string, flags int) (errc int, fh uint64)

func (*RawFS) Opendir

func (f *RawFS) Opendir(path string) (errc int, fh uint64)

func (*RawFS) Read

func (f *RawFS) Read(path string, buff []byte, ofst int64, fh uint64) (rc int)

func (*RawFS) Readdir

func (f *RawFS) Readdir(path string, fill fillFn, ofst int64, fh uint64) (errc int)
func (f *RawFS) Readlink(path string) (errc int, target string)

func (*RawFS) Release

func (f *RawFS) Release(path string, fh uint64) (errc int)

func (*RawFS) Releasedir

func (f *RawFS) Releasedir(path string, fh uint64) (errc int)

func (*RawFS) Rename

func (f *RawFS) Rename(oldpath string, newpath string) (errc int)

func (*RawFS) Rmdir

func (f *RawFS) Rmdir(path string) (errc int)

func (*RawFS) Statfs

func (f *RawFS) Statfs(path string, stat *fuse.Statfs_t) (errc int)
func (f *RawFS) Symlink(target string, newpath string) (errc int)

func (*RawFS) Truncate

func (f *RawFS) Truncate(path string, size int64, fh uint64) (errc int)
func (f *RawFS) Unlink(path string) (errc int)

func (*RawFS) Utimens

func (f *RawFS) Utimens(path string, tmsp1 []fuse.Timespec) (errc int)

func (*RawFS) Write

func (f *RawFS) Write(path string, buff []byte, ofst int64, fh uint64) (rc int)

type RegexCache

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

func NewRegexCache

func NewRegexCache() *RegexCache

func (*RegexCache) Clear

func (f *RegexCache) Clear()

func (*RegexCache) Compile

func (f *RegexCache) Compile(r string) (*regexp.Regexp, error)

type Rpc

type Rpc struct {
	pb.UnimplementedFuseStreamServer
	Faults *FaultManager
}

func (*Rpc) DeleteFault

func (r *Rpc) DeleteFault(_ context.Context, req *pb.DeleteFaultRequest) (*pb.DeleteFaultResponse, error)

func (*Rpc) InjectFuseFault

func (r *Rpc) InjectFuseFault(_ context.Context, req *pb.InjectFuseFaultRequest) (*pb.InjectFuseFaultResponse, error)

func (*Rpc) InjectNbdFault

func (r *Rpc) InjectNbdFault(ctx context.Context, req *pb.InjectNbdFaultRequest) (*pb.InjectNbdFaultResponse, error)

func (*Rpc) ListFaults

func (r *Rpc) ListFaults(_ context.Context, _ *pb.Void) (*pb.ListFaultsResponse, error)

type SlowFS

type SlowFS struct {
	RawFS
	Faults *FaultManager
}

func NewSlowFS

func NewSlowFS(baseDir string, faults *FaultManager) *SlowFS

func (*SlowFS) Chmod

func (f *SlowFS) Chmod(path string, mode uint32) (errc int)

func (*SlowFS) Chown

func (f *SlowFS) Chown(path string, uid uint32, gid uint32) (errc int)

func (*SlowFS) Create

func (f *SlowFS) Create(path string, flags int, mode uint32) (errc int, fh uint64)

func (*SlowFS) Fsync

func (f *SlowFS) Fsync(path string, datasync bool, fh uint64) (errc int)

func (*SlowFS) Getattr

func (f *SlowFS) Getattr(path string, stat *fuse.Stat_t, fh uint64) (errc int)

func (*SlowFS) Init

func (f *SlowFS) Init()
func (f *SlowFS) Link(oldpath string, newpath string) (errc int)

func (*SlowFS) Mkdir

func (f *SlowFS) Mkdir(path string, mode uint32) (errc int)

func (*SlowFS) Mknod

func (f *SlowFS) Mknod(path string, mode uint32, dev uint64) (errc int)

func (*SlowFS) Open

func (f *SlowFS) Open(path string, flags int) (errc int, fh uint64)

func (*SlowFS) Opendir

func (f *SlowFS) Opendir(path string) (errc int, fh uint64)

func (*SlowFS) Read

func (f *SlowFS) Read(path string, buff []byte, ofst int64, fh uint64) (rc int)

func (*SlowFS) Readdir

func (f *SlowFS) Readdir(path string, fill fillFn, ofst int64, fh uint64) (errc int)
func (f *SlowFS) Readlink(path string) (errc int, target string)

func (*SlowFS) Release

func (f *SlowFS) Release(path string, fh uint64) (errc int)

func (*SlowFS) Releasedir

func (f *SlowFS) Releasedir(path string, fh uint64) (errc int)

func (*SlowFS) Rename

func (f *SlowFS) Rename(oldpath string, newpath string) (errc int)

func (*SlowFS) Rmdir

func (f *SlowFS) Rmdir(path string) (errc int)

func (*SlowFS) Statfs

func (f *SlowFS) Statfs(path string, stat *fuse.Statfs_t) (errc int)
func (f *SlowFS) Symlink(target string, newpath string) (errc int)

func (*SlowFS) Truncate

func (f *SlowFS) Truncate(path string, size int64, fh uint64) (errc int)
func (f *SlowFS) Unlink(path string) (errc int)

func (*SlowFS) Utimens

func (f *SlowFS) Utimens(path string, tmsp1 []fuse.Timespec) (errc int)

func (*SlowFS) Write

func (f *SlowFS) Write(path string, buff []byte, ofst int64, fh uint64) (rc int)

type SpanExporter

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

func NewSpanExporter

func NewSpanExporter(path string) (*SpanExporter, error)

func (*SpanExporter) ExportSpans

func (e *SpanExporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error

func (*SpanExporter) Shutdown

func (e *SpanExporter) Shutdown(ctx context.Context) error

type ZeroFault

type ZeroFault struct{}

func (ZeroFault) Delay

func (z ZeroFault) Delay()

func (ZeroFault) MayReplaceError

func (z ZeroFault) MayReplaceError(err error) error

func (ZeroFault) MayReplaceErrorCode

func (z ZeroFault) MayReplaceErrorCode(rc int64) int64

Jump to

Keyboard shortcuts

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