buffile

package
v2.3.8+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

package buffile helps batch write by writes to the tempobary in-memory buffer under the assumption that many writes come in to the part of single file frequently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedFile

type BufferedFile struct {
	// contains filtered or unexported fields
}

BufferedFile abstracts a file with block-sized buffer to group writes that are likely consective. This object does not provide any mean of concurrency guarantee. Also note that the underlying file is assumed to have the content already written on disk, and the behavior on writing beyond the file size is not defined.

func New

func New(filePath string) (*BufferedFile, error)

func (*BufferedFile) Close

func (f *BufferedFile) Close() error

func (*BufferedFile) WriteAt

func (f *BufferedFile) WriteAt(data []byte, offset int64) (int, error)

WriteAt writes the data at offset from the beginning of the file. Upon the return from this call, the data does not reach to disk yet. Make sure to close BufferedFile f to write the data on disk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL