commonfile

package
v0.0.0-...-8699cbc Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2014 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Common data file features.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsecutiveTwenty0s

func ConsecutiveTwenty0s(buf gommap.MMap) bool

Return true if the buffer begins with twenty consecutive 0s.

Types

type File

type File struct {
	Name           string // File path and name
	UsedSize, Size uint64
	Growth         uint64
	Fh             *os.File    // File handle
	Buf            gommap.MMap // Mapped file buffer
}

func Open

func Open(name string, growth uint64) (file *File, err error)

Open the file, or create it if non-existing.

func (*File) CheckSize

func (file *File) CheckSize(more uint64) bool

Return true only if the file still has room for more data.

func (*File) CheckSizeAndEnsure

func (file *File) CheckSizeAndEnsure(more uint64)

Ensure that the file has enough room for more data. Grow the file if necessary.

func (*File) Clear

func (file *File) Clear()

Overwrite the file with 0s and return to its initial size.

func (*File) Close

func (file *File) Close() error

Close the file.

func (*File) Flush

func (file *File) Flush() error

Synchronize file buffer with underlying storage device.

Jump to

Keyboard shortcuts

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