v1

package
v0.0.0-...-120cf50 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const FILE_CAPA_UNLIMIT int64 = 0
View Source
const FILE_LIFE_UNLIMIT int64 = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	Path       string    //路径名称
	Name       string    //文件名称(文件名+类型:"007.txt")
	Type       string    //类型(".txt")
	Size       file.SIZE //实际大小(单位:MB)(不准确)
	CreateTime time.Time //文件创建日期(不准确)
	WFd        *os.File  //写文件描述符
	RFd        *os.File  //读文件描述符
	// contains filtered or unexported fields
}

文件信息

func (*FileInfo) CreateFile

func (fi *FileInfo) CreateFile() error

func (*FileInfo) GetAbsPath

func (fi *FileInfo) GetAbsPath() string

获得文件的绝对路径

func (*FileInfo) Info

func (fi *FileInfo) Info() error

func (*FileInfo) IsExpired

func (fi *FileInfo) IsExpired(dur time.Duration) bool

func (*FileInfo) IsFull

func (fi *FileInfo) IsFull(sz file.SIZE) bool

type FileManager

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

func NewFileManager

func NewFileManager(maxFileNum int) *FileManager

func (*FileManager) CleanFile

func (fm *FileManager) CleanFile(filePathName string) error

func (*FileManager) CloseFile

func (fm *FileManager) CloseFile(filePathName string)

func (*FileManager) GetFileInfo

func (fm *FileManager) GetFileInfo(filePathName string) *FileInfo

func (*FileManager) OpenFile

func (fm *FileManager) OpenFile(filePathName string, args ...interface{}) (*FileInfo, error)

打开文件 args:文件容量 dur:文件寿命 s

func (*FileManager) Read

func (fm *FileManager) Read(filePathName string, length int) ([]byte, error)

func (*FileManager) Write

func (fm *FileManager) Write(filePathName string, data []byte) (int, error)

Jump to

Keyboard shortcuts

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