Documentation
¶
Index ¶
Constants ¶
const (
DefaultBufSize = 16 * 1024 * 1024 // 16 MiB
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedIO ¶
type BufferedIO struct {
// contains filtered or unexported fields
}
func NewBufferedIO ¶
func (*BufferedIO) CloseBoundary ¶
func (s *BufferedIO) CloseBoundary(ctx context.Context) (Uploadeable, error)
func (*BufferedIO) IsWritten ¶
func (s *BufferedIO) IsWritten() bool
func (*BufferedIO) StartBoundary ¶
func (s *BufferedIO) StartBoundary(blockRange *bstream.Range) error
type IntelligentWriter ¶
func NewIntelligentWriter ¶
func NewIntelligentWriter(w io.Writer) *IntelligentWriter
NewIntelligentWriter returns a new IntelligentWriter whose buffer has the default size. If the argument io.Writer is already a bufio.Writer with large enough buffer size, it returns the underlying Writer.
func NewIntelligentWriterSize ¶
func NewIntelligentWriterSize(w io.Writer, size int) *IntelligentWriter
NewIntelligentWriterSize is intelligent because it tracks if data was ever written to the temporary file or not. If everything entered the buffer fit in memory, we can nicely optimze away the full I/O operation and avoid all the cost of it.
Operators should specify a buffer as large as they are willing to pay for RAM ( leaving a buffer for "normal" operations of the process).
func (*IntelligentWriter) AllDataFitInMemory ¶
func (w *IntelligentWriter) AllDataFitInMemory() bool
func (*IntelligentWriter) MemoryData ¶
func (w *IntelligentWriter) MemoryData() []byte
type LazyFile ¶
LazyFile only creates and writes to file if `Write` is called at least one.
**Important** Not safe for concurrent access, you need to gate yourself if you need that.