package module
v0.0.0-...-779ae68 Latest Latest

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 50 Imported by: 82



A simple container for go servers in my house.

Coverage Status




This section is empty.


This section is empty.


This section is empty.


type GoServer

type GoServer struct {
	Port     int32
	Registry *pb.RegistryEntry

	Register Registerable
	SkipLog  bool

	KSclient keystoreclient.Keystoreclient

	Killme bool

	BadHearts int

	AlertsFired int
	Sudo        bool

	RunningFile string

	MemCap int

	RPCTracing bool
	LameDuck   bool
	SendTrace  bool

	AlertsSkipped int64

	RunInV2 bool

	SkipIssue bool

	DiskLog bool

	NoBody bool

	SkipElect        bool
	Store            translatedStore
	FlagUseDataStore bool
	FlagUseDStore    bool
	NeedsLead        bool
	CurrentLead      string
	LeadState        pbg.LeadState
	LeadFails        int

	NoProm bool
	Bits   int

	IssueCount    int
	ElideRequests bool
	// contains filtered or unexported fields

GoServer The basic server construct

func (*GoServer) BaseDial

func (s *GoServer) BaseDial(c string) (*grpc.ClientConn, error)

BaseDial dials a connection

func (*GoServer) BounceImmediateIssue

func (s *GoServer) BounceImmediateIssue(ctx context.Context, server, title, body string, printImmediately, print bool) (*pbgh.Issue, error)

func (*GoServer) BounceIssue

func (s *GoServer) BounceIssue(ctx context.Context, title, body string, job string)

BounceIssue raises an issue for a different source

func (*GoServer) ChooseLead

func (*GoServer) CtxLog

func (s *GoServer) CtxLog(ctx context.Context, message string)

func (*GoServer) DLog

func (s *GoServer) DLog(ctx context.Context, text string)

DLog writes to the dlog

func (*GoServer) DeleteBounceIssue

func (s *GoServer) DeleteBounceIssue(ctx context.Context, number int32, server string) error

func (*GoServer) DeleteIssue

func (s *GoServer) DeleteIssue(ctx context.Context, number int32) error

func (*GoServer) Dial

func (s *GoServer) Dial(server string, dialler dialler, builder clientBuilder) (*grpc.ClientConn, error)

Dial a local server

func (*GoServer) DialLocal

func (s *GoServer) DialLocal(server string) (*grpc.ClientConn, error)

DialLocal dials through the local discover

func (*GoServer) DialMaster

func (s *GoServer) DialMaster(server string) (*grpc.ClientConn, error)

DialMaster dials the master server

func (*GoServer) DialServer

func (s *GoServer) DialServer(server, host string) (*grpc.ClientConn, error)

DialServer dials a given server

func (*GoServer) DoDial

func (s *GoServer) DoDial(entry *pb.RegistryEntry) (*grpc.ClientConn, error)

DoDial dials a server

func (*GoServer) FDial

func (s *GoServer) FDial(host string) (*grpc.ClientConn, error)

FDial fundamental dial

func (*GoServer) FDialServer

func (s *GoServer) FDialServer(ctx context.Context, servername string) (*grpc.ClientConn, error)

FDialServer dial a specific job

func (*GoServer) FDialSpecificServer

func (s *GoServer) FDialSpecificServer(ctx context.Context, servername string, host string) (*grpc.ClientConn, error)

FDialSpecificServer dial a specific job on a specific host

func (*GoServer) FFind

func (s *GoServer) FFind(ctx context.Context, servername string) ([]string, error)

FFind finds all servers

func (*GoServer) FFindSpecificServer

func (s *GoServer) FFindSpecificServer(ctx context.Context, servername string, host string) (*dpb.RegistryEntry, error)

FFindSpecificServer dial a specific job on a specific host

func (*GoServer) FPDial

func (s *GoServer) FPDial(host string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

FPDial fundamental dial

func (*GoServer) GetIP

func (s *GoServer) GetIP(servername string) (string, int)

GetIP gets an IP address from the discovery server

func (*GoServer) GetServers

func (s *GoServer) GetServers(servername string) ([]*pb.RegistryEntry, error)

GetServers gets an IP address from the discovery server

func (*GoServer) HTTPGet

func (s *GoServer) HTTPGet(ctx context.Context, url string, useragent string) (string, error)

HTTPGet gets an http resource

func (*GoServer) ImmediateIssue

func (s *GoServer) ImmediateIssue(ctx context.Context, title, body string, printImmediately, print bool) (*pbgh.Issue, error)

func (*GoServer) IsAlive

func (s *GoServer) IsAlive(ctx context.Context, in *pbl.Alive) (*pbl.Alive, error)

IsAlive Reports liveness of the server

func (*GoServer) LoadData

func (s *GoServer) LoadData(ctx context.Context, key string, consensus float32) ([]byte, error)

func (*GoServer) NewFailMemoryStore

func (s *GoServer) NewFailMemoryStore() translatedStore

NewFailMemoryStore fails

func (*GoServer) NewMemoryStore

func (s *GoServer) NewMemoryStore() translatedStore

NewMemoryStore build a memory store for testing

func (*GoServer) PLog

func (s *GoServer) PLog(ictx context.Context, message string, level pbd.LogLevel)

PLog a simple string message with priority

func (*GoServer) PrepServer

func (s *GoServer) PrepServer(name string)

PrepServer builds out the server for use.

func (*GoServer) PrepServerNoRegister

func (s *GoServer) PrepServerNoRegister(name string, port int32)

PrepServerNoRegister builds out a server that doesn't register

func (*GoServer) RaiseIssue

func (s *GoServer) RaiseIssue(title, body string)

RaiseIssue raises an issue

func (*GoServer) Read

Read a protobuf

func (*GoServer) RegisterLockingTask

func (s *GoServer) RegisterLockingTask(task func(ctx context.Context) (time.Time, error), key string)

RegisterLockingTask registers a locking task to run

func (*GoServer) RegisterRepeatingTask

func (s *GoServer) RegisterRepeatingTask(task func(ctx context.Context) error, key string, freq time.Duration)

RegisterRepeatingTask registers a repeating task with a given frequency

func (*GoServer) RegisterRepeatingTaskNoTrace

func (s *GoServer) RegisterRepeatingTaskNoTrace(task func(ctx context.Context) error, key string, freq time.Duration)

RegisterRepeatingTaskNoTrace registers a repeating task with a given frequency

func (*GoServer) RegisterRepeatingTaskNonMaster

func (s *GoServer) RegisterRepeatingTaskNonMaster(task func(ctx context.Context) error, key string, freq time.Duration)

RegisterRepeatingTaskNonMaster registers a repeating task with a given frequency

func (*GoServer) RegisterServer

func (s *GoServer) RegisterServer(ctx context.Context, servername string, external bool) error

RegisterServerIgnore registers this server with ignore master set.

func (*GoServer) RegisterServerV2

func (s *GoServer) RegisterServerV2(external bool) error

RegisterServerV2 registers this server under the v2 protocol

func (*GoServer) RegisterServingTask

func (s *GoServer) RegisterServingTask(task func(ctx context.Context) error, key string)

RegisterServingTask registers tasks to run when serving

func (*GoServer) ReleaseLockingElection

func (s *GoServer) ReleaseLockingElection(ctx context.Context, key string, lockKey string) error

func (*GoServer) Reregister

Reregister this server

func (*GoServer) RunBackgroundTask

func (s *GoServer) RunBackgroundTask(task func(ctx context.Context) error, name string)

RunBackgroundTask with tracing and tracking

func (*GoServer) RunLockingElection

func (s *GoServer) RunLockingElection(ctx context.Context, key string, detail string) (string, error)

func (*GoServer) RunSudo

func (s *GoServer) RunSudo()

RunSudo runs as sudo

func (*GoServer) Save

func (s *GoServer) Save(ctx context.Context, key string, p proto.Message) error

Save a protobuf

func (*GoServer) SaveData

func (s *GoServer) SaveData(ctx context.Context, data []byte, key string, consensus float32) error

func (*GoServer) SendCrash

func (s *GoServer) SendCrash(ctx context.Context, crashText string, ctype pbbs.Crash_CrashType)

SendCrash reports a crash

func (*GoServer) Serve

func (s *GoServer) Serve(opt ...grpc.ServerOption) error

Serve Runs the server

func (*GoServer) Shutdown

Shutdown brings the server down

func (*GoServer) State

func (s *GoServer) State(ctx context.Context, in *pbl.Empty) (*pbl.ServerState, error)

State gets the state of the server.

type Registerable

type Registerable interface {
	DoRegister(server *grpc.Server)
	ReportHealth() bool
	GetState() []*pbg.State
	Shutdown(ctx context.Context) error

Registerable Allows the system to register itself


Path Synopsis

Jump to

Keyboard shortcuts

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