View Source
const (
	// DefaultFileMode is the default file mode for files generated by
	// Dragonboat.
	DefaultFileMode = 0640
View Source
const (
	// SnapshotFlagFilename defines the filename of the snapshot flag file.
	SnapshotFlagFilename = "dragonboat.snapshot.message"


This section is empty.


func CreateFlagFile

func CreateFlagFile(dir string, filename string, msg proto.Message) error

CreateFlagFile creates a flag file in the specific location. The flag file contains the marshaled data of the specified protobuf message.

func Exist

func Exist(name string) bool

Exist returns whether the specified filesystem entry exists.

func GetAppNameFromFilename

func GetAppNameFromFilename(soName string) string

GetAppNameFromFilename returns the app name from the filename.

func GetFlagFileContent

func GetFlagFileContent(dir string, filename string, msg proto.Message) error

GetFlagFileContent gets the content of the flag file found in the specified location. The data of the flag file will be unmarshaled into the specified protobuf message.

func GetPossibleCPPSOFiles

func GetPossibleCPPSOFiles(path string) []string

GetPossibleCPPSOFiles returns a list of possible .so files found in the specified path.

func GetPossibleSOFiles

func GetPossibleSOFiles(path string) []string

GetPossibleSOFiles returns a list of possible .so files.

func HasFlagFile

func HasFlagFile(dir string, filename string) bool

HasFlagFile returns a boolean value indicating whether flag file can be found in the specified location.

func MkdirAll

func MkdirAll(dir string) error

MkdirAll creates the specified dir.

func RemoveFlagFile

func RemoveFlagFile(dir string, filename string) error

RemoveFlagFile removes the specified flag file.

func SyncDir

func SyncDir(dir string) error

SyncDir calls fsync on the specified directory.


type ChunkFile

type ChunkFile struct {
	// contains filtered or unexported fields

ChunkFile is the snapshot chunk file being transferred.

func CreateChunkFile

func CreateChunkFile(fp string) (*ChunkFile, error)

CreateChunkFile creates a new chunk file.

func OpenChunkFileForAppend

func OpenChunkFileForAppend(fp string) (*ChunkFile, error)

OpenChunkFileForAppend opens the chunk file at fp for appending.

func OpenChunkFileForRead

func OpenChunkFileForRead(fp string) (*ChunkFile, error)

OpenChunkFileForRead opens for the chunk file for read-only operation.

func (*ChunkFile) Close

func (cf *ChunkFile) Close()

Close closes the chunk file.

func (*ChunkFile) Read

func (cf *ChunkFile) Read(data []byte) (int, error)

Read reads from the file.

func (*ChunkFile) SeekFromBeginning

func (cf *ChunkFile) SeekFromBeginning(offset int64) (int64, error)

SeekFromBeginning seeks the underlying file from the beginning.

func (*ChunkFile) Sync

func (cf *ChunkFile) Sync() error

Sync syncs the chunk file.

func (*ChunkFile) Write

func (cf *ChunkFile) Write(data []byte) (int, error)

Write writes the specified data to the chunk file.