MCPcopy Create free account
hub / github.com/djherbis/buffer / NewFilePool

Function NewFilePool

pool.go:87–89  ·  view source on GitHub ↗

NewFilePool returns a Pool, Get() returns a file-based buffer of max size N. Put() closes and deletes the underlying file for the buffer. Get() may return an error if it fails to create a file for the buffer. Put() may return an error if it fails to delete the file.

(N int64, dir string)

Source from the content-addressed store, hash-verified

85// Get() may return an error if it fails to create a file for the buffer.
86// Put() may return an error if it fails to delete the file.
87func NewFilePool(N int64, dir string) Pool {
88 return &filePool{N: N, Directory: dir}
89}
90
91func (p *filePool) Get() (Buffer, error) {
92 file, err := ioutil.TempFile(p.Directory, "buffer")

Callers 5

TestFilePoolFunction · 0.85
TestFilePool2Function · 0.85
TestFilePartitionFunction · 0.85
TestMultiFunction · 0.85
NewUnboundedBufferFunction · 0.85

Calls

no outgoing calls

Tested by 4

TestFilePoolFunction · 0.68
TestFilePool2Function · 0.68
TestFilePartitionFunction · 0.68
TestMultiFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…