Initialize system topic. System topic is a singleton, always in memory.
(t *Topic)
| 673 | |
| 674 | // Initialize system topic. System topic is a singleton, always in memory. |
| 675 | func 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'. |
| 709 | func initTopicSlf(t *Topic, sreg *ClientComMessage) error { |
no test coverage detected
searching dependent graphs…