mockfilesystem

package
v0.0.0-...-26478da Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandChangeDirectory = "cd"
	CommandList            = "ls"
)
View Source
const (
	ObjectTypeFolder = "FOLDER"
	ObjectTypeFile   = "FILE"
)
View Source
const (
	Directory = "dir"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name string
	Size int
	// contains filtered or unexported fields
}

func NewFile

func NewFile(name string, size int) *File

func (*File) GetName

func (f *File) GetName() string

func (*File) GetObjectType

func (f *File) GetObjectType() string

func (*File) GetParent

func (f *File) GetParent() *Folder

func (*File) SetName

func (f *File) SetName(name string)

func (*File) SetParent

func (f *File) SetParent(parent *Folder)

type FileSystemObject

type FileSystemObject interface {
	GetName() string
	SetName(string)
	GetObjectType() string
	GetParent() *Folder
	SetParent(*Folder)
}

type Folder

type Folder struct {
	Name     string
	Children []FileSystemObject

	TotalSize int
	// contains filtered or unexported fields
}

func NewFolder

func NewFolder(name string) *Folder

func (*Folder) AddObject

func (f *Folder) AddObject(obj FileSystemObject) *Folder

func (*Folder) CalculateTotalSize

func (f *Folder) CalculateTotalSize() int

func (*Folder) FindObject

func (f *Folder) FindObject(name string) FileSystemObject

func (*Folder) GetName

func (f *Folder) GetName() string

func (*Folder) GetObjectType

func (f *Folder) GetObjectType() string

func (*Folder) GetParent

func (f *Folder) GetParent() *Folder

func (*Folder) SetName

func (f *Folder) SetName(name string)

func (*Folder) SetParent

func (f *Folder) SetParent(parent *Folder)

Jump to

Keyboard shortcuts

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