kibitz

package module
v0.0.0-...-b71ab6a Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: BSD-3-Clause Imports: 12 Imported by: 8

README

library for peer-to-peer gossip network

- distributed
- highly available
- datacenter + rack aware
- peer-to-peer
- not yet finished


see also:
  Amazon Dynamo
  https://metacpan.org/release/AC-Yenta

Documentation

Index

Constants

View Source
const (
	TIMEOUT  = 15 * time.Second
	OLDTIMER = 9 * time.Minute // less than KEEPLOST
)
View Source
const (
	MAXFAIL = 3
	MAXVIA  = 1024
)
View Source
const (
	KEEPDOWN = 10 * lamport.Minute // keep data about down servers for how long?
	KEEPLOST = 10 * lamport.Minute // keep data about servers we have not heard about for how long?
)
View Source
const STALE = int64(2 * time.Minute)

Variables

View Source
var (
	ErrInvalidLengthPeer        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowPeer          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupPeer = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Conf

type Conf struct {
	Iface       infoer
	System      string
	Seed        []string
	Id          string
	Hostname    string
	Environment string
	Datacenter  string
	Rack        string
	Promiscuous bool
	Port        int
}

type DB

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

func New

func New(c *Conf) *DB

func (*DB) Cleanup

func (pdb *DB) Cleanup()

func (*DB) ClockBoot

func (p *DB) ClockBoot() uint64

func (*DB) ClockNow

func (p *DB) ClockNow() uint64

func (*DB) Datacenter

func (p *DB) Datacenter() string

func (*DB) DomOK

func (p *DB) DomOK(dom string) bool

func (*DB) Env

func (p *DB) Env() string

func (*DB) ForAllData

func (pdb *DB) ForAllData(fnc func(string, bool, interface{}))

func (*DB) ForAllExport

func (pdb *DB) ForAllExport(fnc func(*Export))

func (*DB) Get

func (pdb *DB) Get(id string) *Peer

func (*DB) GetAll

func (pdb *DB) GetAll() []*Peer

NB - does not include myself

func (*DB) GetExportSelf

func (pdb *DB) GetExportSelf() *Export

func (*DB) Host

func (p *DB) Host() string

func (*DB) Id

func (p *DB) Id() string

func (*DB) IsOwnAddr

func (pdb *DB) IsOwnAddr(addr string) bool

func (*DB) MyInfo

func (pdb *DB) MyInfo() *PeerInfo

func (*DB) Myself

func (pdb *DB) Myself() PeerImport

func (*DB) PeerDn

func (pdb *DB) PeerDn(id string)

func (*DB) PeerUp

func (pdb *DB) PeerUp(id string)

our tests

func (*DB) Rack

func (p *DB) Rack() string

func (*DB) Start

func (pdb *DB) Start()

func (*DB) Stop

func (pdb *DB) Stop()

func (*DB) Update

func (pdb *DB) Update(px PeerImport)

3rd party reports

func (*DB) UpdateSceptical

func (pdb *DB) UpdateSceptical(px PeerImport)

their reports

type Export

type Export struct {
	Netinfo     []*NetInfo
	Status      PeerStatus
	Id          string
	Sys         string
	Env         string
	Hostname    string
	Rack        string
	Datacenter  string
	BestAddr    string
	TimeLastUp  uint64
	TimeUpSince uint64
	LastTry     time.Time
	IsUp        bool
	IsSameRack  bool
	IsSameDC    bool
}

type NetInfo

type NetInfo struct {
	Addr                 string   `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
	Natdom               string   `protobuf:"bytes,2,opt,name=natdom,proto3" json:"natdom,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*NetInfo) Descriptor

func (*NetInfo) Descriptor() ([]byte, []int)

func (*NetInfo) GetAddr

func (m *NetInfo) GetAddr() string

func (*NetInfo) GetNatdom

func (m *NetInfo) GetNatdom() string

func (*NetInfo) Marshal

func (m *NetInfo) Marshal() (dAtA []byte, err error)

func (*NetInfo) MarshalTo

func (m *NetInfo) MarshalTo(dAtA []byte) (int, error)

func (*NetInfo) MarshalToSizedBuffer

func (m *NetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NetInfo) ProtoMessage

func (*NetInfo) ProtoMessage()

func (*NetInfo) Reset

func (m *NetInfo) Reset()

func (*NetInfo) Size

func (m *NetInfo) Size() (n int)

func (*NetInfo) String

func (m *NetInfo) String() string

func (*NetInfo) Unmarshal

func (m *NetInfo) Unmarshal(dAtA []byte) error

func (*NetInfo) XXX_DiscardUnknown

func (m *NetInfo) XXX_DiscardUnknown()

func (*NetInfo) XXX_Marshal

func (m *NetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NetInfo) XXX_Merge

func (m *NetInfo) XXX_Merge(src proto.Message)

func (*NetInfo) XXX_Size

func (m *NetInfo) XXX_Size() int

func (*NetInfo) XXX_Unmarshal

func (m *NetInfo) XXX_Unmarshal(b []byte) error

type Peer

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

func (*Peer) GetData

func (p *Peer) GetData() interface{}

func (*Peer) GetExport

func (p *Peer) GetExport() *Export

func (*Peer) Kill

func (p *Peer) Kill()

func (*Peer) SetIsUp

func (p *Peer) SetIsUp(now lamport.Time)

results of our tests

func (*Peer) SetMaybeDn

func (p *Peer) SetMaybeDn(now lamport.Time)

func (*Peer) Update

func (p *Peer) Update(px PeerImport, pdb *DB)

recvd updates

type PeerImport

type PeerImport interface {
	GetPeerInfo() *PeerInfo
	SetPeerInfo(*PeerInfo)
}

type PeerInfo

type PeerInfo struct {
	StatusCode  int32  `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	Subsystem   string `protobuf:"bytes,2,opt,name=subsystem,proto3" json:"subsystem,omitempty"`
	Environment string `protobuf:"bytes,3,opt,name=environment,proto3" json:"environment,omitempty"`
	ServerId    string `protobuf:"bytes,4,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"`
	Hostname    string `protobuf:"bytes,5,opt,name=hostname,proto3" json:"hostname,omitempty"`
	Datacenter  string `protobuf:"bytes,6,opt,name=datacenter,proto3" json:"datacenter,omitempty"`
	Rack        string `protobuf:"bytes,7,opt,name=rack,proto3" json:"rack,omitempty"`
	// lamport clocks (see lamport.go)
	TimeChecked          uint64     `protobuf:"varint,8,opt,name=time_checked,json=timeChecked,proto3" json:"time_checked,omitempty"`
	TimeLastUp           uint64     `protobuf:"varint,9,opt,name=time_last_up,json=timeLastUp,proto3" json:"time_last_up,omitempty"`
	TimeCreated          uint64     `protobuf:"varint,10,opt,name=time_created,json=timeCreated,proto3" json:"time_created,omitempty"`
	TimeConf             uint64     `protobuf:"varint,11,opt,name=time_conf,json=timeConf,proto3" json:"time_conf,omitempty"`
	TimeUpSince          uint64     `protobuf:"varint,12,opt,name=time_up_since,json=timeUpSince,proto3" json:"time_up_since,omitempty"`
	Via                  string     `protobuf:"bytes,17,opt,name=via,proto3" json:"via,omitempty"`
	NetInfo              []*NetInfo `protobuf:"bytes,20,rep,name=net_info,json=netInfo,proto3" json:"net_info,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_unrecognized     []byte     `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (*PeerInfo) Descriptor

func (*PeerInfo) Descriptor() ([]byte, []int)

func (*PeerInfo) GetDatacenter

func (m *PeerInfo) GetDatacenter() string

func (*PeerInfo) GetEnvironment

func (m *PeerInfo) GetEnvironment() string

func (*PeerInfo) GetHostname

func (m *PeerInfo) GetHostname() string

func (*PeerInfo) GetNetInfo

func (m *PeerInfo) GetNetInfo() []*NetInfo

func (*PeerInfo) GetRack

func (m *PeerInfo) GetRack() string

func (*PeerInfo) GetServerId

func (m *PeerInfo) GetServerId() string

func (*PeerInfo) GetStatusCode

func (m *PeerInfo) GetStatusCode() int32

func (*PeerInfo) GetSubsystem

func (m *PeerInfo) GetSubsystem() string

func (*PeerInfo) GetTimeChecked

func (m *PeerInfo) GetTimeChecked() uint64

func (*PeerInfo) GetTimeConf

func (m *PeerInfo) GetTimeConf() uint64

func (*PeerInfo) GetTimeCreated

func (m *PeerInfo) GetTimeCreated() uint64

func (*PeerInfo) GetTimeLastUp

func (m *PeerInfo) GetTimeLastUp() uint64

func (*PeerInfo) GetTimeUpSince

func (m *PeerInfo) GetTimeUpSince() uint64

func (*PeerInfo) GetVia

func (m *PeerInfo) GetVia() string

func (*PeerInfo) Marshal

func (m *PeerInfo) Marshal() (dAtA []byte, err error)

func (*PeerInfo) MarshalTo

func (m *PeerInfo) MarshalTo(dAtA []byte) (int, error)

func (*PeerInfo) MarshalToSizedBuffer

func (m *PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PeerInfo) ProtoMessage

func (*PeerInfo) ProtoMessage()

func (*PeerInfo) Reset

func (m *PeerInfo) Reset()

func (*PeerInfo) SetStatusCode

func (p *PeerInfo) SetStatusCode(st PeerStatus)

func (*PeerInfo) Size

func (m *PeerInfo) Size() (n int)

func (*PeerInfo) String

func (m *PeerInfo) String() string

func (*PeerInfo) Unmarshal

func (m *PeerInfo) Unmarshal(dAtA []byte) error

func (*PeerInfo) XXX_DiscardUnknown

func (m *PeerInfo) XXX_DiscardUnknown()

func (*PeerInfo) XXX_Marshal

func (m *PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerInfo) XXX_Merge

func (m *PeerInfo) XXX_Merge(src proto.Message)

func (*PeerInfo) XXX_Size

func (m *PeerInfo) XXX_Size() int

func (*PeerInfo) XXX_Unmarshal

func (m *PeerInfo) XXX_Unmarshal(b []byte) error

type PeerStatus

type PeerStatus int
const (
	STATUS_UNKNOWN   PeerStatus = 0
	STATUS_UP        PeerStatus = 2
	STATUS_MAYBEDN   PeerStatus = 3
	STATUS_DOWN      PeerStatus = 4
	STATUS_SCEPTICAL PeerStatus = 5
	STATUS_DEAD      PeerStatus = 6
)

func (PeerStatus) String

func (s PeerStatus) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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