metadata

package
v0.0.1-alpha4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetadataReader

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

MetadataReader provides read operations for the virtual filesystem

func NewMetadataReader

func NewMetadataReader(service *MetadataService) *MetadataReader

NewMetadataReader creates a new metadata reader

func (*MetadataReader) GetDirectoryInfo

func (mr *MetadataReader) GetDirectoryInfo(virtualPath string) (fs.FileInfo, error)

GetDirectoryInfo gets information about a real directory using os.Stat

func (*MetadataReader) GetFileMetadata

func (mr *MetadataReader) GetFileMetadata(virtualPath string) (*metapb.FileMetadata, error)

GetFileMetadata gets metadata for a virtual file

func (*MetadataReader) GetFileSegments

func (mr *MetadataReader) GetFileSegments(virtualPath string) ([]*metapb.SegmentData, error)

GetFileSegments retrieves usenet segments for a virtual file

func (*MetadataReader) IsDirectory

func (mr *MetadataReader) IsDirectory(virtualPath string) (bool, error)

IsDirectory checks if a virtual path is a directory

func (*MetadataReader) ListDirectoryContents

func (mr *MetadataReader) ListDirectoryContents(virtualPath string) ([]fs.FileInfo, []*metapb.FileMetadata, error)

ListDirectoryContents lists all contents in a virtual directory path Returns real directories as fs.FileInfo and virtual files as FileMetadata

func (*MetadataReader) PathExists

func (mr *MetadataReader) PathExists(virtualPath string) (bool, error)

PathExists checks if a virtual path exists

type MetadataService

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

MetadataService provides low-level read/write operations for metadata files

func NewMetadataService

func NewMetadataService(rootPath string) *MetadataService

NewMetadataService creates a new metadata service

func (*MetadataService) CalculateSegmentSize

func (ms *MetadataService) CalculateSegmentSize(segments []*metapb.SegmentData) int64

CalculateSegmentSize calculates the total size from segment data

func (*MetadataService) CreateFileMetadata

func (ms *MetadataService) CreateFileMetadata(
	fileSize int64,
	sourceNzbPath string,
	status metapb.FileStatus,
	segmentData []*metapb.SegmentData,
	encryption metapb.Encryption,
	password string,
	salt string,
) *metapb.FileMetadata

CreateFileMetadata creates a new FileMetadata with basic fields

func (*MetadataService) CreateSegmentData

func (ms *MetadataService) CreateSegmentData(startOffset, endOffset int64, messageID string) *metapb.SegmentData

CreateSegmentData creates a new SegmentData with the given parameters

func (*MetadataService) DeleteDirectory

func (ms *MetadataService) DeleteDirectory(virtualPath string) error

DeleteDirectory deletes a metadata directory and all its contents

func (*MetadataService) DeleteFileMetadata

func (ms *MetadataService) DeleteFileMetadata(virtualPath string) error

DeleteFileMetadata deletes a metadata file

func (*MetadataService) DirectoryExists

func (ms *MetadataService) DirectoryExists(virtualPath string) bool

DirectoryExists checks if a metadata directory exists

func (*MetadataService) FileExists

func (ms *MetadataService) FileExists(virtualPath string) bool

FileExists checks if a metadata file exists for the given virtual path

func (*MetadataService) GetMetadataDirectoryPath

func (ms *MetadataService) GetMetadataDirectoryPath(virtualPath string) string

GetMetadataDirectoryPath returns the filesystem path for a metadata directory

func (*MetadataService) GetMetadataFilePath

func (ms *MetadataService) GetMetadataFilePath(virtualPath string) string

GetMetadataFilePath returns the filesystem path for a metadata file

func (*MetadataService) ListDirectory

func (ms *MetadataService) ListDirectory(virtualPath string) ([]string, error)

ListDirectory lists all metadata files in a directory

func (*MetadataService) ListSubdirectories

func (ms *MetadataService) ListSubdirectories(virtualPath string) ([]string, error)

ListSubdirectories lists all subdirectories in a metadata directory

func (*MetadataService) ReadFileMetadata

func (ms *MetadataService) ReadFileMetadata(virtualPath string) (*metapb.FileMetadata, error)

ReadFileMetadata reads file metadata from disk

func (*MetadataService) UpdateFileMetadata

func (ms *MetadataService) UpdateFileMetadata(virtualPath string, updateFunc func(*metapb.FileMetadata)) error

UpdateFileMetadata updates the modified timestamp of metadata

func (*MetadataService) UpdateFileStatus

func (ms *MetadataService) UpdateFileStatus(virtualPath string, status metapb.FileStatus) error

UpdateFileStatus updates the status of a file in metadata

func (*MetadataService) ValidateSourceNzb

func (ms *MetadataService) ValidateSourceNzb(metadata *metapb.FileMetadata) error

ValidateSourceNzb validates that the source NZB file exists and matches metadata

func (*MetadataService) WalkMetadata

func (ms *MetadataService) WalkMetadata(walkFunc func(virtualPath string, metadata *metapb.FileMetadata) error) error

WalkMetadata walks through all metadata files in the filesystem

func (*MetadataService) WriteFileMetadata

func (ms *MetadataService) WriteFileMetadata(virtualPath string, metadata *metapb.FileMetadata) error

WriteFileMetadata writes file metadata to disk

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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