Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloseFn ¶ added in v1.9.0
type CloseFn func() error
CloseFn should free any resources after the ReaderAt has been used.
type ContentsExceedLimitError ¶ added in v1.9.0
type ContentsExceedLimitError string
ContentsExceedLimitError is the error implementation returned when the content size of a reader would cause a configured maximum limit to be exceeded. The string value of the ContentsExceedLimitError describes the details of the circumstance in which the limit would be breached.
func (ContentsExceedLimitError) Error ¶ added in v1.9.0
func (o ContentsExceedLimitError) Error() string
Error describes the details about the way the limit would be exceeded by the size of some contents.
type InMemoryWithDiskOverflowReaderAtConverter ¶ added in v1.9.0
type InMemoryWithDiskOverflowReaderAtConverter struct { Path string MaxMemorySize int64 MaxDiskSpace int64 // contains filtered or unexported fields }
InMemoryWithDiskOverflowReaderAtConverter creates a ReaderReaderAtConverter with the following behaviour:
- Any amount of in-memory buffers can be created where the reader contents size is less or equal to the c.MaxMemorySize.
- When a ReaderAt is being created with a size above the MaxMemorySize, a temporary file will be created in the Path containing the content of the reader. The temporary file will be deleted upon calling the CloseFn from returned from the call to ReaderAt. If previously temporary files still exist, then new temporary files will only be created if MaxDiskSpace take the size of the space already occupied by the temporary files is enough to fit the new Reader contents into. Otherwise, a ContentsExceedLimitError will be returned outlining the details of the error.
type IntermediateBufferReader ¶ added in v1.4.0
type IntermediateBufferReader struct { Reader io.Reader ContentSize int64 Buffer []byte // contains filtered or unexported fields }
IntermediateBufferReader implements an io.Reader that will read from a configured Reader into an intermediate buffer, populating bytes slices passed to the Read method from the intermediate buffer.
func (*IntermediateBufferReader) Read ¶ added in v1.4.0
func (a *IntermediateBufferReader) Read(p []byte) (n int, err error)
Read populates p from the internal buffer, reading from the internal reader to refill the buffer if all of the buffer's previous content has already been written out during previous calls to Read.
type ReaderReaderAtConverter ¶ added in v1.9.0
type ReaderReaderAtConverter interface {
ReaderAt(r io.Reader, contentSize int64) (io.ReaderAt, CloseFn, error)
}
ReaderReaderAtConverter converts a reader with a specific contentSize to a ReaderAt with a CloseFn.
type ReaderReaderAtConverterFunc ¶ added in v1.9.0
ReaderReaderAtConverterFunc is a pure function ReaderReaderAtConverter
func SizeCappedInMemoryReaderAtConverter ¶ added in v1.9.0
func SizeCappedInMemoryReaderAtConverter(maxSize int64) ReaderReaderAtConverterFunc
SizeCappedInMemoryReaderAtConverter will create a ReaderAt from a reader only if the size of the reader is less than maxSize