fileutil

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LINUX_DIRECT          = 0x4000
	WINDOWS_NO_BUFF       = 0x20000000
	WINDOWS_WRITE_THROUGH = 0x80000000
)

Variables

This section is empty.

Functions

func GenerateFn

func GenerateFn(pattern *strftime.Strftime, clock interface{ Now() time.Time }, rotationTime time.Duration) string

GenerateFn creates a fh name based on the pattern, the current time, and the rotation time.

The bsase time that is used to generate the filename is truncated based on the rotation time.

func Get4096ByteNbsp

func Get4096ByteNbsp() []byte

Types

type BuffIO

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

func (*BuffIO) Close

func (d *BuffIO) Close() error

func (*BuffIO) CreateFile

func (d *BuffIO) CreateFile(filename string) error

CreateFile creates a new fh in the given path, creating parent directories as necessary

func (*BuffIO) SyncFile

func (d *BuffIO) SyncFile() error

func (*BuffIO) Write

func (d *BuffIO) Write(data []byte) (int, error)

type DirectIO

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

func (*DirectIO) Close

func (d *DirectIO) Close() error

func (*DirectIO) CreateFile

func (d *DirectIO) CreateFile(filename string) error

func (*DirectIO) SyncFile

func (d *DirectIO) SyncFile() error

需要补齐内存写入,防止下次打开的时候内存未对齐写入失败 30秒内没有日志写入的话需要刷新日志到文件,用空格补齐

func (*DirectIO) Write

func (d *DirectIO) Write(data []byte) (int, error)

type IOWriter

type IOWriter interface {
	CreateFile(filename string) error
	Write(p []byte) (n int, err error)
	Close() error
	SyncFile() error
}

func GenerateBuffIO

func GenerateBuffIO() IOWriter

CreateFile creates a new fh in the given path, creating parent directories as necessary

func GenerateDirectIO

func GenerateDirectIO() IOWriter

Jump to

Keyboard shortcuts

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