log_dict_topic.go 937 B

1234567891011121314151617181920212223242526272829
  1. // package log_dict_topic -- хранитель топиков для логирования.
  2. package log_dict_topic
  3. import (
  4. "gitp78su.ipnodns.ru/svi/kern/v4/d0"
  5. "gitp78su.ipnodns.ru/svi/kern/v4/d2/lti/bus_ent/topic"
  6. "gitp78su.ipnodns.ru/svi/kern/v4/d2/lti/bus_spec"
  7. )
  8. type LogDictTopic struct {
  9. *d0.MSafeMutex
  10. dict map[topic.ATopic]struct{}
  11. client bus_spec.IBusClient
  12. }
  13. // NewLogDictTopic -- возвращает новый словарь топиков для логирования.
  14. func NewLogDictTopic(owner *d0.LOwner, clientBus bus_spec.IBusClient) *d0.Result[*LogDictTopic] {
  15. d0.If(owner==nil).Hassert("NewLogDictTopic(): owner == nil")
  16. if clientBus == nil {
  17. err := d0.LetErr(owner, "NewLogDictTopic(): clientBus == nil")
  18. return d0.ResErr[*LogDictTopic](err)
  19. }
  20. sf := &LogDictTopic{
  21. MSafeMutex: d0.MutSafeMutex(),
  22. dict: map[topic.ATopic]struct{}{},
  23. client: clientBus,
  24. }
  25. return d0.ResOk(sf)
  26. }