SurfTest

package
v0.0.0-...-3cb4c05 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const BLOCK_SIZE = 1024
View Source
const CONFIG_DELIMITER string = ","
View Source
const DEFAULT_BLOCK_SIZE int = 4096
View Source
const DEFAULT_META_FILENAME string = "index.db"
View Source
const FILENAME_INDEX int = 0
View Source
const FILE_INIT_VERSION int = 1
View Source
const FILE_INIT_VERSION_STR string = "1"
View Source
const HASH_DELIMITER string = " "
View Source
const HASH_LIST_INDEX int = 2
View Source
const LOAD_FROM_DIR int = 0
View Source
const LOAD_FROM_METAFILE int = 1
View Source
const META_FILENAME = "index.db"
View Source
const META_INIT_BY_CONFIG_STR int = 2
View Source
const META_INIT_BY_FILENAME int = 0
View Source
const META_INIT_BY_PARAMS int = 1
View Source
const NON_EXIST_FILE_VERSION int = 0
View Source
const NON_EXIST_FILE_VERSION_STR string = "0"
View Source
const SRC_PATH = "./test_files"
View Source
const SURF_CLIENT string = "[Surfstore RPCClient]:"
View Source
const SURF_SERVER string = "[Surfstore Server]:"
View Source
const TOMBSTONE_HASH string = "0"
View Source
const VERSION_INDEX int = 1

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(filename, message string) error

func CheckInternalState

func CheckInternalState(isLeader *bool, term *int64, log []*surfstore.UpdateOperation, fileMetaMap map[string]*surfstore.FileMetaData, server surfstore.RaftSurfstoreClient, ctx context.Context) (bool, error)

func CleanUpDir

func CleanUpDir(dirPath string)

func ConcatPath

func ConcatPath(baseDir, fileDir string) string

File Path Related

func CopyFile

func CopyFile(sourceFile, destinationFile string) error

func CreateDir

func CreateDir(dirPath string)

func DeleteFile

func DeleteFile(filename string) error

func DirFullySynced

func DirFullySynced(worker1, worker2 DirectoryWorker) bool

func EndTest

func EndTest(test TestInfo)

func InitBlockStores

func InitBlockStores(blockStoreAddrs []string) []*exec.Cmd

func InitRaftServers

func InitRaftServers(cfgPath string, cfg surfstore.RaftConfig) []*exec.Cmd

func InitSurfServers

func InitSurfServers(blockStores int) []*exec.Cmd

func IsTombHashList

func IsTombHashList(hashList []string) bool

func KillSurfServers

func KillSurfServers(servers []*exec.Cmd)

func LoadMetaFromDB

func LoadMetaFromDB(baseDir string) (fileMetaMap map[string]*surfstore.FileMetaData, e error)

func LoadMetaFromMetaFile

func LoadMetaFromMetaFile(baseDir string) (fileMetaMap map[string]*surfstore.FileMetaData, e error)

func NewFileMetaData

func NewFileMetaData(InitMode int, filename string, version int, hashList []string, configStr string) *surfstore.FileMetaData

func NewFileMetaDataFromConfig

func NewFileMetaDataFromConfig(configString string) *surfstore.FileMetaData

func NewFileMetaDataFromParams

func NewFileMetaDataFromParams(filename string, version int, hashList []string) *surfstore.FileMetaData

func SameFile

func SameFile(filename1, filename2 string) (bool, error)

func SameHashList

func SameHashList(list1, list2 []string) bool

func SameLog

func SameLog(log1, log2 []*surfstore.UpdateOperation) bool

func SameMeta

func SameMeta(meta1, meta2 map[string]*surfstore.FileMetaData) bool

func SameOperation

func SameOperation(op1, op2 *surfstore.UpdateOperation) bool

func StartSurfServers

func StartSurfServers(servers []*exec.Cmd, ready chan bool)

func SyncClient

func SyncClient(metaAddr, baseDir string, blockSize int, cfgPath string) error

func TruncateFile

func TruncateFile(filename string, leftSize int) error

Types

type DirectoryWorker

type DirectoryWorker struct {
	DirectoryName string
	SrcPath       string
}

func InitDirectoryWorker

func InitDirectoryWorker(directoryName, srcPath string) *DirectoryWorker

func (*DirectoryWorker) AddFile

func (d *DirectoryWorker) AddFile(filename string) error

func (*DirectoryWorker) CleanUp

func (d *DirectoryWorker) CleanUp()

func (*DirectoryWorker) DeleteFile

func (d *DirectoryWorker) DeleteFile(filename string) error

func (*DirectoryWorker) ListAllFile

func (d *DirectoryWorker) ListAllFile() map[string]bool

func (*DirectoryWorker) TruncateFile

func (d *DirectoryWorker) TruncateFile(filename string, size int) error

func (*DirectoryWorker) UpdateFile

func (d *DirectoryWorker) UpdateFile(filename, message string) error

type TestInfo

type TestInfo struct {
	CfgPath    string
	Ips        []string
	Context    context.Context
	CancelFunc context.CancelFunc
	Procs      []*exec.Cmd
	Conns      []*grpc.ClientConn
	Clients    []surfstore.RaftSurfstoreClient
}

func InitTest

func InitTest(cfgPath string) TestInfo

Jump to

Keyboard shortcuts

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