server

package
v0.0.0-...-b79a0d8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Port     = ":8080"
	QAHold   time.Duration
	PrintDir string
)
View Source
var BuildId string
View Source
var HoldForPrinting chan PrintableDoc
View Source
var ReleaseForPrinting chan string

Functions

func Flags

func Flags()

func NewServer

func NewServer(dbfile string) *allInOneSrvr

func UseMockImpl

func UseMockImpl()

mock impl, stays in memory

Types

type Backender

type Backender interface {
	OpenDB(path string) Persister
}

type Dbase

type Dbase struct {
	sync.Mutex
	// contains filtered or unexported fields
}

A trivial database impl for our data storage needs. Not recommended for any serious use. Sensitive information stored as PLAINTEXT. No auth. Etc etc etc.

All entries stored as protobuf; all items in one db. Log entries stored read-append-write, likely to perform very poorly at scale.

func OpenDB

func OpenDB(path string) *Dbase

func (*Dbase) Close

func (db *Dbase) Close() error

func (*Dbase) Ids

func (db *Dbase) Ids() []string

return all ids that have been used when logging or reporting macs/ipmi macs

func (*Dbase) RetrieveIpmiMacs

func (db *Dbase) RetrieveIpmiMacs(id string) (m pb.MACs, err error)

func (*Dbase) RetrieveLog

func (db *Dbase) RetrieveLog(id string) (m pb.LogEvents, err error)

func (*Dbase) RetrieveMacs

func (db *Dbase) RetrieveMacs(id string) (m pb.MACs, err error)

func (*Dbase) RetrievePass

func (db *Dbase) RetrievePass(id string) (p *pb.Credentials, err error)

WARNING storage of credentials as plain text is a bad idea.

func (*Dbase) StoreIpmiMacs

func (db *Dbase) StoreIpmiMacs(id string, m pb.MACs) error

func (*Dbase) StoreLog

func (db *Dbase) StoreLog(id string, les *pb.LogEvents) error

func (*Dbase) StoreMacs

func (db *Dbase) StoreMacs(id string, m pb.MACs) error

func (*Dbase) StorePass

func (db *Dbase) StorePass(id string, p *pb.Credentials) error

WARNING storage of credentials as plain text is a bad idea.

type HeldDocs

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

type MockSrvr

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

func (*MockSrvr) CheckFinished

func (ms *MockSrvr) CheckFinished(sn, stage string) bool

func (*MockSrvr) Close

func (aio *MockSrvr) Close()

func (*MockSrvr) Entries

func (ms *MockSrvr) Entries(id string) string

func (*MockSrvr) GetCredentials

func (a *MockSrvr) GetCredentials(ctx context.Context, ident *pb.Identifier) (*pb.Credentials, error)

func (*MockSrvr) GetTime

func (a *MockSrvr) GetTime(ctx context.Context, _ *empty.Empty) (*pb.Timestamp, error)

pb.TimekeeperServer

func (*MockSrvr) Ids

func (ms *MockSrvr) Ids() []string

func (*MockSrvr) Log

func (a *MockSrvr) Log(ctx context.Context, evt *pb.LogEvent) (*pb.GenericResponse, error)

pb.LogServiceServer

func (*MockSrvr) MockCreds

func (ms *MockSrvr) MockCreds(sn string) common.Credentials

func (*MockSrvr) MonitorHolds

func (a *MockSrvr) MonitorHolds(done chan struct{}) *sync.WaitGroup

MonitorHolds starts background goroutines to process documents on hold. Set QAHold before calling.

func (*MockSrvr) Port

func (ms *MockSrvr) Port() int

func (*MockSrvr) ReportCodename

func (a *MockSrvr) ReportCodename(ctx context.Context, name *pb.Codename) (*pb.GenericResponse, error)

pb.RecordKeeperServer

func (*MockSrvr) ReportState

func (a *MockSrvr) ReportState(ctx context.Context, s *pb.ProcessStage) (*pb.GenericResponse, error)

func (*MockSrvr) Serve

func (a *MockSrvr) Serve()

func (*MockSrvr) ServeAt

func (a *MockSrvr) ServeAt(port string)

func (*MockSrvr) ServeGrpcWith

func (a *MockSrvr) ServeGrpcWith(lis net.Listener, gsrv *grpc.Server) error

Grpc entry point. lis and gsrv may be nil, in which case defaults are used.

func (*MockSrvr) ServeHttpWith

func (a *MockSrvr) ServeHttpWith(lis net.Listener, srvr *http.Server) error

Http entry point. When used in integ tests, pass non-nil lis and/or srvr to specify port to be used and to allow graceful shutdown, respectively.

func (*MockSrvr) StoreDocument

func (a *MockSrvr) StoreDocument(ctx context.Context, doc *pb.Document) (*pb.GenericResponse, error)

func (*MockSrvr) StoreIPMIMACs

func (a *MockSrvr) StoreIPMIMACs(ctx context.Context, m *pb.MACs) (*pb.GenericResponse, error)

func (*MockSrvr) StoreMACs

func (a *MockSrvr) StoreMACs(ctx context.Context, m *pb.MACs) (*pb.GenericResponse, error)

type Persister

type Persister interface {
	//StoreLog actually appends. All other store operations overwrite.
	StoreLog(id string, les *pb.LogEvents) error
	RetrieveLog(id string) (m pb.LogEvents, err error)
	StoreMacs(id string, m pb.MACs) error
	RetrieveMacs(id string) (m pb.MACs, err error)
	StoreIpmiMacs(id string, m pb.MACs) error
	RetrieveIpmiMacs(id string) (m pb.MACs, err error)
	StorePass(id string, p *pb.Credentials) error
	RetrievePass(id string) (p *pb.Credentials, err error)
	Ids() []string
	Close() error
}

type PrintableDoc

type PrintableDoc struct {
	Expires time.Time
	*pb.Document
}

Jump to

Keyboard shortcuts

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