...

Package db

import "discovery/db"
Overview
Index

Overview ▾

Package db implements the storage solution for the service

Constants

const DatabaseName = "p2pfaas-discovery.db"
const DatabasePath = "db"

func AddInitServers

func AddInitServers(initServersArr []string)

func DeclarePollFailed

func DeclarePollFailed(machine *types.Machine)

DeclarePollFailed declares the machine as dead when the threshold of dead polls is reached

func DeclarePollSucceeded

func DeclarePollSucceeded(machine *types.Machine, ping float64)

DeclarePollSucceeded declare the machine as alive and reset the dead polls counter

func MachineAdd

func MachineAdd(machine *types.Machine, declareAlive bool) error

MachineAdd tries to add the machine to database, if already present if declareAlive is true then the machine will be redeclared as alive/home/gabrielepmattia/Coding/p2p-faas/stack-discovery

func MachineGet

func MachineGet(ip string) (*types.Machine, error)

func MachineRemove

func MachineRemove(ip string) error

func MachineRemoveAll

func MachineRemoveAll() error

func MachineUpdate

func MachineUpdate(machine *types.Machine) (int64, error)

func MachinesGet

func MachinesGet() ([]types.Machine, error)

func MachinesGetAlive

func MachinesGetAlive() ([]types.Machine, error)

MachinesGetAlive retrieves machines that surely are alive

func MachinesGetAliveAndSuspected

func MachinesGetAliveAndSuspected() ([]types.Machine, error)

func Start

func Start()

type Error

type Error struct {
    Reason string
}

func (Error) Error

func (e Error) Error() string