Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultErrorTTL determines how long errors remain in etcd before the key expires DefaultErrorTTL = time.Minute * 24 * 30 // DefaultMaxErrorHistory determines how many latest errors to return when calling GetErrorHistory() DefaultMaxErrorHistory = 1000 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AttachedStream ¶
type AttachedStream struct {
MessageCh chan *protos.ErrorMessage
}
AttachedStream is used to hold a channel which sends protos.ErrorMessage for a gRPC stream to receive
type IUIErrors ¶
type IUIErrors interface { AddError(msg *protos.ErrorMessage) error ConnectClient(id string) *AttachedStream DisconnectClient(id string) GetHistory(ctx context.Context) ([]*protos.ErrorMessage, error) }
type UIErrors ¶
type UIErrors struct { *Config AttachedClientsMtx *sync.RWMutex AttachedClients map[string]*AttachedStream // contains filtered or unexported fields }
func (*UIErrors) AddError ¶
func (u *UIErrors) AddError(msg *protos.ErrorMessage) error
AddError is called by plumber code where we need to send an error to the client
func (*UIErrors) ConnectClient ¶
func (u *UIErrors) ConnectClient(id string) *AttachedStream
ConnectClient is called whenever the streaming gRPC endpoint GetErrors() is called. A new AttachedClient will be added to the AttachedClients. Any stored messages in etcd will be read, sent to the client, and then deleted from etcd.
func (*UIErrors) DisconnectClient ¶
DisconnectClient removes an attached client from the map, and cleans up the channel
func (*UIErrors) GetHistory ¶
GetHistory reads all error messages stored in etcd
Click to show internal directories.
Click to hide internal directories.