Skip to content

Commit

Permalink
client: imp docs
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Oct 14, 2024
1 parent 0b4311a commit f29d8ed
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/client/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ type HostsContainer interface {

// StorageConfig is the client storage configuration structure.
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

// DHCP is used to match IPs against MACs of persistent clients and update
Expand Down Expand Up @@ -113,7 +114,8 @@ type StorageConfig struct {

// Storage contains information about persistent and runtime clients.
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

// mu protects indexes of persistent and runtime clients.
Expand Down Expand Up @@ -205,7 +207,7 @@ func (s *Storage) Shutdown(_ context.Context) (err error) {
// periodicARPUpdate periodically reloads runtime clients from ARP. It is
// intended to be used as a goroutine.
func (s *Storage) periodicARPUpdate(ctx context.Context) {
slogutil.RecoverAndLog(ctx, s.logger)
defer slogutil.RecoverAndLog(ctx, s.logger)

t := time.NewTicker(s.arpClientsUpdatePeriod)

Expand Down Expand Up @@ -270,7 +272,7 @@ func (s *Storage) handleHostsUpdates(ctx context.Context) {
return
}

slogutil.RecoverAndLog(ctx, s.logger)
defer slogutil.RecoverAndLog(ctx, s.logger)

for {
select {
Expand Down

0 comments on commit f29d8ed

Please sign in to comment.