utilities

package
v0.0.0-...-6d0f442 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2016 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

=========================================================================== ORBIT VM PROTECTOR GPL Source Code Copyright (C) 2015 Vasileios Anagnostopoulos. This file is part of the ORBIT VM PROTECTOR Source Code (?ORBIT VM PROTECTOR Source Code?). ORBIT VM PROTECTOR Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ORBIT VM PROTECTOR Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ORBIT VM PROTECTOR Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, the ORBIT VM PROTECTOR Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing Vasileios Anagnostopoulos, Campani 3 Street, Athens Greece, POBOX 11252. ===========================================================================

jsonutil.go

=========================================================================== ORBIT VM PROTECTOR GPL Source Code Copyright (C) 2015 Vasileios Anagnostopoulos. This file is part of the ORBIT VM PROTECTOR Source Code (?ORBIT VM PROTECTOR Source Code?). ORBIT VM PROTECTOR Source Code is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ORBIT VM PROTECTOR Source Code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ORBIT VM PROTECTOR Source Code. If not, see <http://www.gnu.org/licenses/>. In addition, the ORBIT VM PROTECTOR Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below. If you have questions concerning this license or the applicable additional terms, you may contact in writing Vasileios Anagnostopoulos, Campani 3 Street, Athens Greece, POBOX 11252. ===========================================================================

measurements.go

Index

Constants

View Source
const (
	MongoTimeout  = 60
	OrbitDatabase = "orbitgoer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBconfig

type DBconfig struct {
	Mongourls    []string `json:"mongourls"`
	AuthUsername string   `json:"username"`
	AuthPassword string   `json:"password"`
}

type DCDetection

type DCDetection struct {
	DetectionReporter `bson:",inline"`
	Dcid              string    `bson:"watchdog_ovp_dcid" json:"watchdog_ovp_dcid"`
	Timestamp         time.Time `bson:"watchdog_timestamp" json:"watchdog_timestamp"`
}

type DCMeasurments

type DCMeasurments struct {
	ProtectorMeasurements
	Targetdcid             string
	Internalfalsepositives int
	Externalfalsepositives int
	TimeToPing             int
	TimeToVote             int
	Pinged                 int
	Votings                int
}

type Dcsuspicion

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

func Createdcsuspicion

func Createdcsuspicion() *Dcsuspicion

func (*Dcsuspicion) Converged

func (dd *Dcsuspicion) Converged() (bool, time.Duration)

func (*Dcsuspicion) Reset

func (dd *Dcsuspicion) Reset()

func (*Dcsuspicion) Update

func (dd *Dcsuspicion) Update(status bool)

type DetectionReporter

type DetectionReporter struct {
	Reporter_ovip string `bson:"reporter_ovp_ip" json:"reporter_ovp_ip"`
	Reporter_dcid string `bson:"reporter_ovp_dcid" json:"reporter_ovp_dcid"`
}

type DetectorOpinion

type DetectorOpinion struct {
	Dcid         string `bson:"datacenter_id"`
	Aliveopinion bool   `bson:"datacenter_operating"`
}

type ODPconfig

type ODPconfig struct {
	Pingattempts            pinglogic.TimedAttempts `json:"pingattempts"`
	Landscapeupdateinterval time.Duration           `json:"updateinterval"`
	Votingtimeout           time.Duration           `json:"votingtimeout"`
	Votingthreshold         float64                 `json:"votingthreshold"`
}

type OPConfig

type OPConfig struct {
	Odip         string `bson:"watchdog_odp_ip" json:"watchdog_odp_ip"`
	Voteport     int    `bson:"watchdog_odp_voteport" json:"watchdog_odp_voteport"`
	Pingport     int    `bson:"watchdog_odp_pingport" json:"watchdog_odp_pingport"`
	Dcprotecting bool   `bson:"watchdog_ovp_dcprotecting" json:"watchdog_ovp_dcprotecting"`
	Ovip         string `bson:"watchdog_ovp_ip" json:"watchdog_ovp_ip"`
	Serfport     int    `bson:"watchdog_ovp_serfport" json:"watchdog_ovp_serfport"`
	Announceport int    `bson:"watchdog_ovp_announceport"  json:"watchdog_ovp_announceport"`
	Dcid         string `bson:"watchdog_ovp_dcid" json:"watchdog_ovp_dcid"`
}

type OPData

type OPData struct {
	OPConfig `bson:",inline"`
	Epoch    int `bson:"watchdog_ovp_epoch" json:"watchdog_ovp_epoch"`
}

func (*OPData) Name

func (o *OPData) Name() string

type OPRoute

type OPRoute struct {
	Src string `bson:"route_odp_src"`
	Dst string `bson:"route_odp_dst"`
}

type OVPconfig

type OVPconfig struct {
	Numofwatchers   int                     `json:"numofpeers"`
	Minwatchers     int                     `json:"minpeers"`
	Refreshattempts pinglogic.TimedAttempts `json:"refreshattempts"`
}

type PersistencyLayer

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

func CreatePersistencyLayer

func CreatePersistencyLayer(dbconfig *DBconfig) *PersistencyLayer

func (*PersistencyLayer) Describe

func (p *PersistencyLayer) Describe(opconfig *OPConfig) *OPData

func (*PersistencyLayer) GetDatacenterState

func (p *PersistencyLayer) GetDatacenterState(dcid string) *DetectorOpinion

func (*PersistencyLayer) GetODPPeers

func (p *PersistencyLayer) GetODPPeers(dcid string) []OPData

func (*PersistencyLayer) GetOVPPeers

func (p *PersistencyLayer) GetOVPPeers(bound int, opconfig *OPConfig) []OPData

func (*PersistencyLayer) GetRoute

func (p *PersistencyLayer) GetRoute(dcid string) string

func (*PersistencyLayer) Initialize

func (p *PersistencyLayer) Initialize(opconfig *OPConfig) *OPData

func (*PersistencyLayer) InsertDCDetection

func (p *PersistencyLayer) InsertDCDetection(dcdetection *DCDetection)

func (*PersistencyLayer) InsertVMDetection

func (p *PersistencyLayer) InsertVMDetection(vmdetection *VMDetection)

func (*PersistencyLayer) SetDatacenterFailed

func (p *PersistencyLayer) SetDatacenterFailed(dcid string)

type ProtectorMeasurements

type ProtectorMeasurements struct {
	DCProtector bool
	Ovip        string
	Dcid        string
	Timestamp   time.Time
	Windowvalue int
	Juststarted bool
	Epoch       int
}

type ServerConfig

type ServerConfig struct {
	Opconfig  OPConfig  `json:"opconfig"`
	Odpconfig ODPconfig `json:"odpconfig"`
	Ovpconfig OVPconfig `json:"ovpconfig"`
	Dbconfig  DBconfig  `json:"dbconfig"`
}

func Parsetoconf

func Parsetoconf() (*ServerConfig, error)

type VMDetection

type VMDetection struct {
	DetectionReporter `bson:",inline"`
	Ovip              string    `bson:"watchdog_ovp_ip" json:"watchdog_ovp_ip"`
	Dcid              string    `bson:"watchdog_ovp_dcid" json:"watchdog_ovp_dcid"`
	Timestamp         time.Time `bson:"watchdog_timestamp" json:"watchdog_timestamp"`
	Epoch             int       `bson:"watchdog_epoch" json:"watchdog_epoch"`
	Breakage          bool      `bson:"watchdog_breakage" json:"watchdog_breakage"`
	Vmid              []string  `bson:"watchdog_ovp_vmids" json:"watchdog_ovp_vmids"`
}

type VMMeasurments

type VMMeasurments struct {
	Registeredservers int
	Detections        []VMDetection
}

Jump to

Keyboard shortcuts

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