common

package
v0.0.0-...-29c007c Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Socket constants
	BUFFERSIZE      = 1024
	LENGTHTIMESTAMP = 19
	LENGTHINFO      = 64

	// Replication types
	NO_REPLICATION            = 0
	CHAIN_REPLICATION         = 1
	SPLAY_REPLICATION         = 2
	PRIMARY_SPLAY_REPLICATION = 3

	// Dummy
	DUMMY_EPOCH = 1557906926566451195
)

Variables

View Source
var (
	// Replication mode to be changed concurrently
	ReplicationMode = 1

	// Struct to lookback states when changing replication mode
	ReplicationLookBack = &ReplicationData{
		Old:       ReplicationMode,
		New:       ReplicationMode,
		TimeStamp: DUMMY_EPOCH}
)

Functions

func HashFile

func HashFile(filePath string) (string, error)

func hash_file_md5(filePath string) (string, error) {

func LogStdOut

func LogStdOut(logApp bool)

Types

type Configuration

type Configuration struct {
	Daemons []*Daemon
	Global  ConfigurationGlobal
	Metrics ConfigurationMetrics
}

func GetConfig

func GetConfig() Configuration

type ConfigurationGlobal

type ConfigurationGlobal struct {
	Debug             bool
	ReplicationOrder  string
	PolymorphicSystem bool
}

type ConfigurationMetrics

type ConfigurationMetrics struct {
	Interval         int
	MaxThreshold     float64
	MinThreshold     float64
	FallbackInterval int
}

type Daemon

type Daemon struct {
	Host  string
	Chrep string
	Data  string
	Drive string
}

type FileMetadata

type FileMetadata struct {
	Name string
	MD5  string
	Size int64
}

type ReplicationData

type ReplicationData struct {
	Old       int   `json:"old"`
	New       int   `json:"new"`
	TimeStamp int64 `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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