- Updated caching logic to support size-based promotion filtering, ensuring that not all files may be promoted based on size constraints. - Implemented adaptive caching strategies with a new AdaptiveCacheManager to analyze access patterns and adjust caching strategies dynamically. - Introduced predictive caching features with a PredictiveCacheManager to prefetch content based on access patterns. - Added a CacheWarmer to preload popular content into the cache, improving access times for frequently requested files. - Refactored memory management with a DynamicCacheManager to adjust cache sizes based on system memory usage. - Enhanced VFS interface and file metadata handling to support new features and improve performance. - Updated tests to validate new caching behaviors and ensure reliability of the caching system.
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
// vfs/vfs.go
|
|
package vfs
|
|
|
|
import (
|
|
"io"
|
|
"s1d3sw1ped/SteamCache2/vfs/types"
|
|
)
|
|
|
|
// VFS defines the interface for virtual file systems
|
|
type VFS interface {
|
|
// Create creates a new file at the given key
|
|
Create(key string, size int64) (io.WriteCloser, error)
|
|
|
|
// Open opens the file at the given key for reading
|
|
Open(key string) (io.ReadCloser, error)
|
|
|
|
// Delete removes the file at the given key
|
|
Delete(key string) error
|
|
|
|
// Stat returns information about the file at the given key
|
|
Stat(key string) (*types.FileInfo, error)
|
|
|
|
// Name returns the name of this VFS
|
|
Name() string
|
|
|
|
// Size returns the current size of the VFS
|
|
Size() int64
|
|
|
|
// Capacity returns the maximum capacity of the VFS
|
|
Capacity() int64
|
|
}
|
|
|
|
// FileInfo is an alias for types.FileInfo for backward compatibility
|
|
type FileInfo = types.FileInfo
|
|
|
|
// NewFileInfo is an alias for types.NewFileInfo for backward compatibility
|
|
var NewFileInfo = types.NewFileInfo
|
|
|
|
// NewFileInfoFromOS is an alias for types.NewFileInfoFromOS for backward compatibility
|
|
var NewFileInfoFromOS = types.NewFileInfoFromOS
|
|
|
|
// BatchedTimeUpdate is an alias for types.BatchedTimeUpdate for backward compatibility
|
|
type BatchedTimeUpdate = types.BatchedTimeUpdate
|
|
|
|
// NewBatchedTimeUpdate is an alias for types.NewBatchedTimeUpdate for backward compatibility
|
|
var NewBatchedTimeUpdate = types.NewBatchedTimeUpdate
|