client: imp docs

This commit is contained in:
Stanislav Chzhen 2024-10-14 15:03:08 +03:00
parent 0b4311ac26
commit f29d8edb89
1 changed files with 6 additions and 4 deletions

View File

@ -85,7 +85,8 @@ type HostsContainer interface {
// StorageConfig is the client storage configuration structure. // StorageConfig is the client storage configuration structure.
type StorageConfig struct { type StorageConfig struct {
// Logger is used for logging the operation of the client storage. // Logger is used for logging the operation of the client storage. It must
// not be nil.
Logger *slog.Logger Logger *slog.Logger
// DHCP is used to match IPs against MACs of persistent clients and update // DHCP is used to match IPs against MACs of persistent clients and update
@ -113,7 +114,8 @@ type StorageConfig struct {
// Storage contains information about persistent and runtime clients. // Storage contains information about persistent and runtime clients.
type Storage struct { type Storage struct {
// logger is used for logging the operation of the client storage. // logger is used for logging the operation of the client storage. It must
// not be nil.
logger *slog.Logger logger *slog.Logger
// mu protects indexes of persistent and runtime clients. // mu protects indexes of persistent and runtime clients.
@ -205,7 +207,7 @@ func (s *Storage) Shutdown(_ context.Context) (err error) {
// periodicARPUpdate periodically reloads runtime clients from ARP. It is // periodicARPUpdate periodically reloads runtime clients from ARP. It is
// intended to be used as a goroutine. // intended to be used as a goroutine.
func (s *Storage) periodicARPUpdate(ctx context.Context) { func (s *Storage) periodicARPUpdate(ctx context.Context) {
slogutil.RecoverAndLog(ctx, s.logger) defer slogutil.RecoverAndLog(ctx, s.logger)
t := time.NewTicker(s.arpClientsUpdatePeriod) t := time.NewTicker(s.arpClientsUpdatePeriod)
@ -270,7 +272,7 @@ func (s *Storage) handleHostsUpdates(ctx context.Context) {
return return
} }
slogutil.RecoverAndLog(ctx, s.logger) defer slogutil.RecoverAndLog(ctx, s.logger)
for { for {
select { select {