MCPcopy
hub / github.com/tinode/chat / initTopicSys

Function initTopicSys

server/init_topic.go:675–706  ·  view source on GitHub ↗

Initialize system topic. System topic is a singleton, always in memory.

(t *Topic)

Source from the content-addressed store, hash-verified

673
674// Initialize system topic. System topic is a singleton, always in memory.
675func initTopicSys(t *Topic) error {
676 t.cat = types.TopicCatSys
677
678 stopic, err := store.Topics.Get(t.name)
679 if err != nil {
680 return err
681 } else if stopic == nil {
682 return types.ErrTopicNotFound
683 }
684
685 if err = t.loadSubscribers(); err != nil {
686 return err
687 }
688
689 // There is no t.owner
690
691 // Default permissions are 'W'
692 t.accessAuth = types.ModeWrite
693 t.accessAnon = types.ModeWrite
694
695 t.public = stopic.Public
696 t.trusted = stopic.Trusted
697
698 t.created = stopic.CreatedAt
699 t.updated = stopic.UpdatedAt
700 if !stopic.TouchedAt.IsZero() {
701 t.touched = stopic.TouchedAt
702 }
703 t.lastID = stopic.SeqId
704
705 return nil
706}
707
708// Initialize or load a self-topic 'slf'.
709func initTopicSlf(t *Topic, sreg *ClientComMessage) error {

Callers 1

topicInitFunction · 0.85

Calls 3

loadSubscribersMethod · 0.80
GetMethod · 0.65
IsZeroMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…