discover

package
v0.0.0-...-64da353 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatOutput

func FormatOutput(response *Response, format string) error

FormatOutput formats discovery results according to output format

func FormatSummary

func FormatSummary(response *Response) string

FormatSummary provides a brief summary for verbose output

func ParseSize

func ParseSize(size string) (int64, error)

ParseSize converts size string to bytes

Types

type FileResult

type FileResult struct {
	Path        string    `json:"path"`
	Name        string    `json:"name"`
	Size        int64     `json:"size"`
	Modified    time.Time `json:"modified"`
	Created     time.Time `json:"created"`
	Type        string    `json:"type"`
	Deleted     bool      `json:"deleted"`
	VolumeID    uint64    `json:"volume_id"`
	InodeID     uint64    `json:"inode_id"`
	Permissions string    `json:"permissions"`
	Owner       string    `json:"owner"`
	Group       string    `json:"group"`
	Extension   string    `json:"extension"`
	Compressed  bool      `json:"compressed"`
	Encrypted   bool      `json:"encrypted"`
}

FileResult represents a discovered file

func (*FileResult) FormatSize

func (f *FileResult) FormatSize() string

FormatSize returns a human-readable size string

func (*FileResult) GetSizeClass

func (f *FileResult) GetSizeClass() SizeClass

GetSizeClass returns the size class for display purposes

type Request

type Request struct {
	ContainerPath string
	Target        app.VolumeTarget

	// Search criteria
	NamePattern    string
	NameRegex      string
	Extensions     []string
	CaseSensitive  bool
	MinSize        string
	MaxSize        string
	ModifiedAfter  string
	ModifiedBefore string
	ContentSearch  string
	IncludeDeleted bool
	MaxResults     int
}

Request represents a file discovery request

func (*Request) Validate

func (r *Request) Validate() error

Validate validates a discovery request

type Response

type Response struct {
	Files       []FileResult  `json:"files"`
	TotalFound  int           `json:"total_found"`
	SearchTime  time.Duration `json:"search_time"`
	VolumeInfo  VolumeInfo    `json:"volume_info"`
	Truncated   bool          `json:"truncated"`
	SearchQuery SearchQuery   `json:"search_query"`
}

Response represents discovery results

func Handle

func Handle(ctx *app.Context, req *Request) (*Response, error)

Handle processes a discovery request

type SearchQuery

type SearchQuery struct {
	NamePattern    string   `json:"name_pattern,omitempty"`
	NameRegex      string   `json:"name_regex,omitempty"`
	Extensions     []string `json:"extensions,omitempty"`
	CaseSensitive  bool     `json:"case_sensitive"`
	MinSize        string   `json:"min_size,omitempty"`
	MaxSize        string   `json:"max_size,omitempty"`
	ModifiedAfter  string   `json:"modified_after,omitempty"`
	ModifiedBefore string   `json:"modified_before,omitempty"`
	ContentSearch  string   `json:"content_search,omitempty"`
	IncludeDeleted bool     `json:"include_deleted"`
	MaxResults     int      `json:"max_results"`
}

SearchQuery represents the executed search parameters

type SizeClass

type SizeClass string

SizeClass represents file size categories for display

const (
	SizeClassTiny   SizeClass = "tiny"   // < 1KB
	SizeClassSmall  SizeClass = "small"  // < 1MB
	SizeClassMedium SizeClass = "medium" // < 100MB
	SizeClassLarge  SizeClass = "large"  // < 1GB
	SizeClassHuge   SizeClass = "huge"   // >= 1GB
)

type VolumeInfo

type VolumeInfo struct {
	ID            uint64 `json:"id"`
	Name          string `json:"name"`
	UUID          string `json:"uuid"`
	Role          string `json:"role"`
	Encrypted     bool   `json:"encrypted"`
	CaseSensitive bool   `json:"case_sensitive"`
}

VolumeInfo represents information about the searched volume

Jump to

Keyboard shortcuts

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