file

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package file Double-write of files

Index

Constants

View Source
const (
	CacheFilePerm                      = 0666
	Suffix                             = ".dat"
	Delimiter                          = "-"
	DefaultVersion                     = "0"
	FileTimestampGapMillions           = 60000
	FileTimestampCloseMillions         = 70000
	FileCloseCheckTimestampGapMillions = 5000
	FlushGapMillions                   = 10000
	RelativePattern                    = "(dc[12])-([0-9]{13})-([0-9]*)\\.dat"
	MaxLine                            = 1 << 20
)

Variables

View Source
var Pattern = regexp.MustCompile("(.*/)(.*)?-(.*)?-(.*)?\\.dat")

Functions

func BatchReplay

func BatchReplay(clients map[string]redis.UniversalClient, fileNames []string)

BatchReplay Run the following command to filter the files to be executed

func FileListNeedReplay

func FileListNeedReplay(dir string) []string

FileListNeedReplay Obtain the list of files to be executed

func MkDirs

func MkDirs(dir string)

func Replay

func Replay(filename string, client redis.UniversalClient) bool

Replay Traverse all commands in the file and execute them

func ReplayExec

func ReplayExec(client redis.UniversalClient, interrupted, lineIndex *int64, line []byte)

ReplayExec Run the command on the client

Types

type Item

type Item struct {
	Args []interface{}
}

type NameInfo

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

func Parse

func Parse(fileName string) (*NameInfo, error)

Parse Check whether the parsed file name meets requirements

type Operation

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

func NewFileOperation

func NewFileOperation() *Operation

func (*Operation) CloseWriter

func (f *Operation) CloseWriter()

CloseWriter Polling disables the write of files that are not operated within a specified period of time

func (*Operation) CreateFile

func (f *Operation) CreateFile(originPath string) (*os.File, error)

func (*Operation) WriteFile

func (f *Operation) WriteFile(path string, content Item)

WriteFile Command Write

Jump to

Keyboard shortcuts

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