fwriter

package
v0.0.0-...-7b2b7a7 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FLock

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

FLock 文件锁

func NewFLock

func NewFLock(fn string) *FLock

NewFLock 新建FLock对象.

func (*FLock) Acquire

func (l *FLock) Acquire() error

Acquire 获取文件锁.

func (*FLock) File

func (l *FLock) File() string

File 返回文件锁保护的文件.

func (*FLock) Release

func (l *FLock) Release() error

Release 释放文件锁.

func (*FLock) Remove

func (l *FLock) Remove() error

Remove 删除文件锁保护的文件.

type SafeWriter

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

SafeWriter 文件读写器 (线程安全).

func NewSafeWriter

func NewSafeWriter(fn string) (*SafeWriter, error)

NewSafeWriter 新建SafeWriter对象.

func (*SafeWriter) Abort

func (w *SafeWriter) Abort()

Abort 放弃当前写操作.

func (*SafeWriter) Commit

func (w *SafeWriter) Commit() error

Commit 持久化内存数据到硬盘.

func (*SafeWriter) Write

func (w *SafeWriter) Write(content []byte) (int, error)

Write 写字节流.

func (*SafeWriter) WriteString

func (w *SafeWriter) WriteString(content string) (int, error)

WriteString 写字符串.

Jump to

Keyboard shortcuts

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