Documentation
¶
Index ¶
- type LazyDocument
- func (d *LazyDocument) IsLoaded() bool
- func (d *LazyDocument) Load() ([]byte, error)
- func (d *LazyDocument) LoadWithContext(ctx context.Context) ([]byte, error)
- func (d *LazyDocument) Path() string
- func (d *LazyDocument) Reader() (io.Reader, error)
- func (d *LazyDocument) Size() (int64, error)
- func (d *LazyDocument) Unload()
- type LazyDocumentManager
- func (m *LazyDocumentManager) AddDocument(path string) *LazyDocument
- func (m *LazyDocumentManager) GetDocument(path string) (*LazyDocument, bool)
- func (m *LazyDocumentManager) GetMemoryUsage() int64
- func (m *LazyDocumentManager) LoadDocument(path string) ([]byte, error)
- func (m *LazyDocumentManager) RemoveDocument(path string)
- func (m *LazyDocumentManager) UnloadAll()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LazyDocument ¶
type LazyDocument struct {
// contains filtered or unexported fields
}
LazyDocument represents a document that is loaded on demand
func NewLazyDocument ¶
func NewLazyDocument(path string) *LazyDocument
NewLazyDocument creates a new lazy document
func NewLazyDocumentWithLoader ¶
func NewLazyDocumentWithLoader(path string, loader func() ([]byte, error)) *LazyDocument
NewLazyDocumentWithLoader creates a new lazy document with a custom loader
func (*LazyDocument) IsLoaded ¶
func (d *LazyDocument) IsLoaded() bool
IsLoaded returns whether the document is loaded
func (*LazyDocument) Load ¶
func (d *LazyDocument) Load() ([]byte, error)
Load loads the document content
func (*LazyDocument) LoadWithContext ¶
func (d *LazyDocument) LoadWithContext(ctx context.Context) ([]byte, error)
LoadWithContext loads the document with context cancellation
func (*LazyDocument) Reader ¶
func (d *LazyDocument) Reader() (io.Reader, error)
Reader returns an io.Reader for the document
func (*LazyDocument) Size ¶
func (d *LazyDocument) Size() (int64, error)
Size returns the document size (requires loading metadata)
func (*LazyDocument) Unload ¶
func (d *LazyDocument) Unload()
Unload unloads the document content to free memory
type LazyDocumentManager ¶
type LazyDocumentManager struct {
// contains filtered or unexported fields
}
LazyDocumentManager manages multiple lazy documents
func NewLazyDocumentManager ¶
func NewLazyDocumentManager(maxSize int64) *LazyDocumentManager
NewLazyDocumentManager creates a new lazy document manager
func (*LazyDocumentManager) AddDocument ¶
func (m *LazyDocumentManager) AddDocument(path string) *LazyDocument
AddDocument adds a document to the manager
func (*LazyDocumentManager) GetDocument ¶
func (m *LazyDocumentManager) GetDocument(path string) (*LazyDocument, bool)
GetDocument gets a document from the manager
func (*LazyDocumentManager) GetMemoryUsage ¶
func (m *LazyDocumentManager) GetMemoryUsage() int64
GetMemoryUsage returns the current memory usage
func (*LazyDocumentManager) LoadDocument ¶
func (m *LazyDocumentManager) LoadDocument(path string) ([]byte, error)
LoadDocument loads a document and tracks memory usage
func (*LazyDocumentManager) RemoveDocument ¶
func (m *LazyDocumentManager) RemoveDocument(path string)
RemoveDocument removes a document from the manager
func (*LazyDocumentManager) UnloadAll ¶
func (m *LazyDocumentManager) UnloadAll()
UnloadAll unloads all documents