github.com/masterhung0112/hk_server/v5@v5.0.0-20220302090640-ec71aef15e1c/store/timerlayer/timerlayer.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 // Code generated by "make store-layers" 5 // DO NOT EDIT 6 7 package timerlayer 8 9 import ( 10 "context" 11 timemodule "time" 12 13 "github.com/masterhung0112/hk_server/v5/einterfaces" 14 "github.com/masterhung0112/hk_server/v5/model" 15 "github.com/masterhung0112/hk_server/v5/store" 16 ) 17 18 type TimerLayer struct { 19 store.Store 20 Metrics einterfaces.MetricsInterface 21 AuditStore store.AuditStore 22 BotStore store.BotStore 23 ChannelStore store.ChannelStore 24 ChannelMemberHistoryStore store.ChannelMemberHistoryStore 25 ClusterDiscoveryStore store.ClusterDiscoveryStore 26 CommandStore store.CommandStore 27 CommandWebhookStore store.CommandWebhookStore 28 ComplianceStore store.ComplianceStore 29 EmojiStore store.EmojiStore 30 FileInfoStore store.FileInfoStore 31 GroupStore store.GroupStore 32 JobStore store.JobStore 33 LicenseStore store.LicenseStore 34 LinkMetadataStore store.LinkMetadataStore 35 OAuthStore store.OAuthStore 36 PluginStore store.PluginStore 37 PostStore store.PostStore 38 PreferenceStore store.PreferenceStore 39 ProductNoticesStore store.ProductNoticesStore 40 ReactionStore store.ReactionStore 41 RemoteClusterStore store.RemoteClusterStore 42 RetentionPolicyStore store.RetentionPolicyStore 43 RoleStore store.RoleStore 44 SchemeStore store.SchemeStore 45 SessionStore store.SessionStore 46 SharedChannelStore store.SharedChannelStore 47 StatusStore store.StatusStore 48 SystemStore store.SystemStore 49 TeamStore store.TeamStore 50 TermsOfServiceStore store.TermsOfServiceStore 51 ThreadStore store.ThreadStore 52 TokenStore store.TokenStore 53 TrackPointStore store.TrackPointStore 54 TrackRecordStore store.TrackRecordStore 55 UploadSessionStore store.UploadSessionStore 56 UserStore store.UserStore 57 UserAccessTokenStore store.UserAccessTokenStore 58 UserTermsOfServiceStore store.UserTermsOfServiceStore 59 WebhookStore store.WebhookStore 60 } 61 62 func (s *TimerLayer) Audit() store.AuditStore { 63 return s.AuditStore 64 } 65 66 func (s *TimerLayer) Bot() store.BotStore { 67 return s.BotStore 68 } 69 70 func (s *TimerLayer) Channel() store.ChannelStore { 71 return s.ChannelStore 72 } 73 74 func (s *TimerLayer) ChannelMemberHistory() store.ChannelMemberHistoryStore { 75 return s.ChannelMemberHistoryStore 76 } 77 78 func (s *TimerLayer) ClusterDiscovery() store.ClusterDiscoveryStore { 79 return s.ClusterDiscoveryStore 80 } 81 82 func (s *TimerLayer) Command() store.CommandStore { 83 return s.CommandStore 84 } 85 86 func (s *TimerLayer) CommandWebhook() store.CommandWebhookStore { 87 return s.CommandWebhookStore 88 } 89 90 func (s *TimerLayer) Compliance() store.ComplianceStore { 91 return s.ComplianceStore 92 } 93 94 func (s *TimerLayer) Emoji() store.EmojiStore { 95 return s.EmojiStore 96 } 97 98 func (s *TimerLayer) FileInfo() store.FileInfoStore { 99 return s.FileInfoStore 100 } 101 102 func (s *TimerLayer) Group() store.GroupStore { 103 return s.GroupStore 104 } 105 106 func (s *TimerLayer) Job() store.JobStore { 107 return s.JobStore 108 } 109 110 func (s *TimerLayer) License() store.LicenseStore { 111 return s.LicenseStore 112 } 113 114 func (s *TimerLayer) LinkMetadata() store.LinkMetadataStore { 115 return s.LinkMetadataStore 116 } 117 118 func (s *TimerLayer) OAuth() store.OAuthStore { 119 return s.OAuthStore 120 } 121 122 func (s *TimerLayer) Plugin() store.PluginStore { 123 return s.PluginStore 124 } 125 126 func (s *TimerLayer) Post() store.PostStore { 127 return s.PostStore 128 } 129 130 func (s *TimerLayer) Preference() store.PreferenceStore { 131 return s.PreferenceStore 132 } 133 134 func (s *TimerLayer) ProductNotices() store.ProductNoticesStore { 135 return s.ProductNoticesStore 136 } 137 138 func (s *TimerLayer) Reaction() store.ReactionStore { 139 return s.ReactionStore 140 } 141 142 func (s *TimerLayer) RemoteCluster() store.RemoteClusterStore { 143 return s.RemoteClusterStore 144 } 145 146 func (s *TimerLayer) RetentionPolicy() store.RetentionPolicyStore { 147 return s.RetentionPolicyStore 148 } 149 150 func (s *TimerLayer) Role() store.RoleStore { 151 return s.RoleStore 152 } 153 154 func (s *TimerLayer) Scheme() store.SchemeStore { 155 return s.SchemeStore 156 } 157 158 func (s *TimerLayer) Session() store.SessionStore { 159 return s.SessionStore 160 } 161 162 func (s *TimerLayer) SharedChannel() store.SharedChannelStore { 163 return s.SharedChannelStore 164 } 165 166 func (s *TimerLayer) Status() store.StatusStore { 167 return s.StatusStore 168 } 169 170 func (s *TimerLayer) System() store.SystemStore { 171 return s.SystemStore 172 } 173 174 func (s *TimerLayer) Team() store.TeamStore { 175 return s.TeamStore 176 } 177 178 func (s *TimerLayer) TermsOfService() store.TermsOfServiceStore { 179 return s.TermsOfServiceStore 180 } 181 182 func (s *TimerLayer) Thread() store.ThreadStore { 183 return s.ThreadStore 184 } 185 186 func (s *TimerLayer) Token() store.TokenStore { 187 return s.TokenStore 188 } 189 190 func (s *TimerLayer) TrackPoint() store.TrackPointStore { 191 return s.TrackPointStore 192 } 193 194 func (s *TimerLayer) TrackRecord() store.TrackRecordStore { 195 return s.TrackRecordStore 196 } 197 198 func (s *TimerLayer) UploadSession() store.UploadSessionStore { 199 return s.UploadSessionStore 200 } 201 202 func (s *TimerLayer) User() store.UserStore { 203 return s.UserStore 204 } 205 206 func (s *TimerLayer) UserAccessToken() store.UserAccessTokenStore { 207 return s.UserAccessTokenStore 208 } 209 210 func (s *TimerLayer) UserTermsOfService() store.UserTermsOfServiceStore { 211 return s.UserTermsOfServiceStore 212 } 213 214 func (s *TimerLayer) Webhook() store.WebhookStore { 215 return s.WebhookStore 216 } 217 218 type TimerLayerAuditStore struct { 219 store.AuditStore 220 Root *TimerLayer 221 } 222 223 type TimerLayerBotStore struct { 224 store.BotStore 225 Root *TimerLayer 226 } 227 228 type TimerLayerChannelStore struct { 229 store.ChannelStore 230 Root *TimerLayer 231 } 232 233 type TimerLayerChannelMemberHistoryStore struct { 234 store.ChannelMemberHistoryStore 235 Root *TimerLayer 236 } 237 238 type TimerLayerClusterDiscoveryStore struct { 239 store.ClusterDiscoveryStore 240 Root *TimerLayer 241 } 242 243 type TimerLayerCommandStore struct { 244 store.CommandStore 245 Root *TimerLayer 246 } 247 248 type TimerLayerCommandWebhookStore struct { 249 store.CommandWebhookStore 250 Root *TimerLayer 251 } 252 253 type TimerLayerComplianceStore struct { 254 store.ComplianceStore 255 Root *TimerLayer 256 } 257 258 type TimerLayerEmojiStore struct { 259 store.EmojiStore 260 Root *TimerLayer 261 } 262 263 type TimerLayerFileInfoStore struct { 264 store.FileInfoStore 265 Root *TimerLayer 266 } 267 268 type TimerLayerGroupStore struct { 269 store.GroupStore 270 Root *TimerLayer 271 } 272 273 type TimerLayerJobStore struct { 274 store.JobStore 275 Root *TimerLayer 276 } 277 278 type TimerLayerLicenseStore struct { 279 store.LicenseStore 280 Root *TimerLayer 281 } 282 283 type TimerLayerLinkMetadataStore struct { 284 store.LinkMetadataStore 285 Root *TimerLayer 286 } 287 288 type TimerLayerOAuthStore struct { 289 store.OAuthStore 290 Root *TimerLayer 291 } 292 293 type TimerLayerPluginStore struct { 294 store.PluginStore 295 Root *TimerLayer 296 } 297 298 type TimerLayerPostStore struct { 299 store.PostStore 300 Root *TimerLayer 301 } 302 303 type TimerLayerPreferenceStore struct { 304 store.PreferenceStore 305 Root *TimerLayer 306 } 307 308 type TimerLayerProductNoticesStore struct { 309 store.ProductNoticesStore 310 Root *TimerLayer 311 } 312 313 type TimerLayerReactionStore struct { 314 store.ReactionStore 315 Root *TimerLayer 316 } 317 318 type TimerLayerRemoteClusterStore struct { 319 store.RemoteClusterStore 320 Root *TimerLayer 321 } 322 323 type TimerLayerRetentionPolicyStore struct { 324 store.RetentionPolicyStore 325 Root *TimerLayer 326 } 327 328 type TimerLayerRoleStore struct { 329 store.RoleStore 330 Root *TimerLayer 331 } 332 333 type TimerLayerSchemeStore struct { 334 store.SchemeStore 335 Root *TimerLayer 336 } 337 338 type TimerLayerSessionStore struct { 339 store.SessionStore 340 Root *TimerLayer 341 } 342 343 type TimerLayerSharedChannelStore struct { 344 store.SharedChannelStore 345 Root *TimerLayer 346 } 347 348 type TimerLayerStatusStore struct { 349 store.StatusStore 350 Root *TimerLayer 351 } 352 353 type TimerLayerSystemStore struct { 354 store.SystemStore 355 Root *TimerLayer 356 } 357 358 type TimerLayerTeamStore struct { 359 store.TeamStore 360 Root *TimerLayer 361 } 362 363 type TimerLayerTermsOfServiceStore struct { 364 store.TermsOfServiceStore 365 Root *TimerLayer 366 } 367 368 type TimerLayerThreadStore struct { 369 store.ThreadStore 370 Root *TimerLayer 371 } 372 373 type TimerLayerTokenStore struct { 374 store.TokenStore 375 Root *TimerLayer 376 } 377 378 type TimerLayerTrackPointStore struct { 379 store.TrackPointStore 380 Root *TimerLayer 381 } 382 383 type TimerLayerTrackRecordStore struct { 384 store.TrackRecordStore 385 Root *TimerLayer 386 } 387 388 type TimerLayerUploadSessionStore struct { 389 store.UploadSessionStore 390 Root *TimerLayer 391 } 392 393 type TimerLayerUserStore struct { 394 store.UserStore 395 Root *TimerLayer 396 } 397 398 type TimerLayerUserAccessTokenStore struct { 399 store.UserAccessTokenStore 400 Root *TimerLayer 401 } 402 403 type TimerLayerUserTermsOfServiceStore struct { 404 store.UserTermsOfServiceStore 405 Root *TimerLayer 406 } 407 408 type TimerLayerWebhookStore struct { 409 store.WebhookStore 410 Root *TimerLayer 411 } 412 413 func (s *TimerLayerAuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { 414 start := timemodule.Now() 415 416 result, err := s.AuditStore.Get(user_id, offset, limit) 417 418 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 419 if s.Root.Metrics != nil { 420 success := "false" 421 if err == nil { 422 success = "true" 423 } 424 s.Root.Metrics.ObserveStoreMethodDuration("AuditStore.Get", success, elapsed) 425 } 426 return result, err 427 } 428 429 func (s *TimerLayerAuditStore) PermanentDeleteByUser(userID string) error { 430 start := timemodule.Now() 431 432 err := s.AuditStore.PermanentDeleteByUser(userID) 433 434 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 435 if s.Root.Metrics != nil { 436 success := "false" 437 if err == nil { 438 success = "true" 439 } 440 s.Root.Metrics.ObserveStoreMethodDuration("AuditStore.PermanentDeleteByUser", success, elapsed) 441 } 442 return err 443 } 444 445 func (s *TimerLayerAuditStore) Save(audit *model.Audit) error { 446 start := timemodule.Now() 447 448 err := s.AuditStore.Save(audit) 449 450 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 451 if s.Root.Metrics != nil { 452 success := "false" 453 if err == nil { 454 success = "true" 455 } 456 s.Root.Metrics.ObserveStoreMethodDuration("AuditStore.Save", success, elapsed) 457 } 458 return err 459 } 460 461 func (s *TimerLayerBotStore) Get(userID string, includeDeleted bool) (*model.Bot, error) { 462 start := timemodule.Now() 463 464 result, err := s.BotStore.Get(userID, includeDeleted) 465 466 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 467 if s.Root.Metrics != nil { 468 success := "false" 469 if err == nil { 470 success = "true" 471 } 472 s.Root.Metrics.ObserveStoreMethodDuration("BotStore.Get", success, elapsed) 473 } 474 return result, err 475 } 476 477 func (s *TimerLayerBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, error) { 478 start := timemodule.Now() 479 480 result, err := s.BotStore.GetAll(options) 481 482 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 483 if s.Root.Metrics != nil { 484 success := "false" 485 if err == nil { 486 success = "true" 487 } 488 s.Root.Metrics.ObserveStoreMethodDuration("BotStore.GetAll", success, elapsed) 489 } 490 return result, err 491 } 492 493 func (s *TimerLayerBotStore) PermanentDelete(userID string) error { 494 start := timemodule.Now() 495 496 err := s.BotStore.PermanentDelete(userID) 497 498 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 499 if s.Root.Metrics != nil { 500 success := "false" 501 if err == nil { 502 success = "true" 503 } 504 s.Root.Metrics.ObserveStoreMethodDuration("BotStore.PermanentDelete", success, elapsed) 505 } 506 return err 507 } 508 509 func (s *TimerLayerBotStore) Save(bot *model.Bot) (*model.Bot, error) { 510 start := timemodule.Now() 511 512 result, err := s.BotStore.Save(bot) 513 514 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 515 if s.Root.Metrics != nil { 516 success := "false" 517 if err == nil { 518 success = "true" 519 } 520 s.Root.Metrics.ObserveStoreMethodDuration("BotStore.Save", success, elapsed) 521 } 522 return result, err 523 } 524 525 func (s *TimerLayerBotStore) Update(bot *model.Bot) (*model.Bot, error) { 526 start := timemodule.Now() 527 528 result, err := s.BotStore.Update(bot) 529 530 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 531 if s.Root.Metrics != nil { 532 success := "false" 533 if err == nil { 534 success = "true" 535 } 536 s.Root.Metrics.ObserveStoreMethodDuration("BotStore.Update", success, elapsed) 537 } 538 return result, err 539 } 540 541 func (s *TimerLayerChannelStore) AnalyticsDeletedTypeCount(teamID string, channelType string) (int64, error) { 542 start := timemodule.Now() 543 544 result, err := s.ChannelStore.AnalyticsDeletedTypeCount(teamID, channelType) 545 546 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 547 if s.Root.Metrics != nil { 548 success := "false" 549 if err == nil { 550 success = "true" 551 } 552 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.AnalyticsDeletedTypeCount", success, elapsed) 553 } 554 return result, err 555 } 556 557 func (s *TimerLayerChannelStore) AnalyticsTypeCount(teamID string, channelType string) (int64, error) { 558 start := timemodule.Now() 559 560 result, err := s.ChannelStore.AnalyticsTypeCount(teamID, channelType) 561 562 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 563 if s.Root.Metrics != nil { 564 success := "false" 565 if err == nil { 566 success = "true" 567 } 568 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.AnalyticsTypeCount", success, elapsed) 569 } 570 return result, err 571 } 572 573 func (s *TimerLayerChannelStore) AutocompleteInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) { 574 start := timemodule.Now() 575 576 result, err := s.ChannelStore.AutocompleteInTeam(teamID, term, includeDeleted) 577 578 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 579 if s.Root.Metrics != nil { 580 success := "false" 581 if err == nil { 582 success = "true" 583 } 584 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.AutocompleteInTeam", success, elapsed) 585 } 586 return result, err 587 } 588 589 func (s *TimerLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (*model.ChannelList, error) { 590 start := timemodule.Now() 591 592 result, err := s.ChannelStore.AutocompleteInTeamForSearch(teamID, userID, term, includeDeleted) 593 594 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 595 if s.Root.Metrics != nil { 596 success := "false" 597 if err == nil { 598 success = "true" 599 } 600 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.AutocompleteInTeamForSearch", success, elapsed) 601 } 602 return result, err 603 } 604 605 func (s *TimerLayerChannelStore) ClearAllCustomRoleAssignments() error { 606 start := timemodule.Now() 607 608 err := s.ChannelStore.ClearAllCustomRoleAssignments() 609 610 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 611 if s.Root.Metrics != nil { 612 success := "false" 613 if err == nil { 614 success = "true" 615 } 616 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.ClearAllCustomRoleAssignments", success, elapsed) 617 } 618 return err 619 } 620 621 func (s *TimerLayerChannelStore) ClearCaches() { 622 start := timemodule.Now() 623 624 s.ChannelStore.ClearCaches() 625 626 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 627 if s.Root.Metrics != nil { 628 success := "false" 629 if true { 630 success = "true" 631 } 632 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.ClearCaches", success, elapsed) 633 } 634 } 635 636 func (s *TimerLayerChannelStore) ClearSidebarOnTeamLeave(userID string, teamID string) error { 637 start := timemodule.Now() 638 639 err := s.ChannelStore.ClearSidebarOnTeamLeave(userID, teamID) 640 641 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 642 if s.Root.Metrics != nil { 643 success := "false" 644 if err == nil { 645 success = "true" 646 } 647 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.ClearSidebarOnTeamLeave", success, elapsed) 648 } 649 return err 650 } 651 652 func (s *TimerLayerChannelStore) CountPostsAfter(channelID string, timestamp int64, userID string) (int, int, error) { 653 start := timemodule.Now() 654 655 result, resultVar1, err := s.ChannelStore.CountPostsAfter(channelID, timestamp, userID) 656 657 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 658 if s.Root.Metrics != nil { 659 success := "false" 660 if err == nil { 661 success = "true" 662 } 663 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.CountPostsAfter", success, elapsed) 664 } 665 return result, resultVar1, err 666 } 667 668 func (s *TimerLayerChannelStore) CreateDirectChannel(userID *model.User, otherUserID *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error) { 669 start := timemodule.Now() 670 671 result, err := s.ChannelStore.CreateDirectChannel(userID, otherUserID, channelOptions...) 672 673 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 674 if s.Root.Metrics != nil { 675 success := "false" 676 if err == nil { 677 success = "true" 678 } 679 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.CreateDirectChannel", success, elapsed) 680 } 681 return result, err 682 } 683 684 func (s *TimerLayerChannelStore) CreateInitialSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) { 685 start := timemodule.Now() 686 687 result, err := s.ChannelStore.CreateInitialSidebarCategories(userID, teamID) 688 689 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 690 if s.Root.Metrics != nil { 691 success := "false" 692 if err == nil { 693 success = "true" 694 } 695 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.CreateInitialSidebarCategories", success, elapsed) 696 } 697 return result, err 698 } 699 700 func (s *TimerLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { 701 start := timemodule.Now() 702 703 result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory) 704 705 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 706 if s.Root.Metrics != nil { 707 success := "false" 708 if err == nil { 709 success = "true" 710 } 711 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.CreateSidebarCategory", success, elapsed) 712 } 713 return result, err 714 } 715 716 func (s *TimerLayerChannelStore) Delete(channelID string, time int64) error { 717 start := timemodule.Now() 718 719 err := s.ChannelStore.Delete(channelID, time) 720 721 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 722 if s.Root.Metrics != nil { 723 success := "false" 724 if err == nil { 725 success = "true" 726 } 727 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.Delete", success, elapsed) 728 } 729 return err 730 } 731 732 func (s *TimerLayerChannelStore) DeleteSidebarCategory(categoryID string) error { 733 start := timemodule.Now() 734 735 err := s.ChannelStore.DeleteSidebarCategory(categoryID) 736 737 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 738 if s.Root.Metrics != nil { 739 success := "false" 740 if err == nil { 741 success = "true" 742 } 743 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.DeleteSidebarCategory", success, elapsed) 744 } 745 return err 746 } 747 748 func (s *TimerLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error { 749 start := timemodule.Now() 750 751 err := s.ChannelStore.DeleteSidebarChannelsByPreferences(preferences) 752 753 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 754 if s.Root.Metrics != nil { 755 success := "false" 756 if err == nil { 757 success = "true" 758 } 759 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.DeleteSidebarChannelsByPreferences", success, elapsed) 760 } 761 return err 762 } 763 764 func (s *TimerLayerChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error) { 765 start := timemodule.Now() 766 767 result, err := s.ChannelStore.Get(id, allowFromCache) 768 769 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 770 if s.Root.Metrics != nil { 771 success := "false" 772 if err == nil { 773 success = "true" 774 } 775 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.Get", success, elapsed) 776 } 777 return result, err 778 } 779 780 func (s *TimerLayerChannelStore) GetAll(teamID string) ([]*model.Channel, error) { 781 start := timemodule.Now() 782 783 result, err := s.ChannelStore.GetAll(teamID) 784 785 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 786 if s.Root.Metrics != nil { 787 success := "false" 788 if err == nil { 789 success = "true" 790 } 791 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAll", success, elapsed) 792 } 793 return result, err 794 } 795 796 func (s *TimerLayerChannelStore) GetAllChannelMembersForUser(userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error) { 797 start := timemodule.Now() 798 799 result, err := s.ChannelStore.GetAllChannelMembersForUser(userID, allowFromCache, includeDeleted) 800 801 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 802 if s.Root.Metrics != nil { 803 success := "false" 804 if err == nil { 805 success = "true" 806 } 807 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAllChannelMembersForUser", success, elapsed) 808 } 809 return result, err 810 } 811 812 func (s *TimerLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel(channelID string, allowFromCache bool) (map[string]model.StringMap, error) { 813 start := timemodule.Now() 814 815 result, err := s.ChannelStore.GetAllChannelMembersNotifyPropsForChannel(channelID, allowFromCache) 816 817 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 818 if s.Root.Metrics != nil { 819 success := "false" 820 if err == nil { 821 success = "true" 822 } 823 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAllChannelMembersNotifyPropsForChannel", success, elapsed) 824 } 825 return result, err 826 } 827 828 func (s *TimerLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error) { 829 start := timemodule.Now() 830 831 result, err := s.ChannelStore.GetAllChannels(page, perPage, opts) 832 833 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 834 if s.Root.Metrics != nil { 835 success := "false" 836 if err == nil { 837 success = "true" 838 } 839 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAllChannels", success, elapsed) 840 } 841 return result, err 842 } 843 844 func (s *TimerLayerChannelStore) GetAllChannelsCount(opts store.ChannelSearchOpts) (int64, error) { 845 start := timemodule.Now() 846 847 result, err := s.ChannelStore.GetAllChannelsCount(opts) 848 849 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 850 if s.Root.Metrics != nil { 851 success := "false" 852 if err == nil { 853 success = "true" 854 } 855 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAllChannelsCount", success, elapsed) 856 } 857 return result, err 858 } 859 860 func (s *TimerLayerChannelStore) GetAllChannelsForExportAfter(limit int, afterID string) ([]*model.ChannelForExport, error) { 861 start := timemodule.Now() 862 863 result, err := s.ChannelStore.GetAllChannelsForExportAfter(limit, afterID) 864 865 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 866 if s.Root.Metrics != nil { 867 success := "false" 868 if err == nil { 869 success = "true" 870 } 871 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAllChannelsForExportAfter", success, elapsed) 872 } 873 return result, err 874 } 875 876 func (s *TimerLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, afterID string) ([]*model.DirectChannelForExport, error) { 877 start := timemodule.Now() 878 879 result, err := s.ChannelStore.GetAllDirectChannelsForExportAfter(limit, afterID) 880 881 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 882 if s.Root.Metrics != nil { 883 success := "false" 884 if err == nil { 885 success = "true" 886 } 887 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetAllDirectChannelsForExportAfter", success, elapsed) 888 } 889 return result, err 890 } 891 892 func (s *TimerLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { 893 start := timemodule.Now() 894 895 result, err := s.ChannelStore.GetByName(team_id, name, allowFromCache) 896 897 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 898 if s.Root.Metrics != nil { 899 success := "false" 900 if err == nil { 901 success = "true" 902 } 903 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetByName", success, elapsed) 904 } 905 return result, err 906 } 907 908 func (s *TimerLayerChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { 909 start := timemodule.Now() 910 911 result, err := s.ChannelStore.GetByNameIncludeDeleted(team_id, name, allowFromCache) 912 913 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 914 if s.Root.Metrics != nil { 915 success := "false" 916 if err == nil { 917 success = "true" 918 } 919 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetByNameIncludeDeleted", success, elapsed) 920 } 921 return result, err 922 } 923 924 func (s *TimerLayerChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { 925 start := timemodule.Now() 926 927 result, err := s.ChannelStore.GetByNames(team_id, names, allowFromCache) 928 929 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 930 if s.Root.Metrics != nil { 931 success := "false" 932 if err == nil { 933 success = "true" 934 } 935 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetByNames", success, elapsed) 936 } 937 return result, err 938 } 939 940 func (s *TimerLayerChannelStore) GetChannelCounts(teamID string, userID string) (*model.ChannelCounts, error) { 941 start := timemodule.Now() 942 943 result, err := s.ChannelStore.GetChannelCounts(teamID, userID) 944 945 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 946 if s.Root.Metrics != nil { 947 success := "false" 948 if err == nil { 949 success = "true" 950 } 951 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelCounts", success, elapsed) 952 } 953 return result, err 954 } 955 956 func (s *TimerLayerChannelStore) GetChannelMembersForExport(userID string, teamID string) ([]*model.ChannelMemberForExport, error) { 957 start := timemodule.Now() 958 959 result, err := s.ChannelStore.GetChannelMembersForExport(userID, teamID) 960 961 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 962 if s.Root.Metrics != nil { 963 success := "false" 964 if err == nil { 965 success = "true" 966 } 967 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelMembersForExport", success, elapsed) 968 } 969 return result, err 970 } 971 972 func (s *TimerLayerChannelStore) GetChannelMembersTimezones(channelID string) ([]model.StringMap, error) { 973 start := timemodule.Now() 974 975 result, err := s.ChannelStore.GetChannelMembersTimezones(channelID) 976 977 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 978 if s.Root.Metrics != nil { 979 success := "false" 980 if err == nil { 981 success = "true" 982 } 983 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelMembersTimezones", success, elapsed) 984 } 985 return result, err 986 } 987 988 func (s *TimerLayerChannelStore) GetChannelUnread(channelID string, userID string) (*model.ChannelUnread, error) { 989 start := timemodule.Now() 990 991 result, err := s.ChannelStore.GetChannelUnread(channelID, userID) 992 993 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 994 if s.Root.Metrics != nil { 995 success := "false" 996 if err == nil { 997 success = "true" 998 } 999 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelUnread", success, elapsed) 1000 } 1001 return result, err 1002 } 1003 1004 func (s *TimerLayerChannelStore) GetChannels(teamID string, userID string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error) { 1005 start := timemodule.Now() 1006 1007 result, err := s.ChannelStore.GetChannels(teamID, userID, includeDeleted, lastDeleteAt) 1008 1009 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1010 if s.Root.Metrics != nil { 1011 success := "false" 1012 if err == nil { 1013 success = "true" 1014 } 1015 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannels", success, elapsed) 1016 } 1017 return result, err 1018 } 1019 1020 func (s *TimerLayerChannelStore) GetChannelsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.Channel, error) { 1021 start := timemodule.Now() 1022 1023 result, err := s.ChannelStore.GetChannelsBatchForIndexing(startTime, endTime, limit) 1024 1025 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1026 if s.Root.Metrics != nil { 1027 success := "false" 1028 if err == nil { 1029 success = "true" 1030 } 1031 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelsBatchForIndexing", success, elapsed) 1032 } 1033 return result, err 1034 } 1035 1036 func (s *TimerLayerChannelStore) GetChannelsByIds(channelIds []string, includeDeleted bool) ([]*model.Channel, error) { 1037 start := timemodule.Now() 1038 1039 result, err := s.ChannelStore.GetChannelsByIds(channelIds, includeDeleted) 1040 1041 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1042 if s.Root.Metrics != nil { 1043 success := "false" 1044 if err == nil { 1045 success = "true" 1046 } 1047 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelsByIds", success, elapsed) 1048 } 1049 return result, err 1050 } 1051 1052 func (s *TimerLayerChannelStore) GetChannelsByScheme(schemeID string, offset int, limit int) (model.ChannelList, error) { 1053 start := timemodule.Now() 1054 1055 result, err := s.ChannelStore.GetChannelsByScheme(schemeID, offset, limit) 1056 1057 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1058 if s.Root.Metrics != nil { 1059 success := "false" 1060 if err == nil { 1061 success = "true" 1062 } 1063 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetChannelsByScheme", success, elapsed) 1064 } 1065 return result, err 1066 } 1067 1068 func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (*model.ChannelList, error) { 1069 start := timemodule.Now() 1070 1071 result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID) 1072 1073 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1074 if s.Root.Metrics != nil { 1075 success := "false" 1076 if err == nil { 1077 success = "true" 1078 } 1079 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetDeleted", success, elapsed) 1080 } 1081 return result, err 1082 } 1083 1084 func (s *TimerLayerChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { 1085 start := timemodule.Now() 1086 1087 result, err := s.ChannelStore.GetDeletedByName(team_id, name) 1088 1089 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1090 if s.Root.Metrics != nil { 1091 success := "false" 1092 if err == nil { 1093 success = "true" 1094 } 1095 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetDeletedByName", success, elapsed) 1096 } 1097 return result, err 1098 } 1099 1100 func (s *TimerLayerChannelStore) GetForPost(postID string) (*model.Channel, error) { 1101 start := timemodule.Now() 1102 1103 result, err := s.ChannelStore.GetForPost(postID) 1104 1105 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1106 if s.Root.Metrics != nil { 1107 success := "false" 1108 if err == nil { 1109 success = "true" 1110 } 1111 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetForPost", success, elapsed) 1112 } 1113 return result, err 1114 } 1115 1116 func (s *TimerLayerChannelStore) GetFromMaster(id string) (*model.Channel, error) { 1117 start := timemodule.Now() 1118 1119 result, err := s.ChannelStore.GetFromMaster(id) 1120 1121 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1122 if s.Root.Metrics != nil { 1123 success := "false" 1124 if err == nil { 1125 success = "true" 1126 } 1127 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetFromMaster", success, elapsed) 1128 } 1129 return result, err 1130 } 1131 1132 func (s *TimerLayerChannelStore) GetGuestCount(channelID string, allowFromCache bool) (int64, error) { 1133 start := timemodule.Now() 1134 1135 result, err := s.ChannelStore.GetGuestCount(channelID, allowFromCache) 1136 1137 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1138 if s.Root.Metrics != nil { 1139 success := "false" 1140 if err == nil { 1141 success = "true" 1142 } 1143 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetGuestCount", success, elapsed) 1144 } 1145 return result, err 1146 } 1147 1148 func (s *TimerLayerChannelStore) GetMember(ctx context.Context, channelID string, userID string) (*model.ChannelMember, error) { 1149 start := timemodule.Now() 1150 1151 result, err := s.ChannelStore.GetMember(ctx, channelID, userID) 1152 1153 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1154 if s.Root.Metrics != nil { 1155 success := "false" 1156 if err == nil { 1157 success = "true" 1158 } 1159 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMember", success, elapsed) 1160 } 1161 return result, err 1162 } 1163 1164 func (s *TimerLayerChannelStore) GetMemberCount(channelID string, allowFromCache bool) (int64, error) { 1165 start := timemodule.Now() 1166 1167 result, err := s.ChannelStore.GetMemberCount(channelID, allowFromCache) 1168 1169 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1170 if s.Root.Metrics != nil { 1171 success := "false" 1172 if err == nil { 1173 success = "true" 1174 } 1175 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMemberCount", success, elapsed) 1176 } 1177 return result, err 1178 } 1179 1180 func (s *TimerLayerChannelStore) GetMemberCountFromCache(channelID string) int64 { 1181 start := timemodule.Now() 1182 1183 result := s.ChannelStore.GetMemberCountFromCache(channelID) 1184 1185 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1186 if s.Root.Metrics != nil { 1187 success := "false" 1188 if true { 1189 success = "true" 1190 } 1191 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMemberCountFromCache", success, elapsed) 1192 } 1193 return result 1194 } 1195 1196 func (s *TimerLayerChannelStore) GetMemberCountsByGroup(ctx context.Context, channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, error) { 1197 start := timemodule.Now() 1198 1199 result, err := s.ChannelStore.GetMemberCountsByGroup(ctx, channelID, includeTimezones) 1200 1201 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1202 if s.Root.Metrics != nil { 1203 success := "false" 1204 if err == nil { 1205 success = "true" 1206 } 1207 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMemberCountsByGroup", success, elapsed) 1208 } 1209 return result, err 1210 } 1211 1212 func (s *TimerLayerChannelStore) GetMemberForPost(postID string, userID string) (*model.ChannelMember, error) { 1213 start := timemodule.Now() 1214 1215 result, err := s.ChannelStore.GetMemberForPost(postID, userID) 1216 1217 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1218 if s.Root.Metrics != nil { 1219 success := "false" 1220 if err == nil { 1221 success = "true" 1222 } 1223 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMemberForPost", success, elapsed) 1224 } 1225 return result, err 1226 } 1227 1228 func (s *TimerLayerChannelStore) GetMembers(channelID string, offset int, limit int) (*model.ChannelMembers, error) { 1229 start := timemodule.Now() 1230 1231 result, err := s.ChannelStore.GetMembers(channelID, offset, limit) 1232 1233 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1234 if s.Root.Metrics != nil { 1235 success := "false" 1236 if err == nil { 1237 success = "true" 1238 } 1239 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMembers", success, elapsed) 1240 } 1241 return result, err 1242 } 1243 1244 func (s *TimerLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (*model.ChannelMembers, error) { 1245 start := timemodule.Now() 1246 1247 result, err := s.ChannelStore.GetMembersByChannelIds(channelIds, userID) 1248 1249 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1250 if s.Root.Metrics != nil { 1251 success := "false" 1252 if err == nil { 1253 success = "true" 1254 } 1255 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMembersByChannelIds", success, elapsed) 1256 } 1257 return result, err 1258 } 1259 1260 func (s *TimerLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (*model.ChannelMembers, error) { 1261 start := timemodule.Now() 1262 1263 result, err := s.ChannelStore.GetMembersByIds(channelID, userIds) 1264 1265 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1266 if s.Root.Metrics != nil { 1267 success := "false" 1268 if err == nil { 1269 success = "true" 1270 } 1271 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMembersByIds", success, elapsed) 1272 } 1273 return result, err 1274 } 1275 1276 func (s *TimerLayerChannelStore) GetMembersForUser(teamID string, userID string) (*model.ChannelMembers, error) { 1277 start := timemodule.Now() 1278 1279 result, err := s.ChannelStore.GetMembersForUser(teamID, userID) 1280 1281 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1282 if s.Root.Metrics != nil { 1283 success := "false" 1284 if err == nil { 1285 success = "true" 1286 } 1287 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMembersForUser", success, elapsed) 1288 } 1289 return result, err 1290 } 1291 1292 func (s *TimerLayerChannelStore) GetMembersForUserWithPagination(teamID string, userID string, page int, perPage int) (*model.ChannelMembers, error) { 1293 start := timemodule.Now() 1294 1295 result, err := s.ChannelStore.GetMembersForUserWithPagination(teamID, userID, page, perPage) 1296 1297 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1298 if s.Root.Metrics != nil { 1299 success := "false" 1300 if err == nil { 1301 success = "true" 1302 } 1303 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMembersForUserWithPagination", success, elapsed) 1304 } 1305 return result, err 1306 } 1307 1308 func (s *TimerLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (*model.ChannelList, error) { 1309 start := timemodule.Now() 1310 1311 result, err := s.ChannelStore.GetMoreChannels(teamID, userID, offset, limit) 1312 1313 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1314 if s.Root.Metrics != nil { 1315 success := "false" 1316 if err == nil { 1317 success = "true" 1318 } 1319 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetMoreChannels", success, elapsed) 1320 } 1321 return result, err 1322 } 1323 1324 func (s *TimerLayerChannelStore) GetPinnedPostCount(channelID string, allowFromCache bool) (int64, error) { 1325 start := timemodule.Now() 1326 1327 result, err := s.ChannelStore.GetPinnedPostCount(channelID, allowFromCache) 1328 1329 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1330 if s.Root.Metrics != nil { 1331 success := "false" 1332 if err == nil { 1333 success = "true" 1334 } 1335 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPinnedPostCount", success, elapsed) 1336 } 1337 return result, err 1338 } 1339 1340 func (s *TimerLayerChannelStore) GetPinnedPosts(channelID string) (*model.PostList, error) { 1341 start := timemodule.Now() 1342 1343 result, err := s.ChannelStore.GetPinnedPosts(channelID) 1344 1345 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1346 if s.Root.Metrics != nil { 1347 success := "false" 1348 if err == nil { 1349 success = "true" 1350 } 1351 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPinnedPosts", success, elapsed) 1352 } 1353 return result, err 1354 } 1355 1356 func (s *TimerLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) { 1357 start := timemodule.Now() 1358 1359 result, err := s.ChannelStore.GetPrivateChannelsForTeam(teamID, offset, limit) 1360 1361 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1362 if s.Root.Metrics != nil { 1363 success := "false" 1364 if err == nil { 1365 success = "true" 1366 } 1367 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPrivateChannelsForTeam", success, elapsed) 1368 } 1369 return result, err 1370 } 1371 1372 func (s *TimerLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (*model.ChannelList, error) { 1373 start := timemodule.Now() 1374 1375 result, err := s.ChannelStore.GetPublicChannelsByIdsForTeam(teamID, channelIds) 1376 1377 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1378 if s.Root.Metrics != nil { 1379 success := "false" 1380 if err == nil { 1381 success = "true" 1382 } 1383 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPublicChannelsByIdsForTeam", success, elapsed) 1384 } 1385 return result, err 1386 } 1387 1388 func (s *TimerLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (*model.ChannelList, error) { 1389 start := timemodule.Now() 1390 1391 result, err := s.ChannelStore.GetPublicChannelsForTeam(teamID, offset, limit) 1392 1393 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1394 if s.Root.Metrics != nil { 1395 success := "false" 1396 if err == nil { 1397 success = "true" 1398 } 1399 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetPublicChannelsForTeam", success, elapsed) 1400 } 1401 return result, err 1402 } 1403 1404 func (s *TimerLayerChannelStore) GetSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) { 1405 start := timemodule.Now() 1406 1407 result, err := s.ChannelStore.GetSidebarCategories(userID, teamID) 1408 1409 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1410 if s.Root.Metrics != nil { 1411 success := "false" 1412 if err == nil { 1413 success = "true" 1414 } 1415 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetSidebarCategories", success, elapsed) 1416 } 1417 return result, err 1418 } 1419 1420 func (s *TimerLayerChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { 1421 start := timemodule.Now() 1422 1423 result, err := s.ChannelStore.GetSidebarCategory(categoryID) 1424 1425 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1426 if s.Root.Metrics != nil { 1427 success := "false" 1428 if err == nil { 1429 success = "true" 1430 } 1431 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetSidebarCategory", success, elapsed) 1432 } 1433 return result, err 1434 } 1435 1436 func (s *TimerLayerChannelStore) GetSidebarCategoryOrder(userID string, teamID string) ([]string, error) { 1437 start := timemodule.Now() 1438 1439 result, err := s.ChannelStore.GetSidebarCategoryOrder(userID, teamID) 1440 1441 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1442 if s.Root.Metrics != nil { 1443 success := "false" 1444 if err == nil { 1445 success = "true" 1446 } 1447 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetSidebarCategoryOrder", success, elapsed) 1448 } 1449 return result, err 1450 } 1451 1452 func (s *TimerLayerChannelStore) GetTeamChannels(teamID string) (*model.ChannelList, error) { 1453 start := timemodule.Now() 1454 1455 result, err := s.ChannelStore.GetTeamChannels(teamID) 1456 1457 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1458 if s.Root.Metrics != nil { 1459 success := "false" 1460 if err == nil { 1461 success = "true" 1462 } 1463 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetTeamChannels", success, elapsed) 1464 } 1465 return result, err 1466 } 1467 1468 func (s *TimerLayerChannelStore) GetTeamForChannel(channelID string) (*model.Team, error) { 1469 start := timemodule.Now() 1470 1471 result, err := s.ChannelStore.GetTeamForChannel(channelID) 1472 1473 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1474 if s.Root.Metrics != nil { 1475 success := "false" 1476 if err == nil { 1477 success = "true" 1478 } 1479 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GetTeamForChannel", success, elapsed) 1480 } 1481 return result, err 1482 } 1483 1484 func (s *TimerLayerChannelStore) GroupSyncedChannelCount() (int64, error) { 1485 start := timemodule.Now() 1486 1487 result, err := s.ChannelStore.GroupSyncedChannelCount() 1488 1489 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1490 if s.Root.Metrics != nil { 1491 success := "false" 1492 if err == nil { 1493 success = "true" 1494 } 1495 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.GroupSyncedChannelCount", success, elapsed) 1496 } 1497 return result, err 1498 } 1499 1500 func (s *TimerLayerChannelStore) IncrementMentionCount(channelID string, userID string, updateThreads bool, isRoot bool) error { 1501 start := timemodule.Now() 1502 1503 err := s.ChannelStore.IncrementMentionCount(channelID, userID, updateThreads, isRoot) 1504 1505 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1506 if s.Root.Metrics != nil { 1507 success := "false" 1508 if err == nil { 1509 success = "true" 1510 } 1511 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.IncrementMentionCount", success, elapsed) 1512 } 1513 return err 1514 } 1515 1516 func (s *TimerLayerChannelStore) InvalidateAllChannelMembersForUser(userID string) { 1517 start := timemodule.Now() 1518 1519 s.ChannelStore.InvalidateAllChannelMembersForUser(userID) 1520 1521 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1522 if s.Root.Metrics != nil { 1523 success := "false" 1524 if true { 1525 success = "true" 1526 } 1527 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidateAllChannelMembersForUser", success, elapsed) 1528 } 1529 } 1530 1531 func (s *TimerLayerChannelStore) InvalidateCacheForChannelMembersNotifyProps(channelID string) { 1532 start := timemodule.Now() 1533 1534 s.ChannelStore.InvalidateCacheForChannelMembersNotifyProps(channelID) 1535 1536 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1537 if s.Root.Metrics != nil { 1538 success := "false" 1539 if true { 1540 success = "true" 1541 } 1542 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidateCacheForChannelMembersNotifyProps", success, elapsed) 1543 } 1544 } 1545 1546 func (s *TimerLayerChannelStore) InvalidateChannel(id string) { 1547 start := timemodule.Now() 1548 1549 s.ChannelStore.InvalidateChannel(id) 1550 1551 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1552 if s.Root.Metrics != nil { 1553 success := "false" 1554 if true { 1555 success = "true" 1556 } 1557 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidateChannel", success, elapsed) 1558 } 1559 } 1560 1561 func (s *TimerLayerChannelStore) InvalidateChannelByName(teamID string, name string) { 1562 start := timemodule.Now() 1563 1564 s.ChannelStore.InvalidateChannelByName(teamID, name) 1565 1566 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1567 if s.Root.Metrics != nil { 1568 success := "false" 1569 if true { 1570 success = "true" 1571 } 1572 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidateChannelByName", success, elapsed) 1573 } 1574 } 1575 1576 func (s *TimerLayerChannelStore) InvalidateGuestCount(channelID string) { 1577 start := timemodule.Now() 1578 1579 s.ChannelStore.InvalidateGuestCount(channelID) 1580 1581 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1582 if s.Root.Metrics != nil { 1583 success := "false" 1584 if true { 1585 success = "true" 1586 } 1587 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidateGuestCount", success, elapsed) 1588 } 1589 } 1590 1591 func (s *TimerLayerChannelStore) InvalidateMemberCount(channelID string) { 1592 start := timemodule.Now() 1593 1594 s.ChannelStore.InvalidateMemberCount(channelID) 1595 1596 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1597 if s.Root.Metrics != nil { 1598 success := "false" 1599 if true { 1600 success = "true" 1601 } 1602 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidateMemberCount", success, elapsed) 1603 } 1604 } 1605 1606 func (s *TimerLayerChannelStore) InvalidatePinnedPostCount(channelID string) { 1607 start := timemodule.Now() 1608 1609 s.ChannelStore.InvalidatePinnedPostCount(channelID) 1610 1611 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1612 if s.Root.Metrics != nil { 1613 success := "false" 1614 if true { 1615 success = "true" 1616 } 1617 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.InvalidatePinnedPostCount", success, elapsed) 1618 } 1619 } 1620 1621 func (s *TimerLayerChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool { 1622 start := timemodule.Now() 1623 1624 result := s.ChannelStore.IsUserInChannelUseCache(userID, channelID) 1625 1626 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1627 if s.Root.Metrics != nil { 1628 success := "false" 1629 if true { 1630 success = "true" 1631 } 1632 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.IsUserInChannelUseCache", success, elapsed) 1633 } 1634 return result 1635 } 1636 1637 func (s *TimerLayerChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) { 1638 start := timemodule.Now() 1639 1640 result, err := s.ChannelStore.MigrateChannelMembers(fromChannelID, fromUserID) 1641 1642 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1643 if s.Root.Metrics != nil { 1644 success := "false" 1645 if err == nil { 1646 success = "true" 1647 } 1648 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.MigrateChannelMembers", success, elapsed) 1649 } 1650 return result, err 1651 } 1652 1653 func (s *TimerLayerChannelStore) MigratePublicChannels() error { 1654 start := timemodule.Now() 1655 1656 err := s.ChannelStore.MigratePublicChannels() 1657 1658 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1659 if s.Root.Metrics != nil { 1660 success := "false" 1661 if err == nil { 1662 success = "true" 1663 } 1664 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.MigratePublicChannels", success, elapsed) 1665 } 1666 return err 1667 } 1668 1669 func (s *TimerLayerChannelStore) PermanentDelete(channelID string) error { 1670 start := timemodule.Now() 1671 1672 err := s.ChannelStore.PermanentDelete(channelID) 1673 1674 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1675 if s.Root.Metrics != nil { 1676 success := "false" 1677 if err == nil { 1678 success = "true" 1679 } 1680 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.PermanentDelete", success, elapsed) 1681 } 1682 return err 1683 } 1684 1685 func (s *TimerLayerChannelStore) PermanentDeleteByTeam(teamID string) error { 1686 start := timemodule.Now() 1687 1688 err := s.ChannelStore.PermanentDeleteByTeam(teamID) 1689 1690 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1691 if s.Root.Metrics != nil { 1692 success := "false" 1693 if err == nil { 1694 success = "true" 1695 } 1696 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.PermanentDeleteByTeam", success, elapsed) 1697 } 1698 return err 1699 } 1700 1701 func (s *TimerLayerChannelStore) PermanentDeleteMembersByChannel(channelID string) error { 1702 start := timemodule.Now() 1703 1704 err := s.ChannelStore.PermanentDeleteMembersByChannel(channelID) 1705 1706 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1707 if s.Root.Metrics != nil { 1708 success := "false" 1709 if err == nil { 1710 success = "true" 1711 } 1712 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.PermanentDeleteMembersByChannel", success, elapsed) 1713 } 1714 return err 1715 } 1716 1717 func (s *TimerLayerChannelStore) PermanentDeleteMembersByUser(userID string) error { 1718 start := timemodule.Now() 1719 1720 err := s.ChannelStore.PermanentDeleteMembersByUser(userID) 1721 1722 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1723 if s.Root.Metrics != nil { 1724 success := "false" 1725 if err == nil { 1726 success = "true" 1727 } 1728 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.PermanentDeleteMembersByUser", success, elapsed) 1729 } 1730 return err 1731 } 1732 1733 func (s *TimerLayerChannelStore) RemoveAllDeactivatedMembers(channelID string) error { 1734 start := timemodule.Now() 1735 1736 err := s.ChannelStore.RemoveAllDeactivatedMembers(channelID) 1737 1738 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1739 if s.Root.Metrics != nil { 1740 success := "false" 1741 if err == nil { 1742 success = "true" 1743 } 1744 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.RemoveAllDeactivatedMembers", success, elapsed) 1745 } 1746 return err 1747 } 1748 1749 func (s *TimerLayerChannelStore) RemoveMember(channelID string, userID string) error { 1750 start := timemodule.Now() 1751 1752 err := s.ChannelStore.RemoveMember(channelID, userID) 1753 1754 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1755 if s.Root.Metrics != nil { 1756 success := "false" 1757 if err == nil { 1758 success = "true" 1759 } 1760 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.RemoveMember", success, elapsed) 1761 } 1762 return err 1763 } 1764 1765 func (s *TimerLayerChannelStore) RemoveMembers(channelID string, userIds []string) error { 1766 start := timemodule.Now() 1767 1768 err := s.ChannelStore.RemoveMembers(channelID, userIds) 1769 1770 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1771 if s.Root.Metrics != nil { 1772 success := "false" 1773 if err == nil { 1774 success = "true" 1775 } 1776 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.RemoveMembers", success, elapsed) 1777 } 1778 return err 1779 } 1780 1781 func (s *TimerLayerChannelStore) ResetAllChannelSchemes() error { 1782 start := timemodule.Now() 1783 1784 err := s.ChannelStore.ResetAllChannelSchemes() 1785 1786 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1787 if s.Root.Metrics != nil { 1788 success := "false" 1789 if err == nil { 1790 success = "true" 1791 } 1792 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.ResetAllChannelSchemes", success, elapsed) 1793 } 1794 return err 1795 } 1796 1797 func (s *TimerLayerChannelStore) Restore(channelID string, time int64) error { 1798 start := timemodule.Now() 1799 1800 err := s.ChannelStore.Restore(channelID, time) 1801 1802 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1803 if s.Root.Metrics != nil { 1804 success := "false" 1805 if err == nil { 1806 success = "true" 1807 } 1808 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.Restore", success, elapsed) 1809 } 1810 return err 1811 } 1812 1813 func (s *TimerLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) { 1814 start := timemodule.Now() 1815 1816 result, err := s.ChannelStore.Save(channel, maxChannelsPerTeam) 1817 1818 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1819 if s.Root.Metrics != nil { 1820 success := "false" 1821 if err == nil { 1822 success = "true" 1823 } 1824 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.Save", success, elapsed) 1825 } 1826 return result, err 1827 } 1828 1829 func (s *TimerLayerChannelStore) SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error) { 1830 start := timemodule.Now() 1831 1832 result, err := s.ChannelStore.SaveDirectChannel(channel, member1, member2) 1833 1834 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1835 if s.Root.Metrics != nil { 1836 success := "false" 1837 if err == nil { 1838 success = "true" 1839 } 1840 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SaveDirectChannel", success, elapsed) 1841 } 1842 return result, err 1843 } 1844 1845 func (s *TimerLayerChannelStore) SaveMember(member *model.ChannelMember) (*model.ChannelMember, error) { 1846 start := timemodule.Now() 1847 1848 result, err := s.ChannelStore.SaveMember(member) 1849 1850 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1851 if s.Root.Metrics != nil { 1852 success := "false" 1853 if err == nil { 1854 success = "true" 1855 } 1856 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SaveMember", success, elapsed) 1857 } 1858 return result, err 1859 } 1860 1861 func (s *TimerLayerChannelStore) SaveMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error) { 1862 start := timemodule.Now() 1863 1864 result, err := s.ChannelStore.SaveMultipleMembers(members) 1865 1866 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1867 if s.Root.Metrics != nil { 1868 success := "false" 1869 if err == nil { 1870 success = "true" 1871 } 1872 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SaveMultipleMembers", success, elapsed) 1873 } 1874 return result, err 1875 } 1876 1877 func (s *TimerLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, int64, error) { 1878 start := timemodule.Now() 1879 1880 result, resultVar1, err := s.ChannelStore.SearchAllChannels(term, opts) 1881 1882 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1883 if s.Root.Metrics != nil { 1884 success := "false" 1885 if err == nil { 1886 success = "true" 1887 } 1888 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SearchAllChannels", success, elapsed) 1889 } 1890 return result, resultVar1, err 1891 } 1892 1893 func (s *TimerLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (*model.ChannelList, error) { 1894 start := timemodule.Now() 1895 1896 result, err := s.ChannelStore.SearchArchivedInTeam(teamID, term, userID) 1897 1898 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1899 if s.Root.Metrics != nil { 1900 success := "false" 1901 if err == nil { 1902 success = "true" 1903 } 1904 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SearchArchivedInTeam", success, elapsed) 1905 } 1906 return result, err 1907 } 1908 1909 func (s *TimerLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (*model.ChannelList, error) { 1910 start := timemodule.Now() 1911 1912 result, err := s.ChannelStore.SearchForUserInTeam(userID, teamID, term, includeDeleted) 1913 1914 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1915 if s.Root.Metrics != nil { 1916 success := "false" 1917 if err == nil { 1918 success = "true" 1919 } 1920 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SearchForUserInTeam", success, elapsed) 1921 } 1922 return result, err 1923 } 1924 1925 func (s *TimerLayerChannelStore) SearchGroupChannels(userID string, term string) (*model.ChannelList, error) { 1926 start := timemodule.Now() 1927 1928 result, err := s.ChannelStore.SearchGroupChannels(userID, term) 1929 1930 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1931 if s.Root.Metrics != nil { 1932 success := "false" 1933 if err == nil { 1934 success = "true" 1935 } 1936 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SearchGroupChannels", success, elapsed) 1937 } 1938 return result, err 1939 } 1940 1941 func (s *TimerLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (*model.ChannelList, error) { 1942 start := timemodule.Now() 1943 1944 result, err := s.ChannelStore.SearchInTeam(teamID, term, includeDeleted) 1945 1946 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1947 if s.Root.Metrics != nil { 1948 success := "false" 1949 if err == nil { 1950 success = "true" 1951 } 1952 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SearchInTeam", success, elapsed) 1953 } 1954 return result, err 1955 } 1956 1957 func (s *TimerLayerChannelStore) SearchMore(userID string, teamID string, term string) (*model.ChannelList, error) { 1958 start := timemodule.Now() 1959 1960 result, err := s.ChannelStore.SearchMore(userID, teamID, term) 1961 1962 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1963 if s.Root.Metrics != nil { 1964 success := "false" 1965 if err == nil { 1966 success = "true" 1967 } 1968 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SearchMore", success, elapsed) 1969 } 1970 return result, err 1971 } 1972 1973 func (s *TimerLayerChannelStore) SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error { 1974 start := timemodule.Now() 1975 1976 err := s.ChannelStore.SetDeleteAt(channelID, deleteAt, updateAt) 1977 1978 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1979 if s.Root.Metrics != nil { 1980 success := "false" 1981 if err == nil { 1982 success = "true" 1983 } 1984 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SetDeleteAt", success, elapsed) 1985 } 1986 return err 1987 } 1988 1989 func (s *TimerLayerChannelStore) SetShared(channelId string, shared bool) error { 1990 start := timemodule.Now() 1991 1992 err := s.ChannelStore.SetShared(channelId, shared) 1993 1994 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 1995 if s.Root.Metrics != nil { 1996 success := "false" 1997 if err == nil { 1998 success = "true" 1999 } 2000 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.SetShared", success, elapsed) 2001 } 2002 return err 2003 } 2004 2005 func (s *TimerLayerChannelStore) Update(channel *model.Channel) (*model.Channel, error) { 2006 start := timemodule.Now() 2007 2008 result, err := s.ChannelStore.Update(channel) 2009 2010 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2011 if s.Root.Metrics != nil { 2012 success := "false" 2013 if err == nil { 2014 success = "true" 2015 } 2016 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.Update", success, elapsed) 2017 } 2018 return result, err 2019 } 2020 2021 func (s *TimerLayerChannelStore) UpdateLastViewedAt(channelIds []string, userID string, updateThreads bool) (map[string]int64, error) { 2022 start := timemodule.Now() 2023 2024 result, err := s.ChannelStore.UpdateLastViewedAt(channelIds, userID, updateThreads) 2025 2026 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2027 if s.Root.Metrics != nil { 2028 success := "false" 2029 if err == nil { 2030 success = "true" 2031 } 2032 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateLastViewedAt", success, elapsed) 2033 } 2034 return result, err 2035 } 2036 2037 func (s *TimerLayerChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount int, mentionCountRoot int, updateThreads bool, setUnreadCountRoot bool) (*model.ChannelUnreadAt, error) { 2038 start := timemodule.Now() 2039 2040 result, err := s.ChannelStore.UpdateLastViewedAtPost(unreadPost, userID, mentionCount, mentionCountRoot, updateThreads, setUnreadCountRoot) 2041 2042 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2043 if s.Root.Metrics != nil { 2044 success := "false" 2045 if err == nil { 2046 success = "true" 2047 } 2048 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateLastViewedAtPost", success, elapsed) 2049 } 2050 return result, err 2051 } 2052 2053 func (s *TimerLayerChannelStore) UpdateMember(member *model.ChannelMember) (*model.ChannelMember, error) { 2054 start := timemodule.Now() 2055 2056 result, err := s.ChannelStore.UpdateMember(member) 2057 2058 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2059 if s.Root.Metrics != nil { 2060 success := "false" 2061 if err == nil { 2062 success = "true" 2063 } 2064 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateMember", success, elapsed) 2065 } 2066 return result, err 2067 } 2068 2069 func (s *TimerLayerChannelStore) UpdateMembersRole(channelID string, userIDs []string) error { 2070 start := timemodule.Now() 2071 2072 err := s.ChannelStore.UpdateMembersRole(channelID, userIDs) 2073 2074 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2075 if s.Root.Metrics != nil { 2076 success := "false" 2077 if err == nil { 2078 success = "true" 2079 } 2080 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateMembersRole", success, elapsed) 2081 } 2082 return err 2083 } 2084 2085 func (s *TimerLayerChannelStore) UpdateMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error) { 2086 start := timemodule.Now() 2087 2088 result, err := s.ChannelStore.UpdateMultipleMembers(members) 2089 2090 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2091 if s.Root.Metrics != nil { 2092 success := "false" 2093 if err == nil { 2094 success = "true" 2095 } 2096 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateMultipleMembers", success, elapsed) 2097 } 2098 return result, err 2099 } 2100 2101 func (s *TimerLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { 2102 start := timemodule.Now() 2103 2104 result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories) 2105 2106 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2107 if s.Root.Metrics != nil { 2108 success := "false" 2109 if err == nil { 2110 success = "true" 2111 } 2112 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateSidebarCategories", success, elapsed) 2113 } 2114 return result, resultVar1, err 2115 } 2116 2117 func (s *TimerLayerChannelStore) UpdateSidebarCategoryOrder(userID string, teamID string, categoryOrder []string) error { 2118 start := timemodule.Now() 2119 2120 err := s.ChannelStore.UpdateSidebarCategoryOrder(userID, teamID, categoryOrder) 2121 2122 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2123 if s.Root.Metrics != nil { 2124 success := "false" 2125 if err == nil { 2126 success = "true" 2127 } 2128 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateSidebarCategoryOrder", success, elapsed) 2129 } 2130 return err 2131 } 2132 2133 func (s *TimerLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channel *model.Channel, newTeamID string) error { 2134 start := timemodule.Now() 2135 2136 err := s.ChannelStore.UpdateSidebarChannelCategoryOnMove(channel, newTeamID) 2137 2138 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2139 if s.Root.Metrics != nil { 2140 success := "false" 2141 if err == nil { 2142 success = "true" 2143 } 2144 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateSidebarChannelCategoryOnMove", success, elapsed) 2145 } 2146 return err 2147 } 2148 2149 func (s *TimerLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error { 2150 start := timemodule.Now() 2151 2152 err := s.ChannelStore.UpdateSidebarChannelsByPreferences(preferences) 2153 2154 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2155 if s.Root.Metrics != nil { 2156 success := "false" 2157 if err == nil { 2158 success = "true" 2159 } 2160 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UpdateSidebarChannelsByPreferences", success, elapsed) 2161 } 2162 return err 2163 } 2164 2165 func (s *TimerLayerChannelStore) UserBelongsToChannels(userID string, channelIds []string) (bool, error) { 2166 start := timemodule.Now() 2167 2168 result, err := s.ChannelStore.UserBelongsToChannels(userID, channelIds) 2169 2170 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2171 if s.Root.Metrics != nil { 2172 success := "false" 2173 if err == nil { 2174 success = "true" 2175 } 2176 s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.UserBelongsToChannels", success, elapsed) 2177 } 2178 return result, err 2179 } 2180 2181 func (s *TimerLayerChannelMemberHistoryStore) DeleteOrphanedRows(limit int) (int64, error) { 2182 start := timemodule.Now() 2183 2184 result, err := s.ChannelMemberHistoryStore.DeleteOrphanedRows(limit) 2185 2186 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2187 if s.Root.Metrics != nil { 2188 success := "false" 2189 if err == nil { 2190 success = "true" 2191 } 2192 s.Root.Metrics.ObserveStoreMethodDuration("ChannelMemberHistoryStore.DeleteOrphanedRows", success, elapsed) 2193 } 2194 return result, err 2195 } 2196 2197 func (s *TimerLayerChannelMemberHistoryStore) GetUsersInChannelDuring(startTime int64, endTime int64, channelID string) ([]*model.ChannelMemberHistoryResult, error) { 2198 start := timemodule.Now() 2199 2200 result, err := s.ChannelMemberHistoryStore.GetUsersInChannelDuring(startTime, endTime, channelID) 2201 2202 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2203 if s.Root.Metrics != nil { 2204 success := "false" 2205 if err == nil { 2206 success = "true" 2207 } 2208 s.Root.Metrics.ObserveStoreMethodDuration("ChannelMemberHistoryStore.GetUsersInChannelDuring", success, elapsed) 2209 } 2210 return result, err 2211 } 2212 2213 func (s *TimerLayerChannelMemberHistoryStore) LogJoinEvent(userID string, channelID string, joinTime int64) error { 2214 start := timemodule.Now() 2215 2216 err := s.ChannelMemberHistoryStore.LogJoinEvent(userID, channelID, joinTime) 2217 2218 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2219 if s.Root.Metrics != nil { 2220 success := "false" 2221 if err == nil { 2222 success = "true" 2223 } 2224 s.Root.Metrics.ObserveStoreMethodDuration("ChannelMemberHistoryStore.LogJoinEvent", success, elapsed) 2225 } 2226 return err 2227 } 2228 2229 func (s *TimerLayerChannelMemberHistoryStore) LogLeaveEvent(userID string, channelID string, leaveTime int64) error { 2230 start := timemodule.Now() 2231 2232 err := s.ChannelMemberHistoryStore.LogLeaveEvent(userID, channelID, leaveTime) 2233 2234 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2235 if s.Root.Metrics != nil { 2236 success := "false" 2237 if err == nil { 2238 success = "true" 2239 } 2240 s.Root.Metrics.ObserveStoreMethodDuration("ChannelMemberHistoryStore.LogLeaveEvent", success, elapsed) 2241 } 2242 return err 2243 } 2244 2245 func (s *TimerLayerChannelMemberHistoryStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { 2246 start := timemodule.Now() 2247 2248 result, err := s.ChannelMemberHistoryStore.PermanentDeleteBatch(endTime, limit) 2249 2250 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2251 if s.Root.Metrics != nil { 2252 success := "false" 2253 if err == nil { 2254 success = "true" 2255 } 2256 s.Root.Metrics.ObserveStoreMethodDuration("ChannelMemberHistoryStore.PermanentDeleteBatch", success, elapsed) 2257 } 2258 return result, err 2259 } 2260 2261 func (s *TimerLayerChannelMemberHistoryStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { 2262 start := timemodule.Now() 2263 2264 result, resultVar1, err := s.ChannelMemberHistoryStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) 2265 2266 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2267 if s.Root.Metrics != nil { 2268 success := "false" 2269 if err == nil { 2270 success = "true" 2271 } 2272 s.Root.Metrics.ObserveStoreMethodDuration("ChannelMemberHistoryStore.PermanentDeleteBatchForRetentionPolicies", success, elapsed) 2273 } 2274 return result, resultVar1, err 2275 } 2276 2277 func (s *TimerLayerClusterDiscoveryStore) Cleanup() error { 2278 start := timemodule.Now() 2279 2280 err := s.ClusterDiscoveryStore.Cleanup() 2281 2282 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2283 if s.Root.Metrics != nil { 2284 success := "false" 2285 if err == nil { 2286 success = "true" 2287 } 2288 s.Root.Metrics.ObserveStoreMethodDuration("ClusterDiscoveryStore.Cleanup", success, elapsed) 2289 } 2290 return err 2291 } 2292 2293 func (s *TimerLayerClusterDiscoveryStore) Delete(discovery *model.ClusterDiscovery) (bool, error) { 2294 start := timemodule.Now() 2295 2296 result, err := s.ClusterDiscoveryStore.Delete(discovery) 2297 2298 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2299 if s.Root.Metrics != nil { 2300 success := "false" 2301 if err == nil { 2302 success = "true" 2303 } 2304 s.Root.Metrics.ObserveStoreMethodDuration("ClusterDiscoveryStore.Delete", success, elapsed) 2305 } 2306 return result, err 2307 } 2308 2309 func (s *TimerLayerClusterDiscoveryStore) Exists(discovery *model.ClusterDiscovery) (bool, error) { 2310 start := timemodule.Now() 2311 2312 result, err := s.ClusterDiscoveryStore.Exists(discovery) 2313 2314 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2315 if s.Root.Metrics != nil { 2316 success := "false" 2317 if err == nil { 2318 success = "true" 2319 } 2320 s.Root.Metrics.ObserveStoreMethodDuration("ClusterDiscoveryStore.Exists", success, elapsed) 2321 } 2322 return result, err 2323 } 2324 2325 func (s *TimerLayerClusterDiscoveryStore) GetAll(discoveryType string, clusterName string) ([]*model.ClusterDiscovery, error) { 2326 start := timemodule.Now() 2327 2328 result, err := s.ClusterDiscoveryStore.GetAll(discoveryType, clusterName) 2329 2330 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2331 if s.Root.Metrics != nil { 2332 success := "false" 2333 if err == nil { 2334 success = "true" 2335 } 2336 s.Root.Metrics.ObserveStoreMethodDuration("ClusterDiscoveryStore.GetAll", success, elapsed) 2337 } 2338 return result, err 2339 } 2340 2341 func (s *TimerLayerClusterDiscoveryStore) Save(discovery *model.ClusterDiscovery) error { 2342 start := timemodule.Now() 2343 2344 err := s.ClusterDiscoveryStore.Save(discovery) 2345 2346 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2347 if s.Root.Metrics != nil { 2348 success := "false" 2349 if err == nil { 2350 success = "true" 2351 } 2352 s.Root.Metrics.ObserveStoreMethodDuration("ClusterDiscoveryStore.Save", success, elapsed) 2353 } 2354 return err 2355 } 2356 2357 func (s *TimerLayerClusterDiscoveryStore) SetLastPingAt(discovery *model.ClusterDiscovery) error { 2358 start := timemodule.Now() 2359 2360 err := s.ClusterDiscoveryStore.SetLastPingAt(discovery) 2361 2362 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2363 if s.Root.Metrics != nil { 2364 success := "false" 2365 if err == nil { 2366 success = "true" 2367 } 2368 s.Root.Metrics.ObserveStoreMethodDuration("ClusterDiscoveryStore.SetLastPingAt", success, elapsed) 2369 } 2370 return err 2371 } 2372 2373 func (s *TimerLayerCommandStore) AnalyticsCommandCount(teamID string) (int64, error) { 2374 start := timemodule.Now() 2375 2376 result, err := s.CommandStore.AnalyticsCommandCount(teamID) 2377 2378 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2379 if s.Root.Metrics != nil { 2380 success := "false" 2381 if err == nil { 2382 success = "true" 2383 } 2384 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.AnalyticsCommandCount", success, elapsed) 2385 } 2386 return result, err 2387 } 2388 2389 func (s *TimerLayerCommandStore) Delete(commandID string, time int64) error { 2390 start := timemodule.Now() 2391 2392 err := s.CommandStore.Delete(commandID, time) 2393 2394 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2395 if s.Root.Metrics != nil { 2396 success := "false" 2397 if err == nil { 2398 success = "true" 2399 } 2400 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.Delete", success, elapsed) 2401 } 2402 return err 2403 } 2404 2405 func (s *TimerLayerCommandStore) Get(id string) (*model.Command, error) { 2406 start := timemodule.Now() 2407 2408 result, err := s.CommandStore.Get(id) 2409 2410 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2411 if s.Root.Metrics != nil { 2412 success := "false" 2413 if err == nil { 2414 success = "true" 2415 } 2416 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.Get", success, elapsed) 2417 } 2418 return result, err 2419 } 2420 2421 func (s *TimerLayerCommandStore) GetByTeam(teamID string) ([]*model.Command, error) { 2422 start := timemodule.Now() 2423 2424 result, err := s.CommandStore.GetByTeam(teamID) 2425 2426 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2427 if s.Root.Metrics != nil { 2428 success := "false" 2429 if err == nil { 2430 success = "true" 2431 } 2432 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.GetByTeam", success, elapsed) 2433 } 2434 return result, err 2435 } 2436 2437 func (s *TimerLayerCommandStore) GetByTrigger(teamID string, trigger string) (*model.Command, error) { 2438 start := timemodule.Now() 2439 2440 result, err := s.CommandStore.GetByTrigger(teamID, trigger) 2441 2442 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2443 if s.Root.Metrics != nil { 2444 success := "false" 2445 if err == nil { 2446 success = "true" 2447 } 2448 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.GetByTrigger", success, elapsed) 2449 } 2450 return result, err 2451 } 2452 2453 func (s *TimerLayerCommandStore) PermanentDeleteByTeam(teamID string) error { 2454 start := timemodule.Now() 2455 2456 err := s.CommandStore.PermanentDeleteByTeam(teamID) 2457 2458 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2459 if s.Root.Metrics != nil { 2460 success := "false" 2461 if err == nil { 2462 success = "true" 2463 } 2464 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.PermanentDeleteByTeam", success, elapsed) 2465 } 2466 return err 2467 } 2468 2469 func (s *TimerLayerCommandStore) PermanentDeleteByUser(userID string) error { 2470 start := timemodule.Now() 2471 2472 err := s.CommandStore.PermanentDeleteByUser(userID) 2473 2474 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2475 if s.Root.Metrics != nil { 2476 success := "false" 2477 if err == nil { 2478 success = "true" 2479 } 2480 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.PermanentDeleteByUser", success, elapsed) 2481 } 2482 return err 2483 } 2484 2485 func (s *TimerLayerCommandStore) Save(webhook *model.Command) (*model.Command, error) { 2486 start := timemodule.Now() 2487 2488 result, err := s.CommandStore.Save(webhook) 2489 2490 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2491 if s.Root.Metrics != nil { 2492 success := "false" 2493 if err == nil { 2494 success = "true" 2495 } 2496 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.Save", success, elapsed) 2497 } 2498 return result, err 2499 } 2500 2501 func (s *TimerLayerCommandStore) Update(hook *model.Command) (*model.Command, error) { 2502 start := timemodule.Now() 2503 2504 result, err := s.CommandStore.Update(hook) 2505 2506 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2507 if s.Root.Metrics != nil { 2508 success := "false" 2509 if err == nil { 2510 success = "true" 2511 } 2512 s.Root.Metrics.ObserveStoreMethodDuration("CommandStore.Update", success, elapsed) 2513 } 2514 return result, err 2515 } 2516 2517 func (s *TimerLayerCommandWebhookStore) Cleanup() { 2518 start := timemodule.Now() 2519 2520 s.CommandWebhookStore.Cleanup() 2521 2522 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2523 if s.Root.Metrics != nil { 2524 success := "false" 2525 if true { 2526 success = "true" 2527 } 2528 s.Root.Metrics.ObserveStoreMethodDuration("CommandWebhookStore.Cleanup", success, elapsed) 2529 } 2530 } 2531 2532 func (s *TimerLayerCommandWebhookStore) Get(id string) (*model.CommandWebhook, error) { 2533 start := timemodule.Now() 2534 2535 result, err := s.CommandWebhookStore.Get(id) 2536 2537 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2538 if s.Root.Metrics != nil { 2539 success := "false" 2540 if err == nil { 2541 success = "true" 2542 } 2543 s.Root.Metrics.ObserveStoreMethodDuration("CommandWebhookStore.Get", success, elapsed) 2544 } 2545 return result, err 2546 } 2547 2548 func (s *TimerLayerCommandWebhookStore) Save(webhook *model.CommandWebhook) (*model.CommandWebhook, error) { 2549 start := timemodule.Now() 2550 2551 result, err := s.CommandWebhookStore.Save(webhook) 2552 2553 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2554 if s.Root.Metrics != nil { 2555 success := "false" 2556 if err == nil { 2557 success = "true" 2558 } 2559 s.Root.Metrics.ObserveStoreMethodDuration("CommandWebhookStore.Save", success, elapsed) 2560 } 2561 return result, err 2562 } 2563 2564 func (s *TimerLayerCommandWebhookStore) TryUse(id string, limit int) error { 2565 start := timemodule.Now() 2566 2567 err := s.CommandWebhookStore.TryUse(id, limit) 2568 2569 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2570 if s.Root.Metrics != nil { 2571 success := "false" 2572 if err == nil { 2573 success = "true" 2574 } 2575 s.Root.Metrics.ObserveStoreMethodDuration("CommandWebhookStore.TryUse", success, elapsed) 2576 } 2577 return err 2578 } 2579 2580 func (s *TimerLayerComplianceStore) ComplianceExport(compliance *model.Compliance, cursor model.ComplianceExportCursor, limit int) ([]*model.CompliancePost, model.ComplianceExportCursor, error) { 2581 start := timemodule.Now() 2582 2583 result, resultVar1, err := s.ComplianceStore.ComplianceExport(compliance, cursor, limit) 2584 2585 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2586 if s.Root.Metrics != nil { 2587 success := "false" 2588 if err == nil { 2589 success = "true" 2590 } 2591 s.Root.Metrics.ObserveStoreMethodDuration("ComplianceStore.ComplianceExport", success, elapsed) 2592 } 2593 return result, resultVar1, err 2594 } 2595 2596 func (s *TimerLayerComplianceStore) Get(id string) (*model.Compliance, error) { 2597 start := timemodule.Now() 2598 2599 result, err := s.ComplianceStore.Get(id) 2600 2601 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2602 if s.Root.Metrics != nil { 2603 success := "false" 2604 if err == nil { 2605 success = "true" 2606 } 2607 s.Root.Metrics.ObserveStoreMethodDuration("ComplianceStore.Get", success, elapsed) 2608 } 2609 return result, err 2610 } 2611 2612 func (s *TimerLayerComplianceStore) GetAll(offset int, limit int) (model.Compliances, error) { 2613 start := timemodule.Now() 2614 2615 result, err := s.ComplianceStore.GetAll(offset, limit) 2616 2617 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2618 if s.Root.Metrics != nil { 2619 success := "false" 2620 if err == nil { 2621 success = "true" 2622 } 2623 s.Root.Metrics.ObserveStoreMethodDuration("ComplianceStore.GetAll", success, elapsed) 2624 } 2625 return result, err 2626 } 2627 2628 func (s *TimerLayerComplianceStore) MessageExport(cursor model.MessageExportCursor, limit int) ([]*model.MessageExport, model.MessageExportCursor, error) { 2629 start := timemodule.Now() 2630 2631 result, resultVar1, err := s.ComplianceStore.MessageExport(cursor, limit) 2632 2633 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2634 if s.Root.Metrics != nil { 2635 success := "false" 2636 if err == nil { 2637 success = "true" 2638 } 2639 s.Root.Metrics.ObserveStoreMethodDuration("ComplianceStore.MessageExport", success, elapsed) 2640 } 2641 return result, resultVar1, err 2642 } 2643 2644 func (s *TimerLayerComplianceStore) Save(compliance *model.Compliance) (*model.Compliance, error) { 2645 start := timemodule.Now() 2646 2647 result, err := s.ComplianceStore.Save(compliance) 2648 2649 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2650 if s.Root.Metrics != nil { 2651 success := "false" 2652 if err == nil { 2653 success = "true" 2654 } 2655 s.Root.Metrics.ObserveStoreMethodDuration("ComplianceStore.Save", success, elapsed) 2656 } 2657 return result, err 2658 } 2659 2660 func (s *TimerLayerComplianceStore) Update(compliance *model.Compliance) (*model.Compliance, error) { 2661 start := timemodule.Now() 2662 2663 result, err := s.ComplianceStore.Update(compliance) 2664 2665 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2666 if s.Root.Metrics != nil { 2667 success := "false" 2668 if err == nil { 2669 success = "true" 2670 } 2671 s.Root.Metrics.ObserveStoreMethodDuration("ComplianceStore.Update", success, elapsed) 2672 } 2673 return result, err 2674 } 2675 2676 func (s *TimerLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error { 2677 start := timemodule.Now() 2678 2679 err := s.EmojiStore.Delete(emoji, time) 2680 2681 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2682 if s.Root.Metrics != nil { 2683 success := "false" 2684 if err == nil { 2685 success = "true" 2686 } 2687 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.Delete", success, elapsed) 2688 } 2689 return err 2690 } 2691 2692 func (s *TimerLayerEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error) { 2693 start := timemodule.Now() 2694 2695 result, err := s.EmojiStore.Get(ctx, id, allowFromCache) 2696 2697 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2698 if s.Root.Metrics != nil { 2699 success := "false" 2700 if err == nil { 2701 success = "true" 2702 } 2703 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.Get", success, elapsed) 2704 } 2705 return result, err 2706 } 2707 2708 func (s *TimerLayerEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) { 2709 start := timemodule.Now() 2710 2711 result, err := s.EmojiStore.GetByName(ctx, name, allowFromCache) 2712 2713 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2714 if s.Root.Metrics != nil { 2715 success := "false" 2716 if err == nil { 2717 success = "true" 2718 } 2719 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.GetByName", success, elapsed) 2720 } 2721 return result, err 2722 } 2723 2724 func (s *TimerLayerEmojiStore) GetList(offset int, limit int, sort string) ([]*model.Emoji, error) { 2725 start := timemodule.Now() 2726 2727 result, err := s.EmojiStore.GetList(offset, limit, sort) 2728 2729 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2730 if s.Root.Metrics != nil { 2731 success := "false" 2732 if err == nil { 2733 success = "true" 2734 } 2735 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.GetList", success, elapsed) 2736 } 2737 return result, err 2738 } 2739 2740 func (s *TimerLayerEmojiStore) GetMultipleByName(names []string) ([]*model.Emoji, error) { 2741 start := timemodule.Now() 2742 2743 result, err := s.EmojiStore.GetMultipleByName(names) 2744 2745 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2746 if s.Root.Metrics != nil { 2747 success := "false" 2748 if err == nil { 2749 success = "true" 2750 } 2751 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.GetMultipleByName", success, elapsed) 2752 } 2753 return result, err 2754 } 2755 2756 func (s *TimerLayerEmojiStore) Save(emoji *model.Emoji) (*model.Emoji, error) { 2757 start := timemodule.Now() 2758 2759 result, err := s.EmojiStore.Save(emoji) 2760 2761 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2762 if s.Root.Metrics != nil { 2763 success := "false" 2764 if err == nil { 2765 success = "true" 2766 } 2767 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.Save", success, elapsed) 2768 } 2769 return result, err 2770 } 2771 2772 func (s *TimerLayerEmojiStore) Search(name string, prefixOnly bool, limit int) ([]*model.Emoji, error) { 2773 start := timemodule.Now() 2774 2775 result, err := s.EmojiStore.Search(name, prefixOnly, limit) 2776 2777 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2778 if s.Root.Metrics != nil { 2779 success := "false" 2780 if err == nil { 2781 success = "true" 2782 } 2783 s.Root.Metrics.ObserveStoreMethodDuration("EmojiStore.Search", success, elapsed) 2784 } 2785 return result, err 2786 } 2787 2788 func (s *TimerLayerFileInfoStore) AttachToPost(fileID string, postID string, creatorID string) error { 2789 start := timemodule.Now() 2790 2791 err := s.FileInfoStore.AttachToPost(fileID, postID, creatorID) 2792 2793 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2794 if s.Root.Metrics != nil { 2795 success := "false" 2796 if err == nil { 2797 success = "true" 2798 } 2799 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.AttachToPost", success, elapsed) 2800 } 2801 return err 2802 } 2803 2804 func (s *TimerLayerFileInfoStore) ClearCaches() { 2805 start := timemodule.Now() 2806 2807 s.FileInfoStore.ClearCaches() 2808 2809 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2810 if s.Root.Metrics != nil { 2811 success := "false" 2812 if true { 2813 success = "true" 2814 } 2815 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.ClearCaches", success, elapsed) 2816 } 2817 } 2818 2819 func (s *TimerLayerFileInfoStore) CountAll() (int64, error) { 2820 start := timemodule.Now() 2821 2822 result, err := s.FileInfoStore.CountAll() 2823 2824 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2825 if s.Root.Metrics != nil { 2826 success := "false" 2827 if err == nil { 2828 success = "true" 2829 } 2830 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.CountAll", success, elapsed) 2831 } 2832 return result, err 2833 } 2834 2835 func (s *TimerLayerFileInfoStore) DeleteForPost(postID string) (string, error) { 2836 start := timemodule.Now() 2837 2838 result, err := s.FileInfoStore.DeleteForPost(postID) 2839 2840 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2841 if s.Root.Metrics != nil { 2842 success := "false" 2843 if err == nil { 2844 success = "true" 2845 } 2846 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.DeleteForPost", success, elapsed) 2847 } 2848 return result, err 2849 } 2850 2851 func (s *TimerLayerFileInfoStore) Get(id string) (*model.FileInfo, error) { 2852 start := timemodule.Now() 2853 2854 result, err := s.FileInfoStore.Get(id) 2855 2856 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2857 if s.Root.Metrics != nil { 2858 success := "false" 2859 if err == nil { 2860 success = "true" 2861 } 2862 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.Get", success, elapsed) 2863 } 2864 return result, err 2865 } 2866 2867 func (s *TimerLayerFileInfoStore) GetByIds(ids []string) ([]*model.FileInfo, error) { 2868 start := timemodule.Now() 2869 2870 result, err := s.FileInfoStore.GetByIds(ids) 2871 2872 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2873 if s.Root.Metrics != nil { 2874 success := "false" 2875 if err == nil { 2876 success = "true" 2877 } 2878 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetByIds", success, elapsed) 2879 } 2880 return result, err 2881 } 2882 2883 func (s *TimerLayerFileInfoStore) GetByPath(path string) (*model.FileInfo, error) { 2884 start := timemodule.Now() 2885 2886 result, err := s.FileInfoStore.GetByPath(path) 2887 2888 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2889 if s.Root.Metrics != nil { 2890 success := "false" 2891 if err == nil { 2892 success = "true" 2893 } 2894 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetByPath", success, elapsed) 2895 } 2896 return result, err 2897 } 2898 2899 func (s *TimerLayerFileInfoStore) GetFilesBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.FileForIndexing, error) { 2900 start := timemodule.Now() 2901 2902 result, err := s.FileInfoStore.GetFilesBatchForIndexing(startTime, endTime, limit) 2903 2904 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2905 if s.Root.Metrics != nil { 2906 success := "false" 2907 if err == nil { 2908 success = "true" 2909 } 2910 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetFilesBatchForIndexing", success, elapsed) 2911 } 2912 return result, err 2913 } 2914 2915 func (s *TimerLayerFileInfoStore) GetForPost(postID string, readFromMaster bool, includeDeleted bool, allowFromCache bool) ([]*model.FileInfo, error) { 2916 start := timemodule.Now() 2917 2918 result, err := s.FileInfoStore.GetForPost(postID, readFromMaster, includeDeleted, allowFromCache) 2919 2920 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2921 if s.Root.Metrics != nil { 2922 success := "false" 2923 if err == nil { 2924 success = "true" 2925 } 2926 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetForPost", success, elapsed) 2927 } 2928 return result, err 2929 } 2930 2931 func (s *TimerLayerFileInfoStore) GetForUser(userID string) ([]*model.FileInfo, error) { 2932 start := timemodule.Now() 2933 2934 result, err := s.FileInfoStore.GetForUser(userID) 2935 2936 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2937 if s.Root.Metrics != nil { 2938 success := "false" 2939 if err == nil { 2940 success = "true" 2941 } 2942 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetForUser", success, elapsed) 2943 } 2944 return result, err 2945 } 2946 2947 func (s *TimerLayerFileInfoStore) GetFromMaster(id string) (*model.FileInfo, error) { 2948 start := timemodule.Now() 2949 2950 result, err := s.FileInfoStore.GetFromMaster(id) 2951 2952 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2953 if s.Root.Metrics != nil { 2954 success := "false" 2955 if err == nil { 2956 success = "true" 2957 } 2958 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetFromMaster", success, elapsed) 2959 } 2960 return result, err 2961 } 2962 2963 func (s *TimerLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error) { 2964 start := timemodule.Now() 2965 2966 result, err := s.FileInfoStore.GetWithOptions(page, perPage, opt) 2967 2968 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2969 if s.Root.Metrics != nil { 2970 success := "false" 2971 if err == nil { 2972 success = "true" 2973 } 2974 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.GetWithOptions", success, elapsed) 2975 } 2976 return result, err 2977 } 2978 2979 func (s *TimerLayerFileInfoStore) InvalidateFileInfosForPostCache(postID string, deleted bool) { 2980 start := timemodule.Now() 2981 2982 s.FileInfoStore.InvalidateFileInfosForPostCache(postID, deleted) 2983 2984 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 2985 if s.Root.Metrics != nil { 2986 success := "false" 2987 if true { 2988 success = "true" 2989 } 2990 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.InvalidateFileInfosForPostCache", success, elapsed) 2991 } 2992 } 2993 2994 func (s *TimerLayerFileInfoStore) PermanentDelete(fileID string) error { 2995 start := timemodule.Now() 2996 2997 err := s.FileInfoStore.PermanentDelete(fileID) 2998 2999 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3000 if s.Root.Metrics != nil { 3001 success := "false" 3002 if err == nil { 3003 success = "true" 3004 } 3005 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.PermanentDelete", success, elapsed) 3006 } 3007 return err 3008 } 3009 3010 func (s *TimerLayerFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { 3011 start := timemodule.Now() 3012 3013 result, err := s.FileInfoStore.PermanentDeleteBatch(endTime, limit) 3014 3015 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3016 if s.Root.Metrics != nil { 3017 success := "false" 3018 if err == nil { 3019 success = "true" 3020 } 3021 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.PermanentDeleteBatch", success, elapsed) 3022 } 3023 return result, err 3024 } 3025 3026 func (s *TimerLayerFileInfoStore) PermanentDeleteByUser(userID string) (int64, error) { 3027 start := timemodule.Now() 3028 3029 result, err := s.FileInfoStore.PermanentDeleteByUser(userID) 3030 3031 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3032 if s.Root.Metrics != nil { 3033 success := "false" 3034 if err == nil { 3035 success = "true" 3036 } 3037 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.PermanentDeleteByUser", success, elapsed) 3038 } 3039 return result, err 3040 } 3041 3042 func (s *TimerLayerFileInfoStore) Save(info *model.FileInfo) (*model.FileInfo, error) { 3043 start := timemodule.Now() 3044 3045 result, err := s.FileInfoStore.Save(info) 3046 3047 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3048 if s.Root.Metrics != nil { 3049 success := "false" 3050 if err == nil { 3051 success = "true" 3052 } 3053 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.Save", success, elapsed) 3054 } 3055 return result, err 3056 } 3057 3058 func (s *TimerLayerFileInfoStore) Search(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.FileInfoList, error) { 3059 start := timemodule.Now() 3060 3061 result, err := s.FileInfoStore.Search(paramsList, userID, teamID, page, perPage) 3062 3063 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3064 if s.Root.Metrics != nil { 3065 success := "false" 3066 if err == nil { 3067 success = "true" 3068 } 3069 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.Search", success, elapsed) 3070 } 3071 return result, err 3072 } 3073 3074 func (s *TimerLayerFileInfoStore) SetContent(fileID string, content string) error { 3075 start := timemodule.Now() 3076 3077 err := s.FileInfoStore.SetContent(fileID, content) 3078 3079 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3080 if s.Root.Metrics != nil { 3081 success := "false" 3082 if err == nil { 3083 success = "true" 3084 } 3085 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.SetContent", success, elapsed) 3086 } 3087 return err 3088 } 3089 3090 func (s *TimerLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo, error) { 3091 start := timemodule.Now() 3092 3093 result, err := s.FileInfoStore.Upsert(info) 3094 3095 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3096 if s.Root.Metrics != nil { 3097 success := "false" 3098 if err == nil { 3099 success = "true" 3100 } 3101 s.Root.Metrics.ObserveStoreMethodDuration("FileInfoStore.Upsert", success, elapsed) 3102 } 3103 return result, err 3104 } 3105 3106 func (s *TimerLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, error) { 3107 start := timemodule.Now() 3108 3109 result, err := s.GroupStore.AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType) 3110 3111 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3112 if s.Root.Metrics != nil { 3113 success := "false" 3114 if err == nil { 3115 success = "true" 3116 } 3117 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.AdminRoleGroupsForSyncableMember", success, elapsed) 3118 } 3119 return result, err 3120 } 3121 3122 func (s *TimerLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) { 3123 start := timemodule.Now() 3124 3125 result, err := s.GroupStore.ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage) 3126 3127 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3128 if s.Root.Metrics != nil { 3129 success := "false" 3130 if err == nil { 3131 success = "true" 3132 } 3133 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.ChannelMembersMinusGroupMembers", success, elapsed) 3134 } 3135 return result, err 3136 } 3137 3138 func (s *TimerLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string, includeRemovedMembers bool) ([]*model.UserChannelIDPair, error) { 3139 start := timemodule.Now() 3140 3141 result, err := s.GroupStore.ChannelMembersToAdd(since, channelID, includeRemovedMembers) 3142 3143 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3144 if s.Root.Metrics != nil { 3145 success := "false" 3146 if err == nil { 3147 success = "true" 3148 } 3149 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.ChannelMembersToAdd", success, elapsed) 3150 } 3151 return result, err 3152 } 3153 3154 func (s *TimerLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error) { 3155 start := timemodule.Now() 3156 3157 result, err := s.GroupStore.ChannelMembersToRemove(channelID) 3158 3159 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3160 if s.Root.Metrics != nil { 3161 success := "false" 3162 if err == nil { 3163 success = "true" 3164 } 3165 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.ChannelMembersToRemove", success, elapsed) 3166 } 3167 return result, err 3168 } 3169 3170 func (s *TimerLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error) { 3171 start := timemodule.Now() 3172 3173 result, err := s.GroupStore.CountChannelMembersMinusGroupMembers(channelID, groupIDs) 3174 3175 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3176 if s.Root.Metrics != nil { 3177 success := "false" 3178 if err == nil { 3179 success = "true" 3180 } 3181 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.CountChannelMembersMinusGroupMembers", success, elapsed) 3182 } 3183 return result, err 3184 } 3185 3186 func (s *TimerLayerGroupStore) CountGroupsByChannel(channelID string, opts model.GroupSearchOpts) (int64, error) { 3187 start := timemodule.Now() 3188 3189 result, err := s.GroupStore.CountGroupsByChannel(channelID, opts) 3190 3191 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3192 if s.Root.Metrics != nil { 3193 success := "false" 3194 if err == nil { 3195 success = "true" 3196 } 3197 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.CountGroupsByChannel", success, elapsed) 3198 } 3199 return result, err 3200 } 3201 3202 func (s *TimerLayerGroupStore) CountGroupsByTeam(teamID string, opts model.GroupSearchOpts) (int64, error) { 3203 start := timemodule.Now() 3204 3205 result, err := s.GroupStore.CountGroupsByTeam(teamID, opts) 3206 3207 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3208 if s.Root.Metrics != nil { 3209 success := "false" 3210 if err == nil { 3211 success = "true" 3212 } 3213 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.CountGroupsByTeam", success, elapsed) 3214 } 3215 return result, err 3216 } 3217 3218 func (s *TimerLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error) { 3219 start := timemodule.Now() 3220 3221 result, err := s.GroupStore.CountTeamMembersMinusGroupMembers(teamID, groupIDs) 3222 3223 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3224 if s.Root.Metrics != nil { 3225 success := "false" 3226 if err == nil { 3227 success = "true" 3228 } 3229 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.CountTeamMembersMinusGroupMembers", success, elapsed) 3230 } 3231 return result, err 3232 } 3233 3234 func (s *TimerLayerGroupStore) Create(group *model.Group) (*model.Group, error) { 3235 start := timemodule.Now() 3236 3237 result, err := s.GroupStore.Create(group) 3238 3239 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3240 if s.Root.Metrics != nil { 3241 success := "false" 3242 if err == nil { 3243 success = "true" 3244 } 3245 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.Create", success, elapsed) 3246 } 3247 return result, err 3248 } 3249 3250 func (s *TimerLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) { 3251 start := timemodule.Now() 3252 3253 result, err := s.GroupStore.CreateGroupSyncable(groupSyncable) 3254 3255 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3256 if s.Root.Metrics != nil { 3257 success := "false" 3258 if err == nil { 3259 success = "true" 3260 } 3261 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.CreateGroupSyncable", success, elapsed) 3262 } 3263 return result, err 3264 } 3265 3266 func (s *TimerLayerGroupStore) Delete(groupID string) (*model.Group, error) { 3267 start := timemodule.Now() 3268 3269 result, err := s.GroupStore.Delete(groupID) 3270 3271 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3272 if s.Root.Metrics != nil { 3273 success := "false" 3274 if err == nil { 3275 success = "true" 3276 } 3277 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.Delete", success, elapsed) 3278 } 3279 return result, err 3280 } 3281 3282 func (s *TimerLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) { 3283 start := timemodule.Now() 3284 3285 result, err := s.GroupStore.DeleteGroupSyncable(groupID, syncableID, syncableType) 3286 3287 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3288 if s.Root.Metrics != nil { 3289 success := "false" 3290 if err == nil { 3291 success = "true" 3292 } 3293 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.DeleteGroupSyncable", success, elapsed) 3294 } 3295 return result, err 3296 } 3297 3298 func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error) { 3299 start := timemodule.Now() 3300 3301 result, err := s.GroupStore.DeleteMember(groupID, userID) 3302 3303 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3304 if s.Root.Metrics != nil { 3305 success := "false" 3306 if err == nil { 3307 success = "true" 3308 } 3309 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.DeleteMember", success, elapsed) 3310 } 3311 return result, err 3312 } 3313 3314 func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, error) { 3315 start := timemodule.Now() 3316 3317 result, err := s.GroupStore.DistinctGroupMemberCount() 3318 3319 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3320 if s.Root.Metrics != nil { 3321 success := "false" 3322 if err == nil { 3323 success = "true" 3324 } 3325 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.DistinctGroupMemberCount", success, elapsed) 3326 } 3327 return result, err 3328 } 3329 3330 func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, error) { 3331 start := timemodule.Now() 3332 3333 result, err := s.GroupStore.Get(groupID) 3334 3335 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3336 if s.Root.Metrics != nil { 3337 success := "false" 3338 if err == nil { 3339 success = "true" 3340 } 3341 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.Get", success, elapsed) 3342 } 3343 return result, err 3344 } 3345 3346 func (s *TimerLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error) { 3347 start := timemodule.Now() 3348 3349 result, err := s.GroupStore.GetAllBySource(groupSource) 3350 3351 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3352 if s.Root.Metrics != nil { 3353 success := "false" 3354 if err == nil { 3355 success = "true" 3356 } 3357 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetAllBySource", success, elapsed) 3358 } 3359 return result, err 3360 } 3361 3362 func (s *TimerLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error) { 3363 start := timemodule.Now() 3364 3365 result, err := s.GroupStore.GetAllGroupSyncablesByGroupId(groupID, syncableType) 3366 3367 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3368 if s.Root.Metrics != nil { 3369 success := "false" 3370 if err == nil { 3371 success = "true" 3372 } 3373 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetAllGroupSyncablesByGroupId", success, elapsed) 3374 } 3375 return result, err 3376 } 3377 3378 func (s *TimerLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error) { 3379 start := timemodule.Now() 3380 3381 result, err := s.GroupStore.GetByIDs(groupIDs) 3382 3383 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3384 if s.Root.Metrics != nil { 3385 success := "false" 3386 if err == nil { 3387 success = "true" 3388 } 3389 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetByIDs", success, elapsed) 3390 } 3391 return result, err 3392 } 3393 3394 func (s *TimerLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error) { 3395 start := timemodule.Now() 3396 3397 result, err := s.GroupStore.GetByName(name, opts) 3398 3399 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3400 if s.Root.Metrics != nil { 3401 success := "false" 3402 if err == nil { 3403 success = "true" 3404 } 3405 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetByName", success, elapsed) 3406 } 3407 return result, err 3408 } 3409 3410 func (s *TimerLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error) { 3411 start := timemodule.Now() 3412 3413 result, err := s.GroupStore.GetByRemoteID(remoteID, groupSource) 3414 3415 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3416 if s.Root.Metrics != nil { 3417 success := "false" 3418 if err == nil { 3419 success = "true" 3420 } 3421 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetByRemoteID", success, elapsed) 3422 } 3423 return result, err 3424 } 3425 3426 func (s *TimerLayerGroupStore) GetByUser(userID string) ([]*model.Group, error) { 3427 start := timemodule.Now() 3428 3429 result, err := s.GroupStore.GetByUser(userID) 3430 3431 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3432 if s.Root.Metrics != nil { 3433 success := "false" 3434 if err == nil { 3435 success = "true" 3436 } 3437 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetByUser", success, elapsed) 3438 } 3439 return result, err 3440 } 3441 3442 func (s *TimerLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) { 3443 start := timemodule.Now() 3444 3445 result, err := s.GroupStore.GetGroupSyncable(groupID, syncableID, syncableType) 3446 3447 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3448 if s.Root.Metrics != nil { 3449 success := "false" 3450 if err == nil { 3451 success = "true" 3452 } 3453 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroupSyncable", success, elapsed) 3454 } 3455 return result, err 3456 } 3457 3458 func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error) { 3459 start := timemodule.Now() 3460 3461 result, err := s.GroupStore.GetGroups(page, perPage, opts) 3462 3463 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3464 if s.Root.Metrics != nil { 3465 success := "false" 3466 if err == nil { 3467 success = "true" 3468 } 3469 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroups", success, elapsed) 3470 } 3471 return result, err 3472 } 3473 3474 func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamID string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error) { 3475 start := timemodule.Now() 3476 3477 result, err := s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamID, opts) 3478 3479 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3480 if s.Root.Metrics != nil { 3481 success := "false" 3482 if err == nil { 3483 success = "true" 3484 } 3485 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroupsAssociatedToChannelsByTeam", success, elapsed) 3486 } 3487 return result, err 3488 } 3489 3490 func (s *TimerLayerGroupStore) GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) { 3491 start := timemodule.Now() 3492 3493 result, err := s.GroupStore.GetGroupsByChannel(channelID, opts) 3494 3495 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3496 if s.Root.Metrics != nil { 3497 success := "false" 3498 if err == nil { 3499 success = "true" 3500 } 3501 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroupsByChannel", success, elapsed) 3502 } 3503 return result, err 3504 } 3505 3506 func (s *TimerLayerGroupStore) GetGroupsByTeam(teamID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) { 3507 start := timemodule.Now() 3508 3509 result, err := s.GroupStore.GetGroupsByTeam(teamID, opts) 3510 3511 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3512 if s.Root.Metrics != nil { 3513 success := "false" 3514 if err == nil { 3515 success = "true" 3516 } 3517 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetGroupsByTeam", success, elapsed) 3518 } 3519 return result, err 3520 } 3521 3522 func (s *TimerLayerGroupStore) GetMemberCount(groupID string) (int64, error) { 3523 start := timemodule.Now() 3524 3525 result, err := s.GroupStore.GetMemberCount(groupID) 3526 3527 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3528 if s.Root.Metrics != nil { 3529 success := "false" 3530 if err == nil { 3531 success = "true" 3532 } 3533 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetMemberCount", success, elapsed) 3534 } 3535 return result, err 3536 } 3537 3538 func (s *TimerLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, error) { 3539 start := timemodule.Now() 3540 3541 result, err := s.GroupStore.GetMemberUsers(groupID) 3542 3543 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3544 if s.Root.Metrics != nil { 3545 success := "false" 3546 if err == nil { 3547 success = "true" 3548 } 3549 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetMemberUsers", success, elapsed) 3550 } 3551 return result, err 3552 } 3553 3554 func (s *TimerLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error) { 3555 start := timemodule.Now() 3556 3557 result, err := s.GroupStore.GetMemberUsersInTeam(groupID, teamID) 3558 3559 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3560 if s.Root.Metrics != nil { 3561 success := "false" 3562 if err == nil { 3563 success = "true" 3564 } 3565 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetMemberUsersInTeam", success, elapsed) 3566 } 3567 return result, err 3568 } 3569 3570 func (s *TimerLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error) { 3571 start := timemodule.Now() 3572 3573 result, err := s.GroupStore.GetMemberUsersNotInChannel(groupID, channelID) 3574 3575 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3576 if s.Root.Metrics != nil { 3577 success := "false" 3578 if err == nil { 3579 success = "true" 3580 } 3581 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetMemberUsersNotInChannel", success, elapsed) 3582 } 3583 return result, err 3584 } 3585 3586 func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error) { 3587 start := timemodule.Now() 3588 3589 result, err := s.GroupStore.GetMemberUsersPage(groupID, page, perPage) 3590 3591 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3592 if s.Root.Metrics != nil { 3593 success := "false" 3594 if err == nil { 3595 success = "true" 3596 } 3597 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GetMemberUsersPage", success, elapsed) 3598 } 3599 return result, err 3600 } 3601 3602 func (s *TimerLayerGroupStore) GroupChannelCount() (int64, error) { 3603 start := timemodule.Now() 3604 3605 result, err := s.GroupStore.GroupChannelCount() 3606 3607 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3608 if s.Root.Metrics != nil { 3609 success := "false" 3610 if err == nil { 3611 success = "true" 3612 } 3613 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupChannelCount", success, elapsed) 3614 } 3615 return result, err 3616 } 3617 3618 func (s *TimerLayerGroupStore) GroupCount() (int64, error) { 3619 start := timemodule.Now() 3620 3621 result, err := s.GroupStore.GroupCount() 3622 3623 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3624 if s.Root.Metrics != nil { 3625 success := "false" 3626 if err == nil { 3627 success = "true" 3628 } 3629 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupCount", success, elapsed) 3630 } 3631 return result, err 3632 } 3633 3634 func (s *TimerLayerGroupStore) GroupCountWithAllowReference() (int64, error) { 3635 start := timemodule.Now() 3636 3637 result, err := s.GroupStore.GroupCountWithAllowReference() 3638 3639 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3640 if s.Root.Metrics != nil { 3641 success := "false" 3642 if err == nil { 3643 success = "true" 3644 } 3645 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupCountWithAllowReference", success, elapsed) 3646 } 3647 return result, err 3648 } 3649 3650 func (s *TimerLayerGroupStore) GroupMemberCount() (int64, error) { 3651 start := timemodule.Now() 3652 3653 result, err := s.GroupStore.GroupMemberCount() 3654 3655 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3656 if s.Root.Metrics != nil { 3657 success := "false" 3658 if err == nil { 3659 success = "true" 3660 } 3661 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupMemberCount", success, elapsed) 3662 } 3663 return result, err 3664 } 3665 3666 func (s *TimerLayerGroupStore) GroupTeamCount() (int64, error) { 3667 start := timemodule.Now() 3668 3669 result, err := s.GroupStore.GroupTeamCount() 3670 3671 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3672 if s.Root.Metrics != nil { 3673 success := "false" 3674 if err == nil { 3675 success = "true" 3676 } 3677 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.GroupTeamCount", success, elapsed) 3678 } 3679 return result, err 3680 } 3681 3682 func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userID string) error { 3683 start := timemodule.Now() 3684 3685 err := s.GroupStore.PermanentDeleteMembersByUser(userID) 3686 3687 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3688 if s.Root.Metrics != nil { 3689 success := "false" 3690 if err == nil { 3691 success = "true" 3692 } 3693 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.PermanentDeleteMembersByUser", success, elapsed) 3694 } 3695 return err 3696 } 3697 3698 func (s *TimerLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error) { 3699 start := timemodule.Now() 3700 3701 result, err := s.GroupStore.PermittedSyncableAdmins(syncableID, syncableType) 3702 3703 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3704 if s.Root.Metrics != nil { 3705 success := "false" 3706 if err == nil { 3707 success = "true" 3708 } 3709 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.PermittedSyncableAdmins", success, elapsed) 3710 } 3711 return result, err 3712 } 3713 3714 func (s *TimerLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) { 3715 start := timemodule.Now() 3716 3717 result, err := s.GroupStore.TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage) 3718 3719 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3720 if s.Root.Metrics != nil { 3721 success := "false" 3722 if err == nil { 3723 success = "true" 3724 } 3725 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.TeamMembersMinusGroupMembers", success, elapsed) 3726 } 3727 return result, err 3728 } 3729 3730 func (s *TimerLayerGroupStore) TeamMembersToAdd(since int64, teamID *string, includeRemovedMembers bool) ([]*model.UserTeamIDPair, error) { 3731 start := timemodule.Now() 3732 3733 result, err := s.GroupStore.TeamMembersToAdd(since, teamID, includeRemovedMembers) 3734 3735 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3736 if s.Root.Metrics != nil { 3737 success := "false" 3738 if err == nil { 3739 success = "true" 3740 } 3741 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.TeamMembersToAdd", success, elapsed) 3742 } 3743 return result, err 3744 } 3745 3746 func (s *TimerLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error) { 3747 start := timemodule.Now() 3748 3749 result, err := s.GroupStore.TeamMembersToRemove(teamID) 3750 3751 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3752 if s.Root.Metrics != nil { 3753 success := "false" 3754 if err == nil { 3755 success = "true" 3756 } 3757 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.TeamMembersToRemove", success, elapsed) 3758 } 3759 return result, err 3760 } 3761 3762 func (s *TimerLayerGroupStore) Update(group *model.Group) (*model.Group, error) { 3763 start := timemodule.Now() 3764 3765 result, err := s.GroupStore.Update(group) 3766 3767 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3768 if s.Root.Metrics != nil { 3769 success := "false" 3770 if err == nil { 3771 success = "true" 3772 } 3773 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.Update", success, elapsed) 3774 } 3775 return result, err 3776 } 3777 3778 func (s *TimerLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) { 3779 start := timemodule.Now() 3780 3781 result, err := s.GroupStore.UpdateGroupSyncable(groupSyncable) 3782 3783 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3784 if s.Root.Metrics != nil { 3785 success := "false" 3786 if err == nil { 3787 success = "true" 3788 } 3789 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.UpdateGroupSyncable", success, elapsed) 3790 } 3791 return result, err 3792 } 3793 3794 func (s *TimerLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error) { 3795 start := timemodule.Now() 3796 3797 result, err := s.GroupStore.UpsertMember(groupID, userID) 3798 3799 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3800 if s.Root.Metrics != nil { 3801 success := "false" 3802 if err == nil { 3803 success = "true" 3804 } 3805 s.Root.Metrics.ObserveStoreMethodDuration("GroupStore.UpsertMember", success, elapsed) 3806 } 3807 return result, err 3808 } 3809 3810 func (s *TimerLayerJobStore) Delete(id string) (string, error) { 3811 start := timemodule.Now() 3812 3813 result, err := s.JobStore.Delete(id) 3814 3815 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3816 if s.Root.Metrics != nil { 3817 success := "false" 3818 if err == nil { 3819 success = "true" 3820 } 3821 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.Delete", success, elapsed) 3822 } 3823 return result, err 3824 } 3825 3826 func (s *TimerLayerJobStore) Get(id string) (*model.Job, error) { 3827 start := timemodule.Now() 3828 3829 result, err := s.JobStore.Get(id) 3830 3831 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3832 if s.Root.Metrics != nil { 3833 success := "false" 3834 if err == nil { 3835 success = "true" 3836 } 3837 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.Get", success, elapsed) 3838 } 3839 return result, err 3840 } 3841 3842 func (s *TimerLayerJobStore) GetAllByStatus(status string) ([]*model.Job, error) { 3843 start := timemodule.Now() 3844 3845 result, err := s.JobStore.GetAllByStatus(status) 3846 3847 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3848 if s.Root.Metrics != nil { 3849 success := "false" 3850 if err == nil { 3851 success = "true" 3852 } 3853 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetAllByStatus", success, elapsed) 3854 } 3855 return result, err 3856 } 3857 3858 func (s *TimerLayerJobStore) GetAllByType(jobType string) ([]*model.Job, error) { 3859 start := timemodule.Now() 3860 3861 result, err := s.JobStore.GetAllByType(jobType) 3862 3863 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3864 if s.Root.Metrics != nil { 3865 success := "false" 3866 if err == nil { 3867 success = "true" 3868 } 3869 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetAllByType", success, elapsed) 3870 } 3871 return result, err 3872 } 3873 3874 func (s *TimerLayerJobStore) GetAllByTypePage(jobType string, offset int, limit int) ([]*model.Job, error) { 3875 start := timemodule.Now() 3876 3877 result, err := s.JobStore.GetAllByTypePage(jobType, offset, limit) 3878 3879 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3880 if s.Root.Metrics != nil { 3881 success := "false" 3882 if err == nil { 3883 success = "true" 3884 } 3885 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetAllByTypePage", success, elapsed) 3886 } 3887 return result, err 3888 } 3889 3890 func (s *TimerLayerJobStore) GetAllByTypesPage(jobTypes []string, offset int, limit int) ([]*model.Job, error) { 3891 start := timemodule.Now() 3892 3893 result, err := s.JobStore.GetAllByTypesPage(jobTypes, offset, limit) 3894 3895 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3896 if s.Root.Metrics != nil { 3897 success := "false" 3898 if err == nil { 3899 success = "true" 3900 } 3901 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetAllByTypesPage", success, elapsed) 3902 } 3903 return result, err 3904 } 3905 3906 func (s *TimerLayerJobStore) GetAllPage(offset int, limit int) ([]*model.Job, error) { 3907 start := timemodule.Now() 3908 3909 result, err := s.JobStore.GetAllPage(offset, limit) 3910 3911 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3912 if s.Root.Metrics != nil { 3913 success := "false" 3914 if err == nil { 3915 success = "true" 3916 } 3917 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetAllPage", success, elapsed) 3918 } 3919 return result, err 3920 } 3921 3922 func (s *TimerLayerJobStore) GetCountByStatusAndType(status string, jobType string) (int64, error) { 3923 start := timemodule.Now() 3924 3925 result, err := s.JobStore.GetCountByStatusAndType(status, jobType) 3926 3927 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3928 if s.Root.Metrics != nil { 3929 success := "false" 3930 if err == nil { 3931 success = "true" 3932 } 3933 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetCountByStatusAndType", success, elapsed) 3934 } 3935 return result, err 3936 } 3937 3938 func (s *TimerLayerJobStore) GetNewestJobByStatusAndType(status string, jobType string) (*model.Job, error) { 3939 start := timemodule.Now() 3940 3941 result, err := s.JobStore.GetNewestJobByStatusAndType(status, jobType) 3942 3943 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3944 if s.Root.Metrics != nil { 3945 success := "false" 3946 if err == nil { 3947 success = "true" 3948 } 3949 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetNewestJobByStatusAndType", success, elapsed) 3950 } 3951 return result, err 3952 } 3953 3954 func (s *TimerLayerJobStore) GetNewestJobByStatusesAndType(statuses []string, jobType string) (*model.Job, error) { 3955 start := timemodule.Now() 3956 3957 result, err := s.JobStore.GetNewestJobByStatusesAndType(statuses, jobType) 3958 3959 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3960 if s.Root.Metrics != nil { 3961 success := "false" 3962 if err == nil { 3963 success = "true" 3964 } 3965 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.GetNewestJobByStatusesAndType", success, elapsed) 3966 } 3967 return result, err 3968 } 3969 3970 func (s *TimerLayerJobStore) Save(job *model.Job) (*model.Job, error) { 3971 start := timemodule.Now() 3972 3973 result, err := s.JobStore.Save(job) 3974 3975 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3976 if s.Root.Metrics != nil { 3977 success := "false" 3978 if err == nil { 3979 success = "true" 3980 } 3981 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.Save", success, elapsed) 3982 } 3983 return result, err 3984 } 3985 3986 func (s *TimerLayerJobStore) UpdateOptimistically(job *model.Job, currentStatus string) (bool, error) { 3987 start := timemodule.Now() 3988 3989 result, err := s.JobStore.UpdateOptimistically(job, currentStatus) 3990 3991 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 3992 if s.Root.Metrics != nil { 3993 success := "false" 3994 if err == nil { 3995 success = "true" 3996 } 3997 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.UpdateOptimistically", success, elapsed) 3998 } 3999 return result, err 4000 } 4001 4002 func (s *TimerLayerJobStore) UpdateStatus(id string, status string) (*model.Job, error) { 4003 start := timemodule.Now() 4004 4005 result, err := s.JobStore.UpdateStatus(id, status) 4006 4007 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4008 if s.Root.Metrics != nil { 4009 success := "false" 4010 if err == nil { 4011 success = "true" 4012 } 4013 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.UpdateStatus", success, elapsed) 4014 } 4015 return result, err 4016 } 4017 4018 func (s *TimerLayerJobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (bool, error) { 4019 start := timemodule.Now() 4020 4021 result, err := s.JobStore.UpdateStatusOptimistically(id, currentStatus, newStatus) 4022 4023 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4024 if s.Root.Metrics != nil { 4025 success := "false" 4026 if err == nil { 4027 success = "true" 4028 } 4029 s.Root.Metrics.ObserveStoreMethodDuration("JobStore.UpdateStatusOptimistically", success, elapsed) 4030 } 4031 return result, err 4032 } 4033 4034 func (s *TimerLayerLicenseStore) Get(id string) (*model.LicenseRecord, error) { 4035 start := timemodule.Now() 4036 4037 result, err := s.LicenseStore.Get(id) 4038 4039 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4040 if s.Root.Metrics != nil { 4041 success := "false" 4042 if err == nil { 4043 success = "true" 4044 } 4045 s.Root.Metrics.ObserveStoreMethodDuration("LicenseStore.Get", success, elapsed) 4046 } 4047 return result, err 4048 } 4049 4050 func (s *TimerLayerLicenseStore) GetAll() ([]*model.LicenseRecord, error) { 4051 start := timemodule.Now() 4052 4053 result, err := s.LicenseStore.GetAll() 4054 4055 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4056 if s.Root.Metrics != nil { 4057 success := "false" 4058 if err == nil { 4059 success = "true" 4060 } 4061 s.Root.Metrics.ObserveStoreMethodDuration("LicenseStore.GetAll", success, elapsed) 4062 } 4063 return result, err 4064 } 4065 4066 func (s *TimerLayerLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseRecord, error) { 4067 start := timemodule.Now() 4068 4069 result, err := s.LicenseStore.Save(license) 4070 4071 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4072 if s.Root.Metrics != nil { 4073 success := "false" 4074 if err == nil { 4075 success = "true" 4076 } 4077 s.Root.Metrics.ObserveStoreMethodDuration("LicenseStore.Save", success, elapsed) 4078 } 4079 return result, err 4080 } 4081 4082 func (s *TimerLayerLinkMetadataStore) Get(url string, timestamp int64) (*model.LinkMetadata, error) { 4083 start := timemodule.Now() 4084 4085 result, err := s.LinkMetadataStore.Get(url, timestamp) 4086 4087 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4088 if s.Root.Metrics != nil { 4089 success := "false" 4090 if err == nil { 4091 success = "true" 4092 } 4093 s.Root.Metrics.ObserveStoreMethodDuration("LinkMetadataStore.Get", success, elapsed) 4094 } 4095 return result, err 4096 } 4097 4098 func (s *TimerLayerLinkMetadataStore) Save(linkMetadata *model.LinkMetadata) (*model.LinkMetadata, error) { 4099 start := timemodule.Now() 4100 4101 result, err := s.LinkMetadataStore.Save(linkMetadata) 4102 4103 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4104 if s.Root.Metrics != nil { 4105 success := "false" 4106 if err == nil { 4107 success = "true" 4108 } 4109 s.Root.Metrics.ObserveStoreMethodDuration("LinkMetadataStore.Save", success, elapsed) 4110 } 4111 return result, err 4112 } 4113 4114 func (s *TimerLayerOAuthStore) DeleteApp(id string) error { 4115 start := timemodule.Now() 4116 4117 err := s.OAuthStore.DeleteApp(id) 4118 4119 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4120 if s.Root.Metrics != nil { 4121 success := "false" 4122 if err == nil { 4123 success = "true" 4124 } 4125 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.DeleteApp", success, elapsed) 4126 } 4127 return err 4128 } 4129 4130 func (s *TimerLayerOAuthStore) GetAccessData(token string) (*model.AccessData, error) { 4131 start := timemodule.Now() 4132 4133 result, err := s.OAuthStore.GetAccessData(token) 4134 4135 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4136 if s.Root.Metrics != nil { 4137 success := "false" 4138 if err == nil { 4139 success = "true" 4140 } 4141 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetAccessData", success, elapsed) 4142 } 4143 return result, err 4144 } 4145 4146 func (s *TimerLayerOAuthStore) GetAccessDataByRefreshToken(token string) (*model.AccessData, error) { 4147 start := timemodule.Now() 4148 4149 result, err := s.OAuthStore.GetAccessDataByRefreshToken(token) 4150 4151 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4152 if s.Root.Metrics != nil { 4153 success := "false" 4154 if err == nil { 4155 success = "true" 4156 } 4157 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetAccessDataByRefreshToken", success, elapsed) 4158 } 4159 return result, err 4160 } 4161 4162 func (s *TimerLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { 4163 start := timemodule.Now() 4164 4165 result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientId) 4166 4167 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4168 if s.Root.Metrics != nil { 4169 success := "false" 4170 if err == nil { 4171 success = "true" 4172 } 4173 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetAccessDataByUserForApp", success, elapsed) 4174 } 4175 return result, err 4176 } 4177 4178 func (s *TimerLayerOAuthStore) GetApp(id string) (*model.OAuthApp, error) { 4179 start := timemodule.Now() 4180 4181 result, err := s.OAuthStore.GetApp(id) 4182 4183 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4184 if s.Root.Metrics != nil { 4185 success := "false" 4186 if err == nil { 4187 success = "true" 4188 } 4189 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetApp", success, elapsed) 4190 } 4191 return result, err 4192 } 4193 4194 func (s *TimerLayerOAuthStore) GetAppByUser(userID string, offset int, limit int) ([]*model.OAuthApp, error) { 4195 start := timemodule.Now() 4196 4197 result, err := s.OAuthStore.GetAppByUser(userID, offset, limit) 4198 4199 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4200 if s.Root.Metrics != nil { 4201 success := "false" 4202 if err == nil { 4203 success = "true" 4204 } 4205 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetAppByUser", success, elapsed) 4206 } 4207 return result, err 4208 } 4209 4210 func (s *TimerLayerOAuthStore) GetApps(offset int, limit int) ([]*model.OAuthApp, error) { 4211 start := timemodule.Now() 4212 4213 result, err := s.OAuthStore.GetApps(offset, limit) 4214 4215 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4216 if s.Root.Metrics != nil { 4217 success := "false" 4218 if err == nil { 4219 success = "true" 4220 } 4221 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetApps", success, elapsed) 4222 } 4223 return result, err 4224 } 4225 4226 func (s *TimerLayerOAuthStore) GetAuthData(code string) (*model.AuthData, error) { 4227 start := timemodule.Now() 4228 4229 result, err := s.OAuthStore.GetAuthData(code) 4230 4231 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4232 if s.Root.Metrics != nil { 4233 success := "false" 4234 if err == nil { 4235 success = "true" 4236 } 4237 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetAuthData", success, elapsed) 4238 } 4239 return result, err 4240 } 4241 4242 func (s *TimerLayerOAuthStore) GetAuthorizedApps(userID string, offset int, limit int) ([]*model.OAuthApp, error) { 4243 start := timemodule.Now() 4244 4245 result, err := s.OAuthStore.GetAuthorizedApps(userID, offset, limit) 4246 4247 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4248 if s.Root.Metrics != nil { 4249 success := "false" 4250 if err == nil { 4251 success = "true" 4252 } 4253 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetAuthorizedApps", success, elapsed) 4254 } 4255 return result, err 4256 } 4257 4258 func (s *TimerLayerOAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { 4259 start := timemodule.Now() 4260 4261 result, err := s.OAuthStore.GetPreviousAccessData(userID, clientId) 4262 4263 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4264 if s.Root.Metrics != nil { 4265 success := "false" 4266 if err == nil { 4267 success = "true" 4268 } 4269 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.GetPreviousAccessData", success, elapsed) 4270 } 4271 return result, err 4272 } 4273 4274 func (s *TimerLayerOAuthStore) PermanentDeleteAuthDataByUser(userID string) error { 4275 start := timemodule.Now() 4276 4277 err := s.OAuthStore.PermanentDeleteAuthDataByUser(userID) 4278 4279 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4280 if s.Root.Metrics != nil { 4281 success := "false" 4282 if err == nil { 4283 success = "true" 4284 } 4285 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.PermanentDeleteAuthDataByUser", success, elapsed) 4286 } 4287 return err 4288 } 4289 4290 func (s *TimerLayerOAuthStore) RemoveAccessData(token string) error { 4291 start := timemodule.Now() 4292 4293 err := s.OAuthStore.RemoveAccessData(token) 4294 4295 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4296 if s.Root.Metrics != nil { 4297 success := "false" 4298 if err == nil { 4299 success = "true" 4300 } 4301 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.RemoveAccessData", success, elapsed) 4302 } 4303 return err 4304 } 4305 4306 func (s *TimerLayerOAuthStore) RemoveAllAccessData() error { 4307 start := timemodule.Now() 4308 4309 err := s.OAuthStore.RemoveAllAccessData() 4310 4311 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4312 if s.Root.Metrics != nil { 4313 success := "false" 4314 if err == nil { 4315 success = "true" 4316 } 4317 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.RemoveAllAccessData", success, elapsed) 4318 } 4319 return err 4320 } 4321 4322 func (s *TimerLayerOAuthStore) RemoveAuthData(code string) error { 4323 start := timemodule.Now() 4324 4325 err := s.OAuthStore.RemoveAuthData(code) 4326 4327 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4328 if s.Root.Metrics != nil { 4329 success := "false" 4330 if err == nil { 4331 success = "true" 4332 } 4333 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.RemoveAuthData", success, elapsed) 4334 } 4335 return err 4336 } 4337 4338 func (s *TimerLayerOAuthStore) SaveAccessData(accessData *model.AccessData) (*model.AccessData, error) { 4339 start := timemodule.Now() 4340 4341 result, err := s.OAuthStore.SaveAccessData(accessData) 4342 4343 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4344 if s.Root.Metrics != nil { 4345 success := "false" 4346 if err == nil { 4347 success = "true" 4348 } 4349 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.SaveAccessData", success, elapsed) 4350 } 4351 return result, err 4352 } 4353 4354 func (s *TimerLayerOAuthStore) SaveApp(app *model.OAuthApp) (*model.OAuthApp, error) { 4355 start := timemodule.Now() 4356 4357 result, err := s.OAuthStore.SaveApp(app) 4358 4359 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4360 if s.Root.Metrics != nil { 4361 success := "false" 4362 if err == nil { 4363 success = "true" 4364 } 4365 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.SaveApp", success, elapsed) 4366 } 4367 return result, err 4368 } 4369 4370 func (s *TimerLayerOAuthStore) SaveAuthData(authData *model.AuthData) (*model.AuthData, error) { 4371 start := timemodule.Now() 4372 4373 result, err := s.OAuthStore.SaveAuthData(authData) 4374 4375 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4376 if s.Root.Metrics != nil { 4377 success := "false" 4378 if err == nil { 4379 success = "true" 4380 } 4381 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.SaveAuthData", success, elapsed) 4382 } 4383 return result, err 4384 } 4385 4386 func (s *TimerLayerOAuthStore) UpdateAccessData(accessData *model.AccessData) (*model.AccessData, error) { 4387 start := timemodule.Now() 4388 4389 result, err := s.OAuthStore.UpdateAccessData(accessData) 4390 4391 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4392 if s.Root.Metrics != nil { 4393 success := "false" 4394 if err == nil { 4395 success = "true" 4396 } 4397 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.UpdateAccessData", success, elapsed) 4398 } 4399 return result, err 4400 } 4401 4402 func (s *TimerLayerOAuthStore) UpdateApp(app *model.OAuthApp) (*model.OAuthApp, error) { 4403 start := timemodule.Now() 4404 4405 result, err := s.OAuthStore.UpdateApp(app) 4406 4407 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4408 if s.Root.Metrics != nil { 4409 success := "false" 4410 if err == nil { 4411 success = "true" 4412 } 4413 s.Root.Metrics.ObserveStoreMethodDuration("OAuthStore.UpdateApp", success, elapsed) 4414 } 4415 return result, err 4416 } 4417 4418 func (s *TimerLayerPluginStore) CompareAndDelete(keyVal *model.PluginKeyValue, oldValue []byte) (bool, error) { 4419 start := timemodule.Now() 4420 4421 result, err := s.PluginStore.CompareAndDelete(keyVal, oldValue) 4422 4423 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4424 if s.Root.Metrics != nil { 4425 success := "false" 4426 if err == nil { 4427 success = "true" 4428 } 4429 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.CompareAndDelete", success, elapsed) 4430 } 4431 return result, err 4432 } 4433 4434 func (s *TimerLayerPluginStore) CompareAndSet(keyVal *model.PluginKeyValue, oldValue []byte) (bool, error) { 4435 start := timemodule.Now() 4436 4437 result, err := s.PluginStore.CompareAndSet(keyVal, oldValue) 4438 4439 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4440 if s.Root.Metrics != nil { 4441 success := "false" 4442 if err == nil { 4443 success = "true" 4444 } 4445 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.CompareAndSet", success, elapsed) 4446 } 4447 return result, err 4448 } 4449 4450 func (s *TimerLayerPluginStore) Delete(pluginID string, key string) error { 4451 start := timemodule.Now() 4452 4453 err := s.PluginStore.Delete(pluginID, key) 4454 4455 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4456 if s.Root.Metrics != nil { 4457 success := "false" 4458 if err == nil { 4459 success = "true" 4460 } 4461 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.Delete", success, elapsed) 4462 } 4463 return err 4464 } 4465 4466 func (s *TimerLayerPluginStore) DeleteAllExpired() error { 4467 start := timemodule.Now() 4468 4469 err := s.PluginStore.DeleteAllExpired() 4470 4471 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4472 if s.Root.Metrics != nil { 4473 success := "false" 4474 if err == nil { 4475 success = "true" 4476 } 4477 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.DeleteAllExpired", success, elapsed) 4478 } 4479 return err 4480 } 4481 4482 func (s *TimerLayerPluginStore) DeleteAllForPlugin(PluginID string) error { 4483 start := timemodule.Now() 4484 4485 err := s.PluginStore.DeleteAllForPlugin(PluginID) 4486 4487 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4488 if s.Root.Metrics != nil { 4489 success := "false" 4490 if err == nil { 4491 success = "true" 4492 } 4493 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.DeleteAllForPlugin", success, elapsed) 4494 } 4495 return err 4496 } 4497 4498 func (s *TimerLayerPluginStore) Get(pluginID string, key string) (*model.PluginKeyValue, error) { 4499 start := timemodule.Now() 4500 4501 result, err := s.PluginStore.Get(pluginID, key) 4502 4503 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4504 if s.Root.Metrics != nil { 4505 success := "false" 4506 if err == nil { 4507 success = "true" 4508 } 4509 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.Get", success, elapsed) 4510 } 4511 return result, err 4512 } 4513 4514 func (s *TimerLayerPluginStore) List(pluginID string, page int, perPage int) ([]string, error) { 4515 start := timemodule.Now() 4516 4517 result, err := s.PluginStore.List(pluginID, page, perPage) 4518 4519 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4520 if s.Root.Metrics != nil { 4521 success := "false" 4522 if err == nil { 4523 success = "true" 4524 } 4525 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.List", success, elapsed) 4526 } 4527 return result, err 4528 } 4529 4530 func (s *TimerLayerPluginStore) SaveOrUpdate(keyVal *model.PluginKeyValue) (*model.PluginKeyValue, error) { 4531 start := timemodule.Now() 4532 4533 result, err := s.PluginStore.SaveOrUpdate(keyVal) 4534 4535 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4536 if s.Root.Metrics != nil { 4537 success := "false" 4538 if err == nil { 4539 success = "true" 4540 } 4541 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.SaveOrUpdate", success, elapsed) 4542 } 4543 return result, err 4544 } 4545 4546 func (s *TimerLayerPluginStore) SetWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, error) { 4547 start := timemodule.Now() 4548 4549 result, err := s.PluginStore.SetWithOptions(pluginID, key, value, options) 4550 4551 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4552 if s.Root.Metrics != nil { 4553 success := "false" 4554 if err == nil { 4555 success = "true" 4556 } 4557 s.Root.Metrics.ObserveStoreMethodDuration("PluginStore.SetWithOptions", success, elapsed) 4558 } 4559 return result, err 4560 } 4561 4562 func (s *TimerLayerPostStore) AnalyticsPostCount(teamID string, mustHaveFile bool, mustHaveHashtag bool) (int64, error) { 4563 start := timemodule.Now() 4564 4565 result, err := s.PostStore.AnalyticsPostCount(teamID, mustHaveFile, mustHaveHashtag) 4566 4567 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4568 if s.Root.Metrics != nil { 4569 success := "false" 4570 if err == nil { 4571 success = "true" 4572 } 4573 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.AnalyticsPostCount", success, elapsed) 4574 } 4575 return result, err 4576 } 4577 4578 func (s *TimerLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) { 4579 start := timemodule.Now() 4580 4581 result, err := s.PostStore.AnalyticsPostCountsByDay(options) 4582 4583 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4584 if s.Root.Metrics != nil { 4585 success := "false" 4586 if err == nil { 4587 success = "true" 4588 } 4589 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.AnalyticsPostCountsByDay", success, elapsed) 4590 } 4591 return result, err 4592 } 4593 4594 func (s *TimerLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamID string) (model.AnalyticsRows, error) { 4595 start := timemodule.Now() 4596 4597 result, err := s.PostStore.AnalyticsUserCountsWithPostsByDay(teamID) 4598 4599 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4600 if s.Root.Metrics != nil { 4601 success := "false" 4602 if err == nil { 4603 success = "true" 4604 } 4605 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.AnalyticsUserCountsWithPostsByDay", success, elapsed) 4606 } 4607 return result, err 4608 } 4609 4610 func (s *TimerLayerPostStore) ClearCaches() { 4611 start := timemodule.Now() 4612 4613 s.PostStore.ClearCaches() 4614 4615 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4616 if s.Root.Metrics != nil { 4617 success := "false" 4618 if true { 4619 success = "true" 4620 } 4621 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.ClearCaches", success, elapsed) 4622 } 4623 } 4624 4625 func (s *TimerLayerPostStore) Delete(postID string, time int64, deleteByID string) error { 4626 start := timemodule.Now() 4627 4628 err := s.PostStore.Delete(postID, time, deleteByID) 4629 4630 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4631 if s.Root.Metrics != nil { 4632 success := "false" 4633 if err == nil { 4634 success = "true" 4635 } 4636 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.Delete", success, elapsed) 4637 } 4638 return err 4639 } 4640 4641 func (s *TimerLayerPostStore) DeleteOrphanedRows(limit int) (int64, error) { 4642 start := timemodule.Now() 4643 4644 result, err := s.PostStore.DeleteOrphanedRows(limit) 4645 4646 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4647 if s.Root.Metrics != nil { 4648 success := "false" 4649 if err == nil { 4650 success = "true" 4651 } 4652 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.DeleteOrphanedRows", success, elapsed) 4653 } 4654 return result, err 4655 } 4656 4657 func (s *TimerLayerPostStore) Get(ctx context.Context, id string, skipFetchThreads bool, collapsedThreads bool, collapsedThreadsExtended bool, userID string) (*model.PostList, error) { 4658 start := timemodule.Now() 4659 4660 result, err := s.PostStore.Get(ctx, id, skipFetchThreads, collapsedThreads, collapsedThreadsExtended, userID) 4661 4662 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4663 if s.Root.Metrics != nil { 4664 success := "false" 4665 if err == nil { 4666 success = "true" 4667 } 4668 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.Get", success, elapsed) 4669 } 4670 return result, err 4671 } 4672 4673 func (s *TimerLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterID string) ([]*model.DirectPostForExport, error) { 4674 start := timemodule.Now() 4675 4676 result, err := s.PostStore.GetDirectPostParentsForExportAfter(limit, afterID) 4677 4678 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4679 if s.Root.Metrics != nil { 4680 success := "false" 4681 if err == nil { 4682 success = "true" 4683 } 4684 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetDirectPostParentsForExportAfter", success, elapsed) 4685 } 4686 return result, err 4687 } 4688 4689 func (s *TimerLayerPostStore) GetEtag(channelID string, allowFromCache bool, collapsedThreads bool) string { 4690 start := timemodule.Now() 4691 4692 result := s.PostStore.GetEtag(channelID, allowFromCache, collapsedThreads) 4693 4694 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4695 if s.Root.Metrics != nil { 4696 success := "false" 4697 if true { 4698 success = "true" 4699 } 4700 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetEtag", success, elapsed) 4701 } 4702 return result 4703 } 4704 4705 func (s *TimerLayerPostStore) GetFlaggedPosts(userID string, offset int, limit int) (*model.PostList, error) { 4706 start := timemodule.Now() 4707 4708 result, err := s.PostStore.GetFlaggedPosts(userID, offset, limit) 4709 4710 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4711 if s.Root.Metrics != nil { 4712 success := "false" 4713 if err == nil { 4714 success = "true" 4715 } 4716 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetFlaggedPosts", success, elapsed) 4717 } 4718 return result, err 4719 } 4720 4721 func (s *TimerLayerPostStore) GetFlaggedPostsForChannel(userID string, channelID string, offset int, limit int) (*model.PostList, error) { 4722 start := timemodule.Now() 4723 4724 result, err := s.PostStore.GetFlaggedPostsForChannel(userID, channelID, offset, limit) 4725 4726 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4727 if s.Root.Metrics != nil { 4728 success := "false" 4729 if err == nil { 4730 success = "true" 4731 } 4732 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetFlaggedPostsForChannel", success, elapsed) 4733 } 4734 return result, err 4735 } 4736 4737 func (s *TimerLayerPostStore) GetFlaggedPostsForTeam(userID string, teamID string, offset int, limit int) (*model.PostList, error) { 4738 start := timemodule.Now() 4739 4740 result, err := s.PostStore.GetFlaggedPostsForTeam(userID, teamID, offset, limit) 4741 4742 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4743 if s.Root.Metrics != nil { 4744 success := "false" 4745 if err == nil { 4746 success = "true" 4747 } 4748 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetFlaggedPostsForTeam", success, elapsed) 4749 } 4750 return result, err 4751 } 4752 4753 func (s *TimerLayerPostStore) GetMaxPostSize() int { 4754 start := timemodule.Now() 4755 4756 result := s.PostStore.GetMaxPostSize() 4757 4758 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4759 if s.Root.Metrics != nil { 4760 success := "false" 4761 if true { 4762 success = "true" 4763 } 4764 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetMaxPostSize", success, elapsed) 4765 } 4766 return result 4767 } 4768 4769 func (s *TimerLayerPostStore) GetOldest() (*model.Post, error) { 4770 start := timemodule.Now() 4771 4772 result, err := s.PostStore.GetOldest() 4773 4774 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4775 if s.Root.Metrics != nil { 4776 success := "false" 4777 if err == nil { 4778 success = "true" 4779 } 4780 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetOldest", success, elapsed) 4781 } 4782 return result, err 4783 } 4784 4785 func (s *TimerLayerPostStore) GetOldestEntityCreationTime() (int64, error) { 4786 start := timemodule.Now() 4787 4788 result, err := s.PostStore.GetOldestEntityCreationTime() 4789 4790 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4791 if s.Root.Metrics != nil { 4792 success := "false" 4793 if err == nil { 4794 success = "true" 4795 } 4796 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetOldestEntityCreationTime", success, elapsed) 4797 } 4798 return result, err 4799 } 4800 4801 func (s *TimerLayerPostStore) GetParentsForExportAfter(limit int, afterID string) ([]*model.PostForExport, error) { 4802 start := timemodule.Now() 4803 4804 result, err := s.PostStore.GetParentsForExportAfter(limit, afterID) 4805 4806 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4807 if s.Root.Metrics != nil { 4808 success := "false" 4809 if err == nil { 4810 success = "true" 4811 } 4812 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetParentsForExportAfter", success, elapsed) 4813 } 4814 return result, err 4815 } 4816 4817 func (s *TimerLayerPostStore) GetPostAfterTime(channelID string, time int64, collapsedThreads bool) (*model.Post, error) { 4818 start := timemodule.Now() 4819 4820 result, err := s.PostStore.GetPostAfterTime(channelID, time, collapsedThreads) 4821 4822 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4823 if s.Root.Metrics != nil { 4824 success := "false" 4825 if err == nil { 4826 success = "true" 4827 } 4828 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostAfterTime", success, elapsed) 4829 } 4830 return result, err 4831 } 4832 4833 func (s *TimerLayerPostStore) GetPostIdAfterTime(channelID string, time int64, collapsedThreads bool) (string, error) { 4834 start := timemodule.Now() 4835 4836 result, err := s.PostStore.GetPostIdAfterTime(channelID, time, collapsedThreads) 4837 4838 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4839 if s.Root.Metrics != nil { 4840 success := "false" 4841 if err == nil { 4842 success = "true" 4843 } 4844 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostIdAfterTime", success, elapsed) 4845 } 4846 return result, err 4847 } 4848 4849 func (s *TimerLayerPostStore) GetPostIdBeforeTime(channelID string, time int64, collapsedThreads bool) (string, error) { 4850 start := timemodule.Now() 4851 4852 result, err := s.PostStore.GetPostIdBeforeTime(channelID, time, collapsedThreads) 4853 4854 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4855 if s.Root.Metrics != nil { 4856 success := "false" 4857 if err == nil { 4858 success = "true" 4859 } 4860 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostIdBeforeTime", success, elapsed) 4861 } 4862 return result, err 4863 } 4864 4865 func (s *TimerLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool) (*model.PostList, error) { 4866 start := timemodule.Now() 4867 4868 result, err := s.PostStore.GetPosts(options, allowFromCache) 4869 4870 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4871 if s.Root.Metrics != nil { 4872 success := "false" 4873 if err == nil { 4874 success = "true" 4875 } 4876 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPosts", success, elapsed) 4877 } 4878 return result, err 4879 } 4880 4881 func (s *TimerLayerPostStore) GetPostsAfter(options model.GetPostsOptions) (*model.PostList, error) { 4882 start := timemodule.Now() 4883 4884 result, err := s.PostStore.GetPostsAfter(options) 4885 4886 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4887 if s.Root.Metrics != nil { 4888 success := "false" 4889 if err == nil { 4890 success = "true" 4891 } 4892 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsAfter", success, elapsed) 4893 } 4894 return result, err 4895 } 4896 4897 func (s *TimerLayerPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error) { 4898 start := timemodule.Now() 4899 4900 result, err := s.PostStore.GetPostsBatchForIndexing(startTime, endTime, limit) 4901 4902 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4903 if s.Root.Metrics != nil { 4904 success := "false" 4905 if err == nil { 4906 success = "true" 4907 } 4908 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsBatchForIndexing", success, elapsed) 4909 } 4910 return result, err 4911 } 4912 4913 func (s *TimerLayerPostStore) GetPostsBefore(options model.GetPostsOptions) (*model.PostList, error) { 4914 start := timemodule.Now() 4915 4916 result, err := s.PostStore.GetPostsBefore(options) 4917 4918 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4919 if s.Root.Metrics != nil { 4920 success := "false" 4921 if err == nil { 4922 success = "true" 4923 } 4924 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsBefore", success, elapsed) 4925 } 4926 return result, err 4927 } 4928 4929 func (s *TimerLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) { 4930 start := timemodule.Now() 4931 4932 result, err := s.PostStore.GetPostsByIds(postIds) 4933 4934 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4935 if s.Root.Metrics != nil { 4936 success := "false" 4937 if err == nil { 4938 success = "true" 4939 } 4940 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsByIds", success, elapsed) 4941 } 4942 return result, err 4943 } 4944 4945 func (s *TimerLayerPostStore) GetPostsCreatedAt(channelID string, time int64) ([]*model.Post, error) { 4946 start := timemodule.Now() 4947 4948 result, err := s.PostStore.GetPostsCreatedAt(channelID, time) 4949 4950 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4951 if s.Root.Metrics != nil { 4952 success := "false" 4953 if err == nil { 4954 success = "true" 4955 } 4956 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsCreatedAt", success, elapsed) 4957 } 4958 return result, err 4959 } 4960 4961 func (s *TimerLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFromCache bool) (*model.PostList, error) { 4962 start := timemodule.Now() 4963 4964 result, err := s.PostStore.GetPostsSince(options, allowFromCache) 4965 4966 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4967 if s.Root.Metrics != nil { 4968 success := "false" 4969 if err == nil { 4970 success = "true" 4971 } 4972 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsSince", success, elapsed) 4973 } 4974 return result, err 4975 } 4976 4977 func (s *TimerLayerPostStore) GetPostsSinceForSync(options model.GetPostsSinceForSyncOptions, cursor model.GetPostsSinceForSyncCursor, limit int) ([]*model.Post, model.GetPostsSinceForSyncCursor, error) { 4978 start := timemodule.Now() 4979 4980 result, resultVar1, err := s.PostStore.GetPostsSinceForSync(options, cursor, limit) 4981 4982 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4983 if s.Root.Metrics != nil { 4984 success := "false" 4985 if err == nil { 4986 success = "true" 4987 } 4988 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetPostsSinceForSync", success, elapsed) 4989 } 4990 return result, resultVar1, err 4991 } 4992 4993 func (s *TimerLayerPostStore) GetRepliesForExport(parentID string) ([]*model.ReplyForExport, error) { 4994 start := timemodule.Now() 4995 4996 result, err := s.PostStore.GetRepliesForExport(parentID) 4997 4998 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 4999 if s.Root.Metrics != nil { 5000 success := "false" 5001 if err == nil { 5002 success = "true" 5003 } 5004 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetRepliesForExport", success, elapsed) 5005 } 5006 return result, err 5007 } 5008 5009 func (s *TimerLayerPostStore) GetSingle(id string, inclDeleted bool) (*model.Post, error) { 5010 start := timemodule.Now() 5011 5012 result, err := s.PostStore.GetSingle(id, inclDeleted) 5013 5014 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5015 if s.Root.Metrics != nil { 5016 success := "false" 5017 if err == nil { 5018 success = "true" 5019 } 5020 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.GetSingle", success, elapsed) 5021 } 5022 return result, err 5023 } 5024 5025 func (s *TimerLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { 5026 start := timemodule.Now() 5027 5028 result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId) 5029 5030 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5031 if s.Root.Metrics != nil { 5032 success := "false" 5033 if err == nil { 5034 success = "true" 5035 } 5036 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.HasAutoResponsePostByUserSince", success, elapsed) 5037 } 5038 return result, err 5039 } 5040 5041 func (s *TimerLayerPostStore) InvalidateLastPostTimeCache(channelID string) { 5042 start := timemodule.Now() 5043 5044 s.PostStore.InvalidateLastPostTimeCache(channelID) 5045 5046 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5047 if s.Root.Metrics != nil { 5048 success := "false" 5049 if true { 5050 success = "true" 5051 } 5052 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.InvalidateLastPostTimeCache", success, elapsed) 5053 } 5054 } 5055 5056 func (s *TimerLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) { 5057 start := timemodule.Now() 5058 5059 result, err := s.PostStore.Overwrite(post) 5060 5061 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5062 if s.Root.Metrics != nil { 5063 success := "false" 5064 if err == nil { 5065 success = "true" 5066 } 5067 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.Overwrite", success, elapsed) 5068 } 5069 return result, err 5070 } 5071 5072 func (s *TimerLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) { 5073 start := timemodule.Now() 5074 5075 result, resultVar1, err := s.PostStore.OverwriteMultiple(posts) 5076 5077 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5078 if s.Root.Metrics != nil { 5079 success := "false" 5080 if err == nil { 5081 success = "true" 5082 } 5083 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.OverwriteMultiple", success, elapsed) 5084 } 5085 return result, resultVar1, err 5086 } 5087 5088 func (s *TimerLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { 5089 start := timemodule.Now() 5090 5091 result, err := s.PostStore.PermanentDeleteBatch(endTime, limit) 5092 5093 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5094 if s.Root.Metrics != nil { 5095 success := "false" 5096 if err == nil { 5097 success = "true" 5098 } 5099 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.PermanentDeleteBatch", success, elapsed) 5100 } 5101 return result, err 5102 } 5103 5104 func (s *TimerLayerPostStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { 5105 start := timemodule.Now() 5106 5107 result, resultVar1, err := s.PostStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) 5108 5109 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5110 if s.Root.Metrics != nil { 5111 success := "false" 5112 if err == nil { 5113 success = "true" 5114 } 5115 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.PermanentDeleteBatchForRetentionPolicies", success, elapsed) 5116 } 5117 return result, resultVar1, err 5118 } 5119 5120 func (s *TimerLayerPostStore) PermanentDeleteByChannel(channelID string) error { 5121 start := timemodule.Now() 5122 5123 err := s.PostStore.PermanentDeleteByChannel(channelID) 5124 5125 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5126 if s.Root.Metrics != nil { 5127 success := "false" 5128 if err == nil { 5129 success = "true" 5130 } 5131 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.PermanentDeleteByChannel", success, elapsed) 5132 } 5133 return err 5134 } 5135 5136 func (s *TimerLayerPostStore) PermanentDeleteByUser(userID string) error { 5137 start := timemodule.Now() 5138 5139 err := s.PostStore.PermanentDeleteByUser(userID) 5140 5141 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5142 if s.Root.Metrics != nil { 5143 success := "false" 5144 if err == nil { 5145 success = "true" 5146 } 5147 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.PermanentDeleteByUser", success, elapsed) 5148 } 5149 return err 5150 } 5151 5152 func (s *TimerLayerPostStore) Save(post *model.Post) (*model.Post, error) { 5153 start := timemodule.Now() 5154 5155 result, err := s.PostStore.Save(post) 5156 5157 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5158 if s.Root.Metrics != nil { 5159 success := "false" 5160 if err == nil { 5161 success = "true" 5162 } 5163 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.Save", success, elapsed) 5164 } 5165 return result, err 5166 } 5167 5168 func (s *TimerLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, error) { 5169 start := timemodule.Now() 5170 5171 result, resultVar1, err := s.PostStore.SaveMultiple(posts) 5172 5173 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5174 if s.Root.Metrics != nil { 5175 success := "false" 5176 if err == nil { 5177 success = "true" 5178 } 5179 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.SaveMultiple", success, elapsed) 5180 } 5181 return result, resultVar1, err 5182 } 5183 5184 func (s *TimerLayerPostStore) Search(teamID string, userID string, params *model.SearchParams) (*model.PostList, error) { 5185 start := timemodule.Now() 5186 5187 result, err := s.PostStore.Search(teamID, userID, params) 5188 5189 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5190 if s.Root.Metrics != nil { 5191 success := "false" 5192 if err == nil { 5193 success = "true" 5194 } 5195 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.Search", success, elapsed) 5196 } 5197 return result, err 5198 } 5199 5200 func (s *TimerLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.PostSearchResults, error) { 5201 start := timemodule.Now() 5202 5203 result, err := s.PostStore.SearchPostsInTeamForUser(paramsList, userID, teamID, page, perPage) 5204 5205 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5206 if s.Root.Metrics != nil { 5207 success := "false" 5208 if err == nil { 5209 success = "true" 5210 } 5211 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.SearchPostsInTeamForUser", success, elapsed) 5212 } 5213 return result, err 5214 } 5215 5216 func (s *TimerLayerPostStore) Update(newPost *model.Post, oldPost *model.Post) (*model.Post, error) { 5217 start := timemodule.Now() 5218 5219 result, err := s.PostStore.Update(newPost, oldPost) 5220 5221 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5222 if s.Root.Metrics != nil { 5223 success := "false" 5224 if err == nil { 5225 success = "true" 5226 } 5227 s.Root.Metrics.ObserveStoreMethodDuration("PostStore.Update", success, elapsed) 5228 } 5229 return result, err 5230 } 5231 5232 func (s *TimerLayerPreferenceStore) CleanupFlagsBatch(limit int64) (int64, error) { 5233 start := timemodule.Now() 5234 5235 result, err := s.PreferenceStore.CleanupFlagsBatch(limit) 5236 5237 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5238 if s.Root.Metrics != nil { 5239 success := "false" 5240 if err == nil { 5241 success = "true" 5242 } 5243 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.CleanupFlagsBatch", success, elapsed) 5244 } 5245 return result, err 5246 } 5247 5248 func (s *TimerLayerPreferenceStore) Delete(userID string, category string, name string) error { 5249 start := timemodule.Now() 5250 5251 err := s.PreferenceStore.Delete(userID, category, name) 5252 5253 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5254 if s.Root.Metrics != nil { 5255 success := "false" 5256 if err == nil { 5257 success = "true" 5258 } 5259 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.Delete", success, elapsed) 5260 } 5261 return err 5262 } 5263 5264 func (s *TimerLayerPreferenceStore) DeleteCategory(userID string, category string) error { 5265 start := timemodule.Now() 5266 5267 err := s.PreferenceStore.DeleteCategory(userID, category) 5268 5269 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5270 if s.Root.Metrics != nil { 5271 success := "false" 5272 if err == nil { 5273 success = "true" 5274 } 5275 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.DeleteCategory", success, elapsed) 5276 } 5277 return err 5278 } 5279 5280 func (s *TimerLayerPreferenceStore) DeleteCategoryAndName(category string, name string) error { 5281 start := timemodule.Now() 5282 5283 err := s.PreferenceStore.DeleteCategoryAndName(category, name) 5284 5285 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5286 if s.Root.Metrics != nil { 5287 success := "false" 5288 if err == nil { 5289 success = "true" 5290 } 5291 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.DeleteCategoryAndName", success, elapsed) 5292 } 5293 return err 5294 } 5295 5296 func (s *TimerLayerPreferenceStore) DeleteOrphanedRows(limit int) (int64, error) { 5297 start := timemodule.Now() 5298 5299 result, err := s.PreferenceStore.DeleteOrphanedRows(limit) 5300 5301 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5302 if s.Root.Metrics != nil { 5303 success := "false" 5304 if err == nil { 5305 success = "true" 5306 } 5307 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.DeleteOrphanedRows", success, elapsed) 5308 } 5309 return result, err 5310 } 5311 5312 func (s *TimerLayerPreferenceStore) Get(userID string, category string, name string) (*model.Preference, error) { 5313 start := timemodule.Now() 5314 5315 result, err := s.PreferenceStore.Get(userID, category, name) 5316 5317 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5318 if s.Root.Metrics != nil { 5319 success := "false" 5320 if err == nil { 5321 success = "true" 5322 } 5323 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.Get", success, elapsed) 5324 } 5325 return result, err 5326 } 5327 5328 func (s *TimerLayerPreferenceStore) GetAll(userID string) (model.Preferences, error) { 5329 start := timemodule.Now() 5330 5331 result, err := s.PreferenceStore.GetAll(userID) 5332 5333 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5334 if s.Root.Metrics != nil { 5335 success := "false" 5336 if err == nil { 5337 success = "true" 5338 } 5339 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.GetAll", success, elapsed) 5340 } 5341 return result, err 5342 } 5343 5344 func (s *TimerLayerPreferenceStore) GetCategory(userID string, category string) (model.Preferences, error) { 5345 start := timemodule.Now() 5346 5347 result, err := s.PreferenceStore.GetCategory(userID, category) 5348 5349 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5350 if s.Root.Metrics != nil { 5351 success := "false" 5352 if err == nil { 5353 success = "true" 5354 } 5355 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.GetCategory", success, elapsed) 5356 } 5357 return result, err 5358 } 5359 5360 func (s *TimerLayerPreferenceStore) PermanentDeleteByUser(userID string) error { 5361 start := timemodule.Now() 5362 5363 err := s.PreferenceStore.PermanentDeleteByUser(userID) 5364 5365 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5366 if s.Root.Metrics != nil { 5367 success := "false" 5368 if err == nil { 5369 success = "true" 5370 } 5371 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.PermanentDeleteByUser", success, elapsed) 5372 } 5373 return err 5374 } 5375 5376 func (s *TimerLayerPreferenceStore) Save(preferences *model.Preferences) error { 5377 start := timemodule.Now() 5378 5379 err := s.PreferenceStore.Save(preferences) 5380 5381 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5382 if s.Root.Metrics != nil { 5383 success := "false" 5384 if err == nil { 5385 success = "true" 5386 } 5387 s.Root.Metrics.ObserveStoreMethodDuration("PreferenceStore.Save", success, elapsed) 5388 } 5389 return err 5390 } 5391 5392 func (s *TimerLayerProductNoticesStore) Clear(notices []string) error { 5393 start := timemodule.Now() 5394 5395 err := s.ProductNoticesStore.Clear(notices) 5396 5397 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5398 if s.Root.Metrics != nil { 5399 success := "false" 5400 if err == nil { 5401 success = "true" 5402 } 5403 s.Root.Metrics.ObserveStoreMethodDuration("ProductNoticesStore.Clear", success, elapsed) 5404 } 5405 return err 5406 } 5407 5408 func (s *TimerLayerProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error { 5409 start := timemodule.Now() 5410 5411 err := s.ProductNoticesStore.ClearOldNotices(currentNotices) 5412 5413 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5414 if s.Root.Metrics != nil { 5415 success := "false" 5416 if err == nil { 5417 success = "true" 5418 } 5419 s.Root.Metrics.ObserveStoreMethodDuration("ProductNoticesStore.ClearOldNotices", success, elapsed) 5420 } 5421 return err 5422 } 5423 5424 func (s *TimerLayerProductNoticesStore) GetViews(userID string) ([]model.ProductNoticeViewState, error) { 5425 start := timemodule.Now() 5426 5427 result, err := s.ProductNoticesStore.GetViews(userID) 5428 5429 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5430 if s.Root.Metrics != nil { 5431 success := "false" 5432 if err == nil { 5433 success = "true" 5434 } 5435 s.Root.Metrics.ObserveStoreMethodDuration("ProductNoticesStore.GetViews", success, elapsed) 5436 } 5437 return result, err 5438 } 5439 5440 func (s *TimerLayerProductNoticesStore) View(userID string, notices []string) error { 5441 start := timemodule.Now() 5442 5443 err := s.ProductNoticesStore.View(userID, notices) 5444 5445 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5446 if s.Root.Metrics != nil { 5447 success := "false" 5448 if err == nil { 5449 success = "true" 5450 } 5451 s.Root.Metrics.ObserveStoreMethodDuration("ProductNoticesStore.View", success, elapsed) 5452 } 5453 return err 5454 } 5455 5456 func (s *TimerLayerReactionStore) BulkGetForPosts(postIds []string) ([]*model.Reaction, error) { 5457 start := timemodule.Now() 5458 5459 result, err := s.ReactionStore.BulkGetForPosts(postIds) 5460 5461 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5462 if s.Root.Metrics != nil { 5463 success := "false" 5464 if err == nil { 5465 success = "true" 5466 } 5467 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.BulkGetForPosts", success, elapsed) 5468 } 5469 return result, err 5470 } 5471 5472 func (s *TimerLayerReactionStore) Delete(reaction *model.Reaction) (*model.Reaction, error) { 5473 start := timemodule.Now() 5474 5475 result, err := s.ReactionStore.Delete(reaction) 5476 5477 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5478 if s.Root.Metrics != nil { 5479 success := "false" 5480 if err == nil { 5481 success = "true" 5482 } 5483 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.Delete", success, elapsed) 5484 } 5485 return result, err 5486 } 5487 5488 func (s *TimerLayerReactionStore) DeleteAllWithEmojiName(emojiName string) error { 5489 start := timemodule.Now() 5490 5491 err := s.ReactionStore.DeleteAllWithEmojiName(emojiName) 5492 5493 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5494 if s.Root.Metrics != nil { 5495 success := "false" 5496 if err == nil { 5497 success = "true" 5498 } 5499 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.DeleteAllWithEmojiName", success, elapsed) 5500 } 5501 return err 5502 } 5503 5504 func (s *TimerLayerReactionStore) DeleteOrphanedRows(limit int) (int64, error) { 5505 start := timemodule.Now() 5506 5507 result, err := s.ReactionStore.DeleteOrphanedRows(limit) 5508 5509 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5510 if s.Root.Metrics != nil { 5511 success := "false" 5512 if err == nil { 5513 success = "true" 5514 } 5515 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.DeleteOrphanedRows", success, elapsed) 5516 } 5517 return result, err 5518 } 5519 5520 func (s *TimerLayerReactionStore) GetForPost(postID string, allowFromCache bool) ([]*model.Reaction, error) { 5521 start := timemodule.Now() 5522 5523 result, err := s.ReactionStore.GetForPost(postID, allowFromCache) 5524 5525 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5526 if s.Root.Metrics != nil { 5527 success := "false" 5528 if err == nil { 5529 success = "true" 5530 } 5531 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.GetForPost", success, elapsed) 5532 } 5533 return result, err 5534 } 5535 5536 func (s *TimerLayerReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { 5537 start := timemodule.Now() 5538 5539 result, err := s.ReactionStore.GetForPostSince(postId, since, excludeRemoteId, inclDeleted) 5540 5541 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5542 if s.Root.Metrics != nil { 5543 success := "false" 5544 if err == nil { 5545 success = "true" 5546 } 5547 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.GetForPostSince", success, elapsed) 5548 } 5549 return result, err 5550 } 5551 5552 func (s *TimerLayerReactionStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { 5553 start := timemodule.Now() 5554 5555 result, err := s.ReactionStore.PermanentDeleteBatch(endTime, limit) 5556 5557 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5558 if s.Root.Metrics != nil { 5559 success := "false" 5560 if err == nil { 5561 success = "true" 5562 } 5563 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.PermanentDeleteBatch", success, elapsed) 5564 } 5565 return result, err 5566 } 5567 5568 func (s *TimerLayerReactionStore) Save(reaction *model.Reaction) (*model.Reaction, error) { 5569 start := timemodule.Now() 5570 5571 result, err := s.ReactionStore.Save(reaction) 5572 5573 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5574 if s.Root.Metrics != nil { 5575 success := "false" 5576 if err == nil { 5577 success = "true" 5578 } 5579 s.Root.Metrics.ObserveStoreMethodDuration("ReactionStore.Save", success, elapsed) 5580 } 5581 return result, err 5582 } 5583 5584 func (s *TimerLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, error) { 5585 start := timemodule.Now() 5586 5587 result, err := s.RemoteClusterStore.Delete(remoteClusterId) 5588 5589 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5590 if s.Root.Metrics != nil { 5591 success := "false" 5592 if err == nil { 5593 success = "true" 5594 } 5595 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.Delete", success, elapsed) 5596 } 5597 return result, err 5598 } 5599 5600 func (s *TimerLayerRemoteClusterStore) Get(remoteClusterId string) (*model.RemoteCluster, error) { 5601 start := timemodule.Now() 5602 5603 result, err := s.RemoteClusterStore.Get(remoteClusterId) 5604 5605 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5606 if s.Root.Metrics != nil { 5607 success := "false" 5608 if err == nil { 5609 success = "true" 5610 } 5611 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.Get", success, elapsed) 5612 } 5613 return result, err 5614 } 5615 5616 func (s *TimerLayerRemoteClusterStore) GetAll(filter model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error) { 5617 start := timemodule.Now() 5618 5619 result, err := s.RemoteClusterStore.GetAll(filter) 5620 5621 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5622 if s.Root.Metrics != nil { 5623 success := "false" 5624 if err == nil { 5625 success = "true" 5626 } 5627 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.GetAll", success, elapsed) 5628 } 5629 return result, err 5630 } 5631 5632 func (s *TimerLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*model.RemoteCluster, error) { 5633 start := timemodule.Now() 5634 5635 result, err := s.RemoteClusterStore.Save(rc) 5636 5637 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5638 if s.Root.Metrics != nil { 5639 success := "false" 5640 if err == nil { 5641 success = "true" 5642 } 5643 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.Save", success, elapsed) 5644 } 5645 return result, err 5646 } 5647 5648 func (s *TimerLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) error { 5649 start := timemodule.Now() 5650 5651 err := s.RemoteClusterStore.SetLastPingAt(remoteClusterId) 5652 5653 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5654 if s.Root.Metrics != nil { 5655 success := "false" 5656 if err == nil { 5657 success = "true" 5658 } 5659 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.SetLastPingAt", success, elapsed) 5660 } 5661 return err 5662 } 5663 5664 func (s *TimerLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*model.RemoteCluster, error) { 5665 start := timemodule.Now() 5666 5667 result, err := s.RemoteClusterStore.Update(rc) 5668 5669 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5670 if s.Root.Metrics != nil { 5671 success := "false" 5672 if err == nil { 5673 success = "true" 5674 } 5675 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.Update", success, elapsed) 5676 } 5677 return result, err 5678 } 5679 5680 func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { 5681 start := timemodule.Now() 5682 5683 result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterId, topics) 5684 5685 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5686 if s.Root.Metrics != nil { 5687 success := "false" 5688 if err == nil { 5689 success = "true" 5690 } 5691 s.Root.Metrics.ObserveStoreMethodDuration("RemoteClusterStore.UpdateTopics", success, elapsed) 5692 } 5693 return result, err 5694 } 5695 5696 func (s *TimerLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { 5697 start := timemodule.Now() 5698 5699 err := s.RetentionPolicyStore.AddChannels(policyId, channelIds) 5700 5701 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5702 if s.Root.Metrics != nil { 5703 success := "false" 5704 if err == nil { 5705 success = "true" 5706 } 5707 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.AddChannels", success, elapsed) 5708 } 5709 return err 5710 } 5711 5712 func (s *TimerLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { 5713 start := timemodule.Now() 5714 5715 err := s.RetentionPolicyStore.AddTeams(policyId, teamIds) 5716 5717 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5718 if s.Root.Metrics != nil { 5719 success := "false" 5720 if err == nil { 5721 success = "true" 5722 } 5723 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.AddTeams", success, elapsed) 5724 } 5725 return err 5726 } 5727 5728 func (s *TimerLayerRetentionPolicyStore) Delete(id string) error { 5729 start := timemodule.Now() 5730 5731 err := s.RetentionPolicyStore.Delete(id) 5732 5733 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5734 if s.Root.Metrics != nil { 5735 success := "false" 5736 if err == nil { 5737 success = "true" 5738 } 5739 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Delete", success, elapsed) 5740 } 5741 return err 5742 } 5743 5744 func (s *TimerLayerRetentionPolicyStore) DeleteOrphanedRows(limit int) (int64, error) { 5745 start := timemodule.Now() 5746 5747 result, err := s.RetentionPolicyStore.DeleteOrphanedRows(limit) 5748 5749 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5750 if s.Root.Metrics != nil { 5751 success := "false" 5752 if err == nil { 5753 success = "true" 5754 } 5755 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.DeleteOrphanedRows", success, elapsed) 5756 } 5757 return result, err 5758 } 5759 5760 func (s *TimerLayerRetentionPolicyStore) Get(id string) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { 5761 start := timemodule.Now() 5762 5763 result, err := s.RetentionPolicyStore.Get(id) 5764 5765 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5766 if s.Root.Metrics != nil { 5767 success := "false" 5768 if err == nil { 5769 success = "true" 5770 } 5771 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Get", success, elapsed) 5772 } 5773 return result, err 5774 } 5775 5776 func (s *TimerLayerRetentionPolicyStore) GetAll(offset int, limit int) ([]*model.RetentionPolicyWithTeamAndChannelCounts, error) { 5777 start := timemodule.Now() 5778 5779 result, err := s.RetentionPolicyStore.GetAll(offset, limit) 5780 5781 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5782 if s.Root.Metrics != nil { 5783 success := "false" 5784 if err == nil { 5785 success = "true" 5786 } 5787 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetAll", success, elapsed) 5788 } 5789 return result, err 5790 } 5791 5792 func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesCountForUser(userID string) (int64, error) { 5793 start := timemodule.Now() 5794 5795 result, err := s.RetentionPolicyStore.GetChannelPoliciesCountForUser(userID) 5796 5797 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5798 if s.Root.Metrics != nil { 5799 success := "false" 5800 if err == nil { 5801 success = "true" 5802 } 5803 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannelPoliciesCountForUser", success, elapsed) 5804 } 5805 return result, err 5806 } 5807 5808 func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForChannel, error) { 5809 start := timemodule.Now() 5810 5811 result, err := s.RetentionPolicyStore.GetChannelPoliciesForUser(userID, offset, limit) 5812 5813 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5814 if s.Root.Metrics != nil { 5815 success := "false" 5816 if err == nil { 5817 success = "true" 5818 } 5819 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannelPoliciesForUser", success, elapsed) 5820 } 5821 return result, err 5822 } 5823 5824 func (s *TimerLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { 5825 start := timemodule.Now() 5826 5827 result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit) 5828 5829 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5830 if s.Root.Metrics != nil { 5831 success := "false" 5832 if err == nil { 5833 success = "true" 5834 } 5835 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannels", success, elapsed) 5836 } 5837 return result, err 5838 } 5839 5840 func (s *TimerLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { 5841 start := timemodule.Now() 5842 5843 result, err := s.RetentionPolicyStore.GetChannelsCount(policyId) 5844 5845 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5846 if s.Root.Metrics != nil { 5847 success := "false" 5848 if err == nil { 5849 success = "true" 5850 } 5851 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannelsCount", success, elapsed) 5852 } 5853 return result, err 5854 } 5855 5856 func (s *TimerLayerRetentionPolicyStore) GetCount() (int64, error) { 5857 start := timemodule.Now() 5858 5859 result, err := s.RetentionPolicyStore.GetCount() 5860 5861 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5862 if s.Root.Metrics != nil { 5863 success := "false" 5864 if err == nil { 5865 success = "true" 5866 } 5867 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetCount", success, elapsed) 5868 } 5869 return result, err 5870 } 5871 5872 func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesCountForUser(userID string) (int64, error) { 5873 start := timemodule.Now() 5874 5875 result, err := s.RetentionPolicyStore.GetTeamPoliciesCountForUser(userID) 5876 5877 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5878 if s.Root.Metrics != nil { 5879 success := "false" 5880 if err == nil { 5881 success = "true" 5882 } 5883 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeamPoliciesCountForUser", success, elapsed) 5884 } 5885 return result, err 5886 } 5887 5888 func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForTeam, error) { 5889 start := timemodule.Now() 5890 5891 result, err := s.RetentionPolicyStore.GetTeamPoliciesForUser(userID, offset, limit) 5892 5893 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5894 if s.Root.Metrics != nil { 5895 success := "false" 5896 if err == nil { 5897 success = "true" 5898 } 5899 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeamPoliciesForUser", success, elapsed) 5900 } 5901 return result, err 5902 } 5903 5904 func (s *TimerLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { 5905 start := timemodule.Now() 5906 5907 result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit) 5908 5909 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5910 if s.Root.Metrics != nil { 5911 success := "false" 5912 if err == nil { 5913 success = "true" 5914 } 5915 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeams", success, elapsed) 5916 } 5917 return result, err 5918 } 5919 5920 func (s *TimerLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { 5921 start := timemodule.Now() 5922 5923 result, err := s.RetentionPolicyStore.GetTeamsCount(policyId) 5924 5925 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5926 if s.Root.Metrics != nil { 5927 success := "false" 5928 if err == nil { 5929 success = "true" 5930 } 5931 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeamsCount", success, elapsed) 5932 } 5933 return result, err 5934 } 5935 5936 func (s *TimerLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { 5937 start := timemodule.Now() 5938 5939 result, err := s.RetentionPolicyStore.Patch(patch) 5940 5941 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5942 if s.Root.Metrics != nil { 5943 success := "false" 5944 if err == nil { 5945 success = "true" 5946 } 5947 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Patch", success, elapsed) 5948 } 5949 return result, err 5950 } 5951 5952 func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { 5953 start := timemodule.Now() 5954 5955 err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds) 5956 5957 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5958 if s.Root.Metrics != nil { 5959 success := "false" 5960 if err == nil { 5961 success = "true" 5962 } 5963 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.RemoveChannels", success, elapsed) 5964 } 5965 return err 5966 } 5967 5968 func (s *TimerLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { 5969 start := timemodule.Now() 5970 5971 err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds) 5972 5973 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5974 if s.Root.Metrics != nil { 5975 success := "false" 5976 if err == nil { 5977 success = "true" 5978 } 5979 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.RemoveTeams", success, elapsed) 5980 } 5981 return err 5982 } 5983 5984 func (s *TimerLayerRetentionPolicyStore) Save(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { 5985 start := timemodule.Now() 5986 5987 result, err := s.RetentionPolicyStore.Save(policy) 5988 5989 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 5990 if s.Root.Metrics != nil { 5991 success := "false" 5992 if err == nil { 5993 success = "true" 5994 } 5995 s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Save", success, elapsed) 5996 } 5997 return result, err 5998 } 5999 6000 func (s *TimerLayerRoleStore) AllChannelSchemeRoles() ([]*model.Role, error) { 6001 start := timemodule.Now() 6002 6003 result, err := s.RoleStore.AllChannelSchemeRoles() 6004 6005 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6006 if s.Root.Metrics != nil { 6007 success := "false" 6008 if err == nil { 6009 success = "true" 6010 } 6011 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.AllChannelSchemeRoles", success, elapsed) 6012 } 6013 return result, err 6014 } 6015 6016 func (s *TimerLayerRoleStore) ChannelHigherScopedPermissions(roleNames []string) (map[string]*model.RolePermissions, error) { 6017 start := timemodule.Now() 6018 6019 result, err := s.RoleStore.ChannelHigherScopedPermissions(roleNames) 6020 6021 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6022 if s.Root.Metrics != nil { 6023 success := "false" 6024 if err == nil { 6025 success = "true" 6026 } 6027 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.ChannelHigherScopedPermissions", success, elapsed) 6028 } 6029 return result, err 6030 } 6031 6032 func (s *TimerLayerRoleStore) ChannelRolesUnderTeamRole(roleName string) ([]*model.Role, error) { 6033 start := timemodule.Now() 6034 6035 result, err := s.RoleStore.ChannelRolesUnderTeamRole(roleName) 6036 6037 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6038 if s.Root.Metrics != nil { 6039 success := "false" 6040 if err == nil { 6041 success = "true" 6042 } 6043 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.ChannelRolesUnderTeamRole", success, elapsed) 6044 } 6045 return result, err 6046 } 6047 6048 func (s *TimerLayerRoleStore) Delete(roleID string) (*model.Role, error) { 6049 start := timemodule.Now() 6050 6051 result, err := s.RoleStore.Delete(roleID) 6052 6053 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6054 if s.Root.Metrics != nil { 6055 success := "false" 6056 if err == nil { 6057 success = "true" 6058 } 6059 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.Delete", success, elapsed) 6060 } 6061 return result, err 6062 } 6063 6064 func (s *TimerLayerRoleStore) Get(roleID string) (*model.Role, error) { 6065 start := timemodule.Now() 6066 6067 result, err := s.RoleStore.Get(roleID) 6068 6069 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6070 if s.Root.Metrics != nil { 6071 success := "false" 6072 if err == nil { 6073 success = "true" 6074 } 6075 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.Get", success, elapsed) 6076 } 6077 return result, err 6078 } 6079 6080 func (s *TimerLayerRoleStore) GetAll() ([]*model.Role, error) { 6081 start := timemodule.Now() 6082 6083 result, err := s.RoleStore.GetAll() 6084 6085 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6086 if s.Root.Metrics != nil { 6087 success := "false" 6088 if err == nil { 6089 success = "true" 6090 } 6091 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.GetAll", success, elapsed) 6092 } 6093 return result, err 6094 } 6095 6096 func (s *TimerLayerRoleStore) GetByName(ctx context.Context, name string) (*model.Role, error) { 6097 start := timemodule.Now() 6098 6099 result, err := s.RoleStore.GetByName(ctx, name) 6100 6101 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6102 if s.Root.Metrics != nil { 6103 success := "false" 6104 if err == nil { 6105 success = "true" 6106 } 6107 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.GetByName", success, elapsed) 6108 } 6109 return result, err 6110 } 6111 6112 func (s *TimerLayerRoleStore) GetByNames(names []string) ([]*model.Role, error) { 6113 start := timemodule.Now() 6114 6115 result, err := s.RoleStore.GetByNames(names) 6116 6117 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6118 if s.Root.Metrics != nil { 6119 success := "false" 6120 if err == nil { 6121 success = "true" 6122 } 6123 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.GetByNames", success, elapsed) 6124 } 6125 return result, err 6126 } 6127 6128 func (s *TimerLayerRoleStore) PermanentDeleteAll() error { 6129 start := timemodule.Now() 6130 6131 err := s.RoleStore.PermanentDeleteAll() 6132 6133 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6134 if s.Root.Metrics != nil { 6135 success := "false" 6136 if err == nil { 6137 success = "true" 6138 } 6139 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.PermanentDeleteAll", success, elapsed) 6140 } 6141 return err 6142 } 6143 6144 func (s *TimerLayerRoleStore) Save(role *model.Role) (*model.Role, error) { 6145 start := timemodule.Now() 6146 6147 result, err := s.RoleStore.Save(role) 6148 6149 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6150 if s.Root.Metrics != nil { 6151 success := "false" 6152 if err == nil { 6153 success = "true" 6154 } 6155 s.Root.Metrics.ObserveStoreMethodDuration("RoleStore.Save", success, elapsed) 6156 } 6157 return result, err 6158 } 6159 6160 func (s *TimerLayerSchemeStore) CountByScope(scope string) (int64, error) { 6161 start := timemodule.Now() 6162 6163 result, err := s.SchemeStore.CountByScope(scope) 6164 6165 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6166 if s.Root.Metrics != nil { 6167 success := "false" 6168 if err == nil { 6169 success = "true" 6170 } 6171 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.CountByScope", success, elapsed) 6172 } 6173 return result, err 6174 } 6175 6176 func (s *TimerLayerSchemeStore) CountWithoutPermission(scope string, permissionID string, roleScope model.RoleScope, roleType model.RoleType) (int64, error) { 6177 start := timemodule.Now() 6178 6179 result, err := s.SchemeStore.CountWithoutPermission(scope, permissionID, roleScope, roleType) 6180 6181 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6182 if s.Root.Metrics != nil { 6183 success := "false" 6184 if err == nil { 6185 success = "true" 6186 } 6187 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.CountWithoutPermission", success, elapsed) 6188 } 6189 return result, err 6190 } 6191 6192 func (s *TimerLayerSchemeStore) Delete(schemeID string) (*model.Scheme, error) { 6193 start := timemodule.Now() 6194 6195 result, err := s.SchemeStore.Delete(schemeID) 6196 6197 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6198 if s.Root.Metrics != nil { 6199 success := "false" 6200 if err == nil { 6201 success = "true" 6202 } 6203 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.Delete", success, elapsed) 6204 } 6205 return result, err 6206 } 6207 6208 func (s *TimerLayerSchemeStore) Get(schemeID string) (*model.Scheme, error) { 6209 start := timemodule.Now() 6210 6211 result, err := s.SchemeStore.Get(schemeID) 6212 6213 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6214 if s.Root.Metrics != nil { 6215 success := "false" 6216 if err == nil { 6217 success = "true" 6218 } 6219 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.Get", success, elapsed) 6220 } 6221 return result, err 6222 } 6223 6224 func (s *TimerLayerSchemeStore) GetAllPage(scope string, offset int, limit int) ([]*model.Scheme, error) { 6225 start := timemodule.Now() 6226 6227 result, err := s.SchemeStore.GetAllPage(scope, offset, limit) 6228 6229 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6230 if s.Root.Metrics != nil { 6231 success := "false" 6232 if err == nil { 6233 success = "true" 6234 } 6235 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.GetAllPage", success, elapsed) 6236 } 6237 return result, err 6238 } 6239 6240 func (s *TimerLayerSchemeStore) GetByName(schemeName string) (*model.Scheme, error) { 6241 start := timemodule.Now() 6242 6243 result, err := s.SchemeStore.GetByName(schemeName) 6244 6245 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6246 if s.Root.Metrics != nil { 6247 success := "false" 6248 if err == nil { 6249 success = "true" 6250 } 6251 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.GetByName", success, elapsed) 6252 } 6253 return result, err 6254 } 6255 6256 func (s *TimerLayerSchemeStore) PermanentDeleteAll() error { 6257 start := timemodule.Now() 6258 6259 err := s.SchemeStore.PermanentDeleteAll() 6260 6261 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6262 if s.Root.Metrics != nil { 6263 success := "false" 6264 if err == nil { 6265 success = "true" 6266 } 6267 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.PermanentDeleteAll", success, elapsed) 6268 } 6269 return err 6270 } 6271 6272 func (s *TimerLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error) { 6273 start := timemodule.Now() 6274 6275 result, err := s.SchemeStore.Save(scheme) 6276 6277 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6278 if s.Root.Metrics != nil { 6279 success := "false" 6280 if err == nil { 6281 success = "true" 6282 } 6283 s.Root.Metrics.ObserveStoreMethodDuration("SchemeStore.Save", success, elapsed) 6284 } 6285 return result, err 6286 } 6287 6288 func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, error) { 6289 start := timemodule.Now() 6290 6291 result, err := s.SessionStore.AnalyticsSessionCount() 6292 6293 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6294 if s.Root.Metrics != nil { 6295 success := "false" 6296 if err == nil { 6297 success = "true" 6298 } 6299 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.AnalyticsSessionCount", success, elapsed) 6300 } 6301 return result, err 6302 } 6303 6304 func (s *TimerLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) { 6305 start := timemodule.Now() 6306 6307 s.SessionStore.Cleanup(expiryTime, batchSize) 6308 6309 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6310 if s.Root.Metrics != nil { 6311 success := "false" 6312 if true { 6313 success = "true" 6314 } 6315 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.Cleanup", success, elapsed) 6316 } 6317 } 6318 6319 func (s *TimerLayerSessionStore) Get(ctx context.Context, sessionIDOrToken string) (*model.Session, error) { 6320 start := timemodule.Now() 6321 6322 result, err := s.SessionStore.Get(ctx, sessionIDOrToken) 6323 6324 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6325 if s.Root.Metrics != nil { 6326 success := "false" 6327 if err == nil { 6328 success = "true" 6329 } 6330 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.Get", success, elapsed) 6331 } 6332 return result, err 6333 } 6334 6335 func (s *TimerLayerSessionStore) GetSessions(userID string) ([]*model.Session, error) { 6336 start := timemodule.Now() 6337 6338 result, err := s.SessionStore.GetSessions(userID) 6339 6340 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6341 if s.Root.Metrics != nil { 6342 success := "false" 6343 if err == nil { 6344 success = "true" 6345 } 6346 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.GetSessions", success, elapsed) 6347 } 6348 return result, err 6349 } 6350 6351 func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) { 6352 start := timemodule.Now() 6353 6354 result, err := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly) 6355 6356 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6357 if s.Root.Metrics != nil { 6358 success := "false" 6359 if err == nil { 6360 success = "true" 6361 } 6362 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.GetSessionsExpired", success, elapsed) 6363 } 6364 return result, err 6365 } 6366 6367 func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userID string) ([]*model.Session, error) { 6368 start := timemodule.Now() 6369 6370 result, err := s.SessionStore.GetSessionsWithActiveDeviceIds(userID) 6371 6372 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6373 if s.Root.Metrics != nil { 6374 success := "false" 6375 if err == nil { 6376 success = "true" 6377 } 6378 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.GetSessionsWithActiveDeviceIds", success, elapsed) 6379 } 6380 return result, err 6381 } 6382 6383 func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamID string) error { 6384 start := timemodule.Now() 6385 6386 err := s.SessionStore.PermanentDeleteSessionsByUser(teamID) 6387 6388 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6389 if s.Root.Metrics != nil { 6390 success := "false" 6391 if err == nil { 6392 success = "true" 6393 } 6394 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.PermanentDeleteSessionsByUser", success, elapsed) 6395 } 6396 return err 6397 } 6398 6399 func (s *TimerLayerSessionStore) Remove(sessionIDOrToken string) error { 6400 start := timemodule.Now() 6401 6402 err := s.SessionStore.Remove(sessionIDOrToken) 6403 6404 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6405 if s.Root.Metrics != nil { 6406 success := "false" 6407 if err == nil { 6408 success = "true" 6409 } 6410 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.Remove", success, elapsed) 6411 } 6412 return err 6413 } 6414 6415 func (s *TimerLayerSessionStore) RemoveAllSessions() error { 6416 start := timemodule.Now() 6417 6418 err := s.SessionStore.RemoveAllSessions() 6419 6420 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6421 if s.Root.Metrics != nil { 6422 success := "false" 6423 if err == nil { 6424 success = "true" 6425 } 6426 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.RemoveAllSessions", success, elapsed) 6427 } 6428 return err 6429 } 6430 6431 func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, error) { 6432 start := timemodule.Now() 6433 6434 result, err := s.SessionStore.Save(session) 6435 6436 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6437 if s.Root.Metrics != nil { 6438 success := "false" 6439 if err == nil { 6440 success = "true" 6441 } 6442 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.Save", success, elapsed) 6443 } 6444 return result, err 6445 } 6446 6447 func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceID string, expiresAt int64) (string, error) { 6448 start := timemodule.Now() 6449 6450 result, err := s.SessionStore.UpdateDeviceId(id, deviceID, expiresAt) 6451 6452 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6453 if s.Root.Metrics != nil { 6454 success := "false" 6455 if err == nil { 6456 success = "true" 6457 } 6458 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateDeviceId", success, elapsed) 6459 } 6460 return result, err 6461 } 6462 6463 func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) error { 6464 start := timemodule.Now() 6465 6466 err := s.SessionStore.UpdateExpiredNotify(sessionid, notified) 6467 6468 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6469 if s.Root.Metrics != nil { 6470 success := "false" 6471 if err == nil { 6472 success = "true" 6473 } 6474 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateExpiredNotify", success, elapsed) 6475 } 6476 return err 6477 } 6478 6479 func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionID string, time int64) error { 6480 start := timemodule.Now() 6481 6482 err := s.SessionStore.UpdateExpiresAt(sessionID, time) 6483 6484 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6485 if s.Root.Metrics != nil { 6486 success := "false" 6487 if err == nil { 6488 success = "true" 6489 } 6490 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateExpiresAt", success, elapsed) 6491 } 6492 return err 6493 } 6494 6495 func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionID string, time int64) error { 6496 start := timemodule.Now() 6497 6498 err := s.SessionStore.UpdateLastActivityAt(sessionID, time) 6499 6500 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6501 if s.Root.Metrics != nil { 6502 success := "false" 6503 if err == nil { 6504 success = "true" 6505 } 6506 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateLastActivityAt", success, elapsed) 6507 } 6508 return err 6509 } 6510 6511 func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) error { 6512 start := timemodule.Now() 6513 6514 err := s.SessionStore.UpdateProps(session) 6515 6516 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6517 if s.Root.Metrics != nil { 6518 success := "false" 6519 if err == nil { 6520 success = "true" 6521 } 6522 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateProps", success, elapsed) 6523 } 6524 return err 6525 } 6526 6527 func (s *TimerLayerSessionStore) UpdateRoles(userID string, roles string) (string, error) { 6528 start := timemodule.Now() 6529 6530 result, err := s.SessionStore.UpdateRoles(userID, roles) 6531 6532 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6533 if s.Root.Metrics != nil { 6534 success := "false" 6535 if err == nil { 6536 success = "true" 6537 } 6538 s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateRoles", success, elapsed) 6539 } 6540 return result, err 6541 } 6542 6543 func (s *TimerLayerSharedChannelStore) Delete(channelId string) (bool, error) { 6544 start := timemodule.Now() 6545 6546 result, err := s.SharedChannelStore.Delete(channelId) 6547 6548 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6549 if s.Root.Metrics != nil { 6550 success := "false" 6551 if err == nil { 6552 success = "true" 6553 } 6554 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.Delete", success, elapsed) 6555 } 6556 return result, err 6557 } 6558 6559 func (s *TimerLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, error) { 6560 start := timemodule.Now() 6561 6562 result, err := s.SharedChannelStore.DeleteRemote(remoteId) 6563 6564 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6565 if s.Root.Metrics != nil { 6566 success := "false" 6567 if err == nil { 6568 success = "true" 6569 } 6570 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.DeleteRemote", success, elapsed) 6571 } 6572 return result, err 6573 } 6574 6575 func (s *TimerLayerSharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { 6576 start := timemodule.Now() 6577 6578 result, err := s.SharedChannelStore.Get(channelId) 6579 6580 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6581 if s.Root.Metrics != nil { 6582 success := "false" 6583 if err == nil { 6584 success = "true" 6585 } 6586 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.Get", success, elapsed) 6587 } 6588 return result, err 6589 } 6590 6591 func (s *TimerLayerSharedChannelStore) GetAll(offset int, limit int, opts model.SharedChannelFilterOpts) ([]*model.SharedChannel, error) { 6592 start := timemodule.Now() 6593 6594 result, err := s.SharedChannelStore.GetAll(offset, limit, opts) 6595 6596 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6597 if s.Root.Metrics != nil { 6598 success := "false" 6599 if err == nil { 6600 success = "true" 6601 } 6602 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetAll", success, elapsed) 6603 } 6604 return result, err 6605 } 6606 6607 func (s *TimerLayerSharedChannelStore) GetAllCount(opts model.SharedChannelFilterOpts) (int64, error) { 6608 start := timemodule.Now() 6609 6610 result, err := s.SharedChannelStore.GetAllCount(opts) 6611 6612 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6613 if s.Root.Metrics != nil { 6614 success := "false" 6615 if err == nil { 6616 success = "true" 6617 } 6618 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetAllCount", success, elapsed) 6619 } 6620 return result, err 6621 } 6622 6623 func (s *TimerLayerSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { 6624 start := timemodule.Now() 6625 6626 result, err := s.SharedChannelStore.GetAttachment(fileId, remoteId) 6627 6628 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6629 if s.Root.Metrics != nil { 6630 success := "false" 6631 if err == nil { 6632 success = "true" 6633 } 6634 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetAttachment", success, elapsed) 6635 } 6636 return result, err 6637 } 6638 6639 func (s *TimerLayerSharedChannelStore) GetRemote(id string) (*model.SharedChannelRemote, error) { 6640 start := timemodule.Now() 6641 6642 result, err := s.SharedChannelStore.GetRemote(id) 6643 6644 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6645 if s.Root.Metrics != nil { 6646 success := "false" 6647 if err == nil { 6648 success = "true" 6649 } 6650 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetRemote", success, elapsed) 6651 } 6652 return result, err 6653 } 6654 6655 func (s *TimerLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { 6656 start := timemodule.Now() 6657 6658 result, err := s.SharedChannelStore.GetRemoteByIds(channelId, remoteId) 6659 6660 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6661 if s.Root.Metrics != nil { 6662 success := "false" 6663 if err == nil { 6664 success = "true" 6665 } 6666 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetRemoteByIds", success, elapsed) 6667 } 6668 return result, err 6669 } 6670 6671 func (s *TimerLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { 6672 start := timemodule.Now() 6673 6674 result, err := s.SharedChannelStore.GetRemoteForUser(remoteId, userId) 6675 6676 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6677 if s.Root.Metrics != nil { 6678 success := "false" 6679 if err == nil { 6680 success = "true" 6681 } 6682 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetRemoteForUser", success, elapsed) 6683 } 6684 return result, err 6685 } 6686 6687 func (s *TimerLayerSharedChannelStore) GetRemotes(opts model.SharedChannelRemoteFilterOpts) ([]*model.SharedChannelRemote, error) { 6688 start := timemodule.Now() 6689 6690 result, err := s.SharedChannelStore.GetRemotes(opts) 6691 6692 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6693 if s.Root.Metrics != nil { 6694 success := "false" 6695 if err == nil { 6696 success = "true" 6697 } 6698 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetRemotes", success, elapsed) 6699 } 6700 return result, err 6701 } 6702 6703 func (s *TimerLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { 6704 start := timemodule.Now() 6705 6706 result, err := s.SharedChannelStore.GetRemotesStatus(channelId) 6707 6708 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6709 if s.Root.Metrics != nil { 6710 success := "false" 6711 if err == nil { 6712 success = "true" 6713 } 6714 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetRemotesStatus", success, elapsed) 6715 } 6716 return result, err 6717 } 6718 6719 func (s *TimerLayerSharedChannelStore) GetSingleUser(userID string, channelID string, remoteID string) (*model.SharedChannelUser, error) { 6720 start := timemodule.Now() 6721 6722 result, err := s.SharedChannelStore.GetSingleUser(userID, channelID, remoteID) 6723 6724 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6725 if s.Root.Metrics != nil { 6726 success := "false" 6727 if err == nil { 6728 success = "true" 6729 } 6730 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetSingleUser", success, elapsed) 6731 } 6732 return result, err 6733 } 6734 6735 func (s *TimerLayerSharedChannelStore) GetUsersForSync(filter model.GetUsersForSyncFilter) ([]*model.User, error) { 6736 start := timemodule.Now() 6737 6738 result, err := s.SharedChannelStore.GetUsersForSync(filter) 6739 6740 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6741 if s.Root.Metrics != nil { 6742 success := "false" 6743 if err == nil { 6744 success = "true" 6745 } 6746 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetUsersForSync", success, elapsed) 6747 } 6748 return result, err 6749 } 6750 6751 func (s *TimerLayerSharedChannelStore) GetUsersForUser(userID string) ([]*model.SharedChannelUser, error) { 6752 start := timemodule.Now() 6753 6754 result, err := s.SharedChannelStore.GetUsersForUser(userID) 6755 6756 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6757 if s.Root.Metrics != nil { 6758 success := "false" 6759 if err == nil { 6760 success = "true" 6761 } 6762 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.GetUsersForUser", success, elapsed) 6763 } 6764 return result, err 6765 } 6766 6767 func (s *TimerLayerSharedChannelStore) HasChannel(channelID string) (bool, error) { 6768 start := timemodule.Now() 6769 6770 result, err := s.SharedChannelStore.HasChannel(channelID) 6771 6772 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6773 if s.Root.Metrics != nil { 6774 success := "false" 6775 if err == nil { 6776 success = "true" 6777 } 6778 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.HasChannel", success, elapsed) 6779 } 6780 return result, err 6781 } 6782 6783 func (s *TimerLayerSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { 6784 start := timemodule.Now() 6785 6786 result, err := s.SharedChannelStore.HasRemote(channelID, remoteId) 6787 6788 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6789 if s.Root.Metrics != nil { 6790 success := "false" 6791 if err == nil { 6792 success = "true" 6793 } 6794 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.HasRemote", success, elapsed) 6795 } 6796 return result, err 6797 } 6798 6799 func (s *TimerLayerSharedChannelStore) Save(sc *model.SharedChannel) (*model.SharedChannel, error) { 6800 start := timemodule.Now() 6801 6802 result, err := s.SharedChannelStore.Save(sc) 6803 6804 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6805 if s.Root.Metrics != nil { 6806 success := "false" 6807 if err == nil { 6808 success = "true" 6809 } 6810 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.Save", success, elapsed) 6811 } 6812 return result, err 6813 } 6814 6815 func (s *TimerLayerSharedChannelStore) SaveAttachment(remote *model.SharedChannelAttachment) (*model.SharedChannelAttachment, error) { 6816 start := timemodule.Now() 6817 6818 result, err := s.SharedChannelStore.SaveAttachment(remote) 6819 6820 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6821 if s.Root.Metrics != nil { 6822 success := "false" 6823 if err == nil { 6824 success = "true" 6825 } 6826 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.SaveAttachment", success, elapsed) 6827 } 6828 return result, err 6829 } 6830 6831 func (s *TimerLayerSharedChannelStore) SaveRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) { 6832 start := timemodule.Now() 6833 6834 result, err := s.SharedChannelStore.SaveRemote(remote) 6835 6836 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6837 if s.Root.Metrics != nil { 6838 success := "false" 6839 if err == nil { 6840 success = "true" 6841 } 6842 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.SaveRemote", success, elapsed) 6843 } 6844 return result, err 6845 } 6846 6847 func (s *TimerLayerSharedChannelStore) SaveUser(remote *model.SharedChannelUser) (*model.SharedChannelUser, error) { 6848 start := timemodule.Now() 6849 6850 result, err := s.SharedChannelStore.SaveUser(remote) 6851 6852 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6853 if s.Root.Metrics != nil { 6854 success := "false" 6855 if err == nil { 6856 success = "true" 6857 } 6858 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.SaveUser", success, elapsed) 6859 } 6860 return result, err 6861 } 6862 6863 func (s *TimerLayerSharedChannelStore) Update(sc *model.SharedChannel) (*model.SharedChannel, error) { 6864 start := timemodule.Now() 6865 6866 result, err := s.SharedChannelStore.Update(sc) 6867 6868 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6869 if s.Root.Metrics != nil { 6870 success := "false" 6871 if err == nil { 6872 success = "true" 6873 } 6874 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.Update", success, elapsed) 6875 } 6876 return result, err 6877 } 6878 6879 func (s *TimerLayerSharedChannelStore) UpdateAttachmentLastSyncAt(id string, syncTime int64) error { 6880 start := timemodule.Now() 6881 6882 err := s.SharedChannelStore.UpdateAttachmentLastSyncAt(id, syncTime) 6883 6884 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6885 if s.Root.Metrics != nil { 6886 success := "false" 6887 if err == nil { 6888 success = "true" 6889 } 6890 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.UpdateAttachmentLastSyncAt", success, elapsed) 6891 } 6892 return err 6893 } 6894 6895 func (s *TimerLayerSharedChannelStore) UpdateRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) { 6896 start := timemodule.Now() 6897 6898 result, err := s.SharedChannelStore.UpdateRemote(remote) 6899 6900 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6901 if s.Root.Metrics != nil { 6902 success := "false" 6903 if err == nil { 6904 success = "true" 6905 } 6906 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.UpdateRemote", success, elapsed) 6907 } 6908 return result, err 6909 } 6910 6911 func (s *TimerLayerSharedChannelStore) UpdateRemoteCursor(id string, cursor model.GetPostsSinceForSyncCursor) error { 6912 start := timemodule.Now() 6913 6914 err := s.SharedChannelStore.UpdateRemoteCursor(id, cursor) 6915 6916 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6917 if s.Root.Metrics != nil { 6918 success := "false" 6919 if err == nil { 6920 success = "true" 6921 } 6922 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.UpdateRemoteCursor", success, elapsed) 6923 } 6924 return err 6925 } 6926 6927 func (s *TimerLayerSharedChannelStore) UpdateUserLastSyncAt(userID string, channelID string, remoteID string) error { 6928 start := timemodule.Now() 6929 6930 err := s.SharedChannelStore.UpdateUserLastSyncAt(userID, channelID, remoteID) 6931 6932 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6933 if s.Root.Metrics != nil { 6934 success := "false" 6935 if err == nil { 6936 success = "true" 6937 } 6938 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.UpdateUserLastSyncAt", success, elapsed) 6939 } 6940 return err 6941 } 6942 6943 func (s *TimerLayerSharedChannelStore) UpsertAttachment(remote *model.SharedChannelAttachment) (string, error) { 6944 start := timemodule.Now() 6945 6946 result, err := s.SharedChannelStore.UpsertAttachment(remote) 6947 6948 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6949 if s.Root.Metrics != nil { 6950 success := "false" 6951 if err == nil { 6952 success = "true" 6953 } 6954 s.Root.Metrics.ObserveStoreMethodDuration("SharedChannelStore.UpsertAttachment", success, elapsed) 6955 } 6956 return result, err 6957 } 6958 6959 func (s *TimerLayerStatusStore) Get(userID string) (*model.Status, error) { 6960 start := timemodule.Now() 6961 6962 result, err := s.StatusStore.Get(userID) 6963 6964 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6965 if s.Root.Metrics != nil { 6966 success := "false" 6967 if err == nil { 6968 success = "true" 6969 } 6970 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.Get", success, elapsed) 6971 } 6972 return result, err 6973 } 6974 6975 func (s *TimerLayerStatusStore) GetByIds(userIds []string) ([]*model.Status, error) { 6976 start := timemodule.Now() 6977 6978 result, err := s.StatusStore.GetByIds(userIds) 6979 6980 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6981 if s.Root.Metrics != nil { 6982 success := "false" 6983 if err == nil { 6984 success = "true" 6985 } 6986 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.GetByIds", success, elapsed) 6987 } 6988 return result, err 6989 } 6990 6991 func (s *TimerLayerStatusStore) GetTotalActiveUsersCount() (int64, error) { 6992 start := timemodule.Now() 6993 6994 result, err := s.StatusStore.GetTotalActiveUsersCount() 6995 6996 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 6997 if s.Root.Metrics != nil { 6998 success := "false" 6999 if err == nil { 7000 success = "true" 7001 } 7002 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.GetTotalActiveUsersCount", success, elapsed) 7003 } 7004 return result, err 7005 } 7006 7007 func (s *TimerLayerStatusStore) ResetAll() error { 7008 start := timemodule.Now() 7009 7010 err := s.StatusStore.ResetAll() 7011 7012 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7013 if s.Root.Metrics != nil { 7014 success := "false" 7015 if err == nil { 7016 success = "true" 7017 } 7018 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.ResetAll", success, elapsed) 7019 } 7020 return err 7021 } 7022 7023 func (s *TimerLayerStatusStore) SaveOrUpdate(status *model.Status) error { 7024 start := timemodule.Now() 7025 7026 err := s.StatusStore.SaveOrUpdate(status) 7027 7028 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7029 if s.Root.Metrics != nil { 7030 success := "false" 7031 if err == nil { 7032 success = "true" 7033 } 7034 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.SaveOrUpdate", success, elapsed) 7035 } 7036 return err 7037 } 7038 7039 func (s *TimerLayerStatusStore) UpdateExpiredDNDStatuses() ([]*model.Status, error) { 7040 start := timemodule.Now() 7041 7042 result, err := s.StatusStore.UpdateExpiredDNDStatuses() 7043 7044 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7045 if s.Root.Metrics != nil { 7046 success := "false" 7047 if err == nil { 7048 success = "true" 7049 } 7050 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.UpdateExpiredDNDStatuses", success, elapsed) 7051 } 7052 return result, err 7053 } 7054 7055 func (s *TimerLayerStatusStore) UpdateLastActivityAt(userID string, lastActivityAt int64) error { 7056 start := timemodule.Now() 7057 7058 err := s.StatusStore.UpdateLastActivityAt(userID, lastActivityAt) 7059 7060 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7061 if s.Root.Metrics != nil { 7062 success := "false" 7063 if err == nil { 7064 success = "true" 7065 } 7066 s.Root.Metrics.ObserveStoreMethodDuration("StatusStore.UpdateLastActivityAt", success, elapsed) 7067 } 7068 return err 7069 } 7070 7071 func (s *TimerLayerSystemStore) Get() (model.StringMap, error) { 7072 start := timemodule.Now() 7073 7074 result, err := s.SystemStore.Get() 7075 7076 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7077 if s.Root.Metrics != nil { 7078 success := "false" 7079 if err == nil { 7080 success = "true" 7081 } 7082 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.Get", success, elapsed) 7083 } 7084 return result, err 7085 } 7086 7087 func (s *TimerLayerSystemStore) GetByName(name string) (*model.System, error) { 7088 start := timemodule.Now() 7089 7090 result, err := s.SystemStore.GetByName(name) 7091 7092 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7093 if s.Root.Metrics != nil { 7094 success := "false" 7095 if err == nil { 7096 success = "true" 7097 } 7098 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.GetByName", success, elapsed) 7099 } 7100 return result, err 7101 } 7102 7103 func (s *TimerLayerSystemStore) InsertIfExists(system *model.System) (*model.System, error) { 7104 start := timemodule.Now() 7105 7106 result, err := s.SystemStore.InsertIfExists(system) 7107 7108 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7109 if s.Root.Metrics != nil { 7110 success := "false" 7111 if err == nil { 7112 success = "true" 7113 } 7114 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.InsertIfExists", success, elapsed) 7115 } 7116 return result, err 7117 } 7118 7119 func (s *TimerLayerSystemStore) PermanentDeleteByName(name string) (*model.System, error) { 7120 start := timemodule.Now() 7121 7122 result, err := s.SystemStore.PermanentDeleteByName(name) 7123 7124 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7125 if s.Root.Metrics != nil { 7126 success := "false" 7127 if err == nil { 7128 success = "true" 7129 } 7130 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.PermanentDeleteByName", success, elapsed) 7131 } 7132 return result, err 7133 } 7134 7135 func (s *TimerLayerSystemStore) Save(system *model.System) error { 7136 start := timemodule.Now() 7137 7138 err := s.SystemStore.Save(system) 7139 7140 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7141 if s.Root.Metrics != nil { 7142 success := "false" 7143 if err == nil { 7144 success = "true" 7145 } 7146 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.Save", success, elapsed) 7147 } 7148 return err 7149 } 7150 7151 func (s *TimerLayerSystemStore) SaveOrUpdate(system *model.System) error { 7152 start := timemodule.Now() 7153 7154 err := s.SystemStore.SaveOrUpdate(system) 7155 7156 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7157 if s.Root.Metrics != nil { 7158 success := "false" 7159 if err == nil { 7160 success = "true" 7161 } 7162 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.SaveOrUpdate", success, elapsed) 7163 } 7164 return err 7165 } 7166 7167 func (s *TimerLayerSystemStore) SaveOrUpdateWithWarnMetricHandling(system *model.System) error { 7168 start := timemodule.Now() 7169 7170 err := s.SystemStore.SaveOrUpdateWithWarnMetricHandling(system) 7171 7172 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7173 if s.Root.Metrics != nil { 7174 success := "false" 7175 if err == nil { 7176 success = "true" 7177 } 7178 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.SaveOrUpdateWithWarnMetricHandling", success, elapsed) 7179 } 7180 return err 7181 } 7182 7183 func (s *TimerLayerSystemStore) Update(system *model.System) error { 7184 start := timemodule.Now() 7185 7186 err := s.SystemStore.Update(system) 7187 7188 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7189 if s.Root.Metrics != nil { 7190 success := "false" 7191 if err == nil { 7192 success = "true" 7193 } 7194 s.Root.Metrics.ObserveStoreMethodDuration("SystemStore.Update", success, elapsed) 7195 } 7196 return err 7197 } 7198 7199 func (s *TimerLayerTeamStore) AnalyticsGetTeamCountForScheme(schemeID string) (int64, error) { 7200 start := timemodule.Now() 7201 7202 result, err := s.TeamStore.AnalyticsGetTeamCountForScheme(schemeID) 7203 7204 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7205 if s.Root.Metrics != nil { 7206 success := "false" 7207 if err == nil { 7208 success = "true" 7209 } 7210 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.AnalyticsGetTeamCountForScheme", success, elapsed) 7211 } 7212 return result, err 7213 } 7214 7215 func (s *TimerLayerTeamStore) AnalyticsTeamCount(opts *model.TeamSearch) (int64, error) { 7216 start := timemodule.Now() 7217 7218 result, err := s.TeamStore.AnalyticsTeamCount(opts) 7219 7220 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7221 if s.Root.Metrics != nil { 7222 success := "false" 7223 if err == nil { 7224 success = "true" 7225 } 7226 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.AnalyticsTeamCount", success, elapsed) 7227 } 7228 return result, err 7229 } 7230 7231 func (s *TimerLayerTeamStore) ClearAllCustomRoleAssignments() error { 7232 start := timemodule.Now() 7233 7234 err := s.TeamStore.ClearAllCustomRoleAssignments() 7235 7236 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7237 if s.Root.Metrics != nil { 7238 success := "false" 7239 if err == nil { 7240 success = "true" 7241 } 7242 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.ClearAllCustomRoleAssignments", success, elapsed) 7243 } 7244 return err 7245 } 7246 7247 func (s *TimerLayerTeamStore) ClearCaches() { 7248 start := timemodule.Now() 7249 7250 s.TeamStore.ClearCaches() 7251 7252 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7253 if s.Root.Metrics != nil { 7254 success := "false" 7255 if true { 7256 success = "true" 7257 } 7258 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.ClearCaches", success, elapsed) 7259 } 7260 } 7261 7262 func (s *TimerLayerTeamStore) Get(id string) (*model.Team, error) { 7263 start := timemodule.Now() 7264 7265 result, err := s.TeamStore.Get(id) 7266 7267 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7268 if s.Root.Metrics != nil { 7269 success := "false" 7270 if err == nil { 7271 success = "true" 7272 } 7273 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.Get", success, elapsed) 7274 } 7275 return result, err 7276 } 7277 7278 func (s *TimerLayerTeamStore) GetActiveMemberCount(teamID string, restrictions *model.ViewUsersRestrictions) (int64, error) { 7279 start := timemodule.Now() 7280 7281 result, err := s.TeamStore.GetActiveMemberCount(teamID, restrictions) 7282 7283 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7284 if s.Root.Metrics != nil { 7285 success := "false" 7286 if err == nil { 7287 success = "true" 7288 } 7289 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetActiveMemberCount", success, elapsed) 7290 } 7291 return result, err 7292 } 7293 7294 func (s *TimerLayerTeamStore) GetAll() ([]*model.Team, error) { 7295 start := timemodule.Now() 7296 7297 result, err := s.TeamStore.GetAll() 7298 7299 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7300 if s.Root.Metrics != nil { 7301 success := "false" 7302 if err == nil { 7303 success = "true" 7304 } 7305 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAll", success, elapsed) 7306 } 7307 return result, err 7308 } 7309 7310 func (s *TimerLayerTeamStore) GetAllForExportAfter(limit int, afterID string) ([]*model.TeamForExport, error) { 7311 start := timemodule.Now() 7312 7313 result, err := s.TeamStore.GetAllForExportAfter(limit, afterID) 7314 7315 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7316 if s.Root.Metrics != nil { 7317 success := "false" 7318 if err == nil { 7319 success = "true" 7320 } 7321 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllForExportAfter", success, elapsed) 7322 } 7323 return result, err 7324 } 7325 7326 func (s *TimerLayerTeamStore) GetAllPage(offset int, limit int, opts *model.TeamSearch) ([]*model.Team, error) { 7327 start := timemodule.Now() 7328 7329 result, err := s.TeamStore.GetAllPage(offset, limit, opts) 7330 7331 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7332 if s.Root.Metrics != nil { 7333 success := "false" 7334 if err == nil { 7335 success = "true" 7336 } 7337 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllPage", success, elapsed) 7338 } 7339 return result, err 7340 } 7341 7342 func (s *TimerLayerTeamStore) GetAllPrivateTeamListing() ([]*model.Team, error) { 7343 start := timemodule.Now() 7344 7345 result, err := s.TeamStore.GetAllPrivateTeamListing() 7346 7347 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7348 if s.Root.Metrics != nil { 7349 success := "false" 7350 if err == nil { 7351 success = "true" 7352 } 7353 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllPrivateTeamListing", success, elapsed) 7354 } 7355 return result, err 7356 } 7357 7358 func (s *TimerLayerTeamStore) GetAllTeamListing() ([]*model.Team, error) { 7359 start := timemodule.Now() 7360 7361 result, err := s.TeamStore.GetAllTeamListing() 7362 7363 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7364 if s.Root.Metrics != nil { 7365 success := "false" 7366 if err == nil { 7367 success = "true" 7368 } 7369 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllTeamListing", success, elapsed) 7370 } 7371 return result, err 7372 } 7373 7374 func (s *TimerLayerTeamStore) GetByInviteId(inviteID string) (*model.Team, error) { 7375 start := timemodule.Now() 7376 7377 result, err := s.TeamStore.GetByInviteId(inviteID) 7378 7379 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7380 if s.Root.Metrics != nil { 7381 success := "false" 7382 if err == nil { 7383 success = "true" 7384 } 7385 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetByInviteId", success, elapsed) 7386 } 7387 return result, err 7388 } 7389 7390 func (s *TimerLayerTeamStore) GetByName(name string) (*model.Team, error) { 7391 start := timemodule.Now() 7392 7393 result, err := s.TeamStore.GetByName(name) 7394 7395 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7396 if s.Root.Metrics != nil { 7397 success := "false" 7398 if err == nil { 7399 success = "true" 7400 } 7401 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetByName", success, elapsed) 7402 } 7403 return result, err 7404 } 7405 7406 func (s *TimerLayerTeamStore) GetByNames(name []string) ([]*model.Team, error) { 7407 start := timemodule.Now() 7408 7409 result, err := s.TeamStore.GetByNames(name) 7410 7411 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7412 if s.Root.Metrics != nil { 7413 success := "false" 7414 if err == nil { 7415 success = "true" 7416 } 7417 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetByNames", success, elapsed) 7418 } 7419 return result, err 7420 } 7421 7422 func (s *TimerLayerTeamStore) GetChannelUnreadsForAllTeams(excludeTeamID string, userID string) ([]*model.ChannelUnread, error) { 7423 start := timemodule.Now() 7424 7425 result, err := s.TeamStore.GetChannelUnreadsForAllTeams(excludeTeamID, userID) 7426 7427 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7428 if s.Root.Metrics != nil { 7429 success := "false" 7430 if err == nil { 7431 success = "true" 7432 } 7433 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetChannelUnreadsForAllTeams", success, elapsed) 7434 } 7435 return result, err 7436 } 7437 7438 func (s *TimerLayerTeamStore) GetChannelUnreadsForTeam(teamID string, userID string) ([]*model.ChannelUnread, error) { 7439 start := timemodule.Now() 7440 7441 result, err := s.TeamStore.GetChannelUnreadsForTeam(teamID, userID) 7442 7443 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7444 if s.Root.Metrics != nil { 7445 success := "false" 7446 if err == nil { 7447 success = "true" 7448 } 7449 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetChannelUnreadsForTeam", success, elapsed) 7450 } 7451 return result, err 7452 } 7453 7454 func (s *TimerLayerTeamStore) GetCommonTeamIDsForTwoUsers(userID string, otherUserID string) ([]string, error) { 7455 start := timemodule.Now() 7456 7457 result, err := s.TeamStore.GetCommonTeamIDsForTwoUsers(userID, otherUserID) 7458 7459 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7460 if s.Root.Metrics != nil { 7461 success := "false" 7462 if err == nil { 7463 success = "true" 7464 } 7465 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetCommonTeamIDsForTwoUsers", success, elapsed) 7466 } 7467 return result, err 7468 } 7469 7470 func (s *TimerLayerTeamStore) GetMember(ctx context.Context, teamID string, userID string) (*model.TeamMember, error) { 7471 start := timemodule.Now() 7472 7473 result, err := s.TeamStore.GetMember(ctx, teamID, userID) 7474 7475 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7476 if s.Root.Metrics != nil { 7477 success := "false" 7478 if err == nil { 7479 success = "true" 7480 } 7481 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetMember", success, elapsed) 7482 } 7483 return result, err 7484 } 7485 7486 func (s *TimerLayerTeamStore) GetMembers(teamID string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, error) { 7487 start := timemodule.Now() 7488 7489 result, err := s.TeamStore.GetMembers(teamID, offset, limit, teamMembersGetOptions) 7490 7491 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7492 if s.Root.Metrics != nil { 7493 success := "false" 7494 if err == nil { 7495 success = "true" 7496 } 7497 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetMembers", success, elapsed) 7498 } 7499 return result, err 7500 } 7501 7502 func (s *TimerLayerTeamStore) GetMembersByIds(teamID string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, error) { 7503 start := timemodule.Now() 7504 7505 result, err := s.TeamStore.GetMembersByIds(teamID, userIds, restrictions) 7506 7507 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7508 if s.Root.Metrics != nil { 7509 success := "false" 7510 if err == nil { 7511 success = "true" 7512 } 7513 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetMembersByIds", success, elapsed) 7514 } 7515 return result, err 7516 } 7517 7518 func (s *TimerLayerTeamStore) GetTeamMembersForExport(userID string) ([]*model.TeamMemberForExport, error) { 7519 start := timemodule.Now() 7520 7521 result, err := s.TeamStore.GetTeamMembersForExport(userID) 7522 7523 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7524 if s.Root.Metrics != nil { 7525 success := "false" 7526 if err == nil { 7527 success = "true" 7528 } 7529 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetTeamMembersForExport", success, elapsed) 7530 } 7531 return result, err 7532 } 7533 7534 func (s *TimerLayerTeamStore) GetTeamsByScheme(schemeID string, offset int, limit int) ([]*model.Team, error) { 7535 start := timemodule.Now() 7536 7537 result, err := s.TeamStore.GetTeamsByScheme(schemeID, offset, limit) 7538 7539 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7540 if s.Root.Metrics != nil { 7541 success := "false" 7542 if err == nil { 7543 success = "true" 7544 } 7545 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetTeamsByScheme", success, elapsed) 7546 } 7547 return result, err 7548 } 7549 7550 func (s *TimerLayerTeamStore) GetTeamsByUserId(userID string) ([]*model.Team, error) { 7551 start := timemodule.Now() 7552 7553 result, err := s.TeamStore.GetTeamsByUserId(userID) 7554 7555 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7556 if s.Root.Metrics != nil { 7557 success := "false" 7558 if err == nil { 7559 success = "true" 7560 } 7561 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetTeamsByUserId", success, elapsed) 7562 } 7563 return result, err 7564 } 7565 7566 func (s *TimerLayerTeamStore) GetTeamsForUser(ctx context.Context, userID string) ([]*model.TeamMember, error) { 7567 start := timemodule.Now() 7568 7569 result, err := s.TeamStore.GetTeamsForUser(ctx, userID) 7570 7571 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7572 if s.Root.Metrics != nil { 7573 success := "false" 7574 if err == nil { 7575 success = "true" 7576 } 7577 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetTeamsForUser", success, elapsed) 7578 } 7579 return result, err 7580 } 7581 7582 func (s *TimerLayerTeamStore) GetTeamsForUserWithPagination(userID string, page int, perPage int) ([]*model.TeamMember, error) { 7583 start := timemodule.Now() 7584 7585 result, err := s.TeamStore.GetTeamsForUserWithPagination(userID, page, perPage) 7586 7587 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7588 if s.Root.Metrics != nil { 7589 success := "false" 7590 if err == nil { 7591 success = "true" 7592 } 7593 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetTeamsForUserWithPagination", success, elapsed) 7594 } 7595 return result, err 7596 } 7597 7598 func (s *TimerLayerTeamStore) GetTotalMemberCount(teamID string, restrictions *model.ViewUsersRestrictions) (int64, error) { 7599 start := timemodule.Now() 7600 7601 result, err := s.TeamStore.GetTotalMemberCount(teamID, restrictions) 7602 7603 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7604 if s.Root.Metrics != nil { 7605 success := "false" 7606 if err == nil { 7607 success = "true" 7608 } 7609 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetTotalMemberCount", success, elapsed) 7610 } 7611 return result, err 7612 } 7613 7614 func (s *TimerLayerTeamStore) GetUserTeamIds(userID string, allowFromCache bool) ([]string, error) { 7615 start := timemodule.Now() 7616 7617 result, err := s.TeamStore.GetUserTeamIds(userID, allowFromCache) 7618 7619 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7620 if s.Root.Metrics != nil { 7621 success := "false" 7622 if err == nil { 7623 success = "true" 7624 } 7625 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetUserTeamIds", success, elapsed) 7626 } 7627 return result, err 7628 } 7629 7630 func (s *TimerLayerTeamStore) GroupSyncedTeamCount() (int64, error) { 7631 start := timemodule.Now() 7632 7633 result, err := s.TeamStore.GroupSyncedTeamCount() 7634 7635 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7636 if s.Root.Metrics != nil { 7637 success := "false" 7638 if err == nil { 7639 success = "true" 7640 } 7641 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GroupSyncedTeamCount", success, elapsed) 7642 } 7643 return result, err 7644 } 7645 7646 func (s *TimerLayerTeamStore) InvalidateAllTeamIdsForUser(userID string) { 7647 start := timemodule.Now() 7648 7649 s.TeamStore.InvalidateAllTeamIdsForUser(userID) 7650 7651 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7652 if s.Root.Metrics != nil { 7653 success := "false" 7654 if true { 7655 success = "true" 7656 } 7657 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.InvalidateAllTeamIdsForUser", success, elapsed) 7658 } 7659 } 7660 7661 func (s *TimerLayerTeamStore) MigrateTeamMembers(fromTeamID string, fromUserID string) (map[string]string, error) { 7662 start := timemodule.Now() 7663 7664 result, err := s.TeamStore.MigrateTeamMembers(fromTeamID, fromUserID) 7665 7666 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7667 if s.Root.Metrics != nil { 7668 success := "false" 7669 if err == nil { 7670 success = "true" 7671 } 7672 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.MigrateTeamMembers", success, elapsed) 7673 } 7674 return result, err 7675 } 7676 7677 func (s *TimerLayerTeamStore) PermanentDelete(teamID string) error { 7678 start := timemodule.Now() 7679 7680 err := s.TeamStore.PermanentDelete(teamID) 7681 7682 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7683 if s.Root.Metrics != nil { 7684 success := "false" 7685 if err == nil { 7686 success = "true" 7687 } 7688 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.PermanentDelete", success, elapsed) 7689 } 7690 return err 7691 } 7692 7693 func (s *TimerLayerTeamStore) RemoveAllMembersByTeam(teamID string) error { 7694 start := timemodule.Now() 7695 7696 err := s.TeamStore.RemoveAllMembersByTeam(teamID) 7697 7698 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7699 if s.Root.Metrics != nil { 7700 success := "false" 7701 if err == nil { 7702 success = "true" 7703 } 7704 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.RemoveAllMembersByTeam", success, elapsed) 7705 } 7706 return err 7707 } 7708 7709 func (s *TimerLayerTeamStore) RemoveAllMembersByUser(userID string) error { 7710 start := timemodule.Now() 7711 7712 err := s.TeamStore.RemoveAllMembersByUser(userID) 7713 7714 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7715 if s.Root.Metrics != nil { 7716 success := "false" 7717 if err == nil { 7718 success = "true" 7719 } 7720 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.RemoveAllMembersByUser", success, elapsed) 7721 } 7722 return err 7723 } 7724 7725 func (s *TimerLayerTeamStore) RemoveMember(teamID string, userID string) error { 7726 start := timemodule.Now() 7727 7728 err := s.TeamStore.RemoveMember(teamID, userID) 7729 7730 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7731 if s.Root.Metrics != nil { 7732 success := "false" 7733 if err == nil { 7734 success = "true" 7735 } 7736 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.RemoveMember", success, elapsed) 7737 } 7738 return err 7739 } 7740 7741 func (s *TimerLayerTeamStore) RemoveMembers(teamID string, userIds []string) error { 7742 start := timemodule.Now() 7743 7744 err := s.TeamStore.RemoveMembers(teamID, userIds) 7745 7746 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7747 if s.Root.Metrics != nil { 7748 success := "false" 7749 if err == nil { 7750 success = "true" 7751 } 7752 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.RemoveMembers", success, elapsed) 7753 } 7754 return err 7755 } 7756 7757 func (s *TimerLayerTeamStore) ResetAllTeamSchemes() error { 7758 start := timemodule.Now() 7759 7760 err := s.TeamStore.ResetAllTeamSchemes() 7761 7762 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7763 if s.Root.Metrics != nil { 7764 success := "false" 7765 if err == nil { 7766 success = "true" 7767 } 7768 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.ResetAllTeamSchemes", success, elapsed) 7769 } 7770 return err 7771 } 7772 7773 func (s *TimerLayerTeamStore) Save(team *model.Team) (*model.Team, error) { 7774 start := timemodule.Now() 7775 7776 result, err := s.TeamStore.Save(team) 7777 7778 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7779 if s.Root.Metrics != nil { 7780 success := "false" 7781 if err == nil { 7782 success = "true" 7783 } 7784 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.Save", success, elapsed) 7785 } 7786 return result, err 7787 } 7788 7789 func (s *TimerLayerTeamStore) SaveMember(member *model.TeamMember, maxUsersPerTeam int) (*model.TeamMember, error) { 7790 start := timemodule.Now() 7791 7792 result, err := s.TeamStore.SaveMember(member, maxUsersPerTeam) 7793 7794 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7795 if s.Root.Metrics != nil { 7796 success := "false" 7797 if err == nil { 7798 success = "true" 7799 } 7800 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.SaveMember", success, elapsed) 7801 } 7802 return result, err 7803 } 7804 7805 func (s *TimerLayerTeamStore) SaveMultipleMembers(members []*model.TeamMember, maxUsersPerTeam int) ([]*model.TeamMember, error) { 7806 start := timemodule.Now() 7807 7808 result, err := s.TeamStore.SaveMultipleMembers(members, maxUsersPerTeam) 7809 7810 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7811 if s.Root.Metrics != nil { 7812 success := "false" 7813 if err == nil { 7814 success = "true" 7815 } 7816 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.SaveMultipleMembers", success, elapsed) 7817 } 7818 return result, err 7819 } 7820 7821 func (s *TimerLayerTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team, error) { 7822 start := timemodule.Now() 7823 7824 result, err := s.TeamStore.SearchAll(opts) 7825 7826 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7827 if s.Root.Metrics != nil { 7828 success := "false" 7829 if err == nil { 7830 success = "true" 7831 } 7832 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.SearchAll", success, elapsed) 7833 } 7834 return result, err 7835 } 7836 7837 func (s *TimerLayerTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.Team, int64, error) { 7838 start := timemodule.Now() 7839 7840 result, resultVar1, err := s.TeamStore.SearchAllPaged(opts) 7841 7842 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7843 if s.Root.Metrics != nil { 7844 success := "false" 7845 if err == nil { 7846 success = "true" 7847 } 7848 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.SearchAllPaged", success, elapsed) 7849 } 7850 return result, resultVar1, err 7851 } 7852 7853 func (s *TimerLayerTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team, error) { 7854 start := timemodule.Now() 7855 7856 result, err := s.TeamStore.SearchOpen(opts) 7857 7858 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7859 if s.Root.Metrics != nil { 7860 success := "false" 7861 if err == nil { 7862 success = "true" 7863 } 7864 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.SearchOpen", success, elapsed) 7865 } 7866 return result, err 7867 } 7868 7869 func (s *TimerLayerTeamStore) SearchPrivate(opts *model.TeamSearch) ([]*model.Team, error) { 7870 start := timemodule.Now() 7871 7872 result, err := s.TeamStore.SearchPrivate(opts) 7873 7874 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7875 if s.Root.Metrics != nil { 7876 success := "false" 7877 if err == nil { 7878 success = "true" 7879 } 7880 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.SearchPrivate", success, elapsed) 7881 } 7882 return result, err 7883 } 7884 7885 func (s *TimerLayerTeamStore) Update(team *model.Team) (*model.Team, error) { 7886 start := timemodule.Now() 7887 7888 result, err := s.TeamStore.Update(team) 7889 7890 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7891 if s.Root.Metrics != nil { 7892 success := "false" 7893 if err == nil { 7894 success = "true" 7895 } 7896 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.Update", success, elapsed) 7897 } 7898 return result, err 7899 } 7900 7901 func (s *TimerLayerTeamStore) UpdateLastTeamIconUpdate(teamID string, curTime int64) error { 7902 start := timemodule.Now() 7903 7904 err := s.TeamStore.UpdateLastTeamIconUpdate(teamID, curTime) 7905 7906 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7907 if s.Root.Metrics != nil { 7908 success := "false" 7909 if err == nil { 7910 success = "true" 7911 } 7912 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.UpdateLastTeamIconUpdate", success, elapsed) 7913 } 7914 return err 7915 } 7916 7917 func (s *TimerLayerTeamStore) UpdateMember(member *model.TeamMember) (*model.TeamMember, error) { 7918 start := timemodule.Now() 7919 7920 result, err := s.TeamStore.UpdateMember(member) 7921 7922 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7923 if s.Root.Metrics != nil { 7924 success := "false" 7925 if err == nil { 7926 success = "true" 7927 } 7928 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.UpdateMember", success, elapsed) 7929 } 7930 return result, err 7931 } 7932 7933 func (s *TimerLayerTeamStore) UpdateMembersRole(teamID string, userIDs []string) error { 7934 start := timemodule.Now() 7935 7936 err := s.TeamStore.UpdateMembersRole(teamID, userIDs) 7937 7938 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7939 if s.Root.Metrics != nil { 7940 success := "false" 7941 if err == nil { 7942 success = "true" 7943 } 7944 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.UpdateMembersRole", success, elapsed) 7945 } 7946 return err 7947 } 7948 7949 func (s *TimerLayerTeamStore) UpdateMultipleMembers(members []*model.TeamMember) ([]*model.TeamMember, error) { 7950 start := timemodule.Now() 7951 7952 result, err := s.TeamStore.UpdateMultipleMembers(members) 7953 7954 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7955 if s.Root.Metrics != nil { 7956 success := "false" 7957 if err == nil { 7958 success = "true" 7959 } 7960 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.UpdateMultipleMembers", success, elapsed) 7961 } 7962 return result, err 7963 } 7964 7965 func (s *TimerLayerTeamStore) UserBelongsToTeams(userID string, teamIds []string) (bool, error) { 7966 start := timemodule.Now() 7967 7968 result, err := s.TeamStore.UserBelongsToTeams(userID, teamIds) 7969 7970 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7971 if s.Root.Metrics != nil { 7972 success := "false" 7973 if err == nil { 7974 success = "true" 7975 } 7976 s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.UserBelongsToTeams", success, elapsed) 7977 } 7978 return result, err 7979 } 7980 7981 func (s *TimerLayerTermsOfServiceStore) Get(id string, allowFromCache bool) (*model.TermsOfService, error) { 7982 start := timemodule.Now() 7983 7984 result, err := s.TermsOfServiceStore.Get(id, allowFromCache) 7985 7986 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 7987 if s.Root.Metrics != nil { 7988 success := "false" 7989 if err == nil { 7990 success = "true" 7991 } 7992 s.Root.Metrics.ObserveStoreMethodDuration("TermsOfServiceStore.Get", success, elapsed) 7993 } 7994 return result, err 7995 } 7996 7997 func (s *TimerLayerTermsOfServiceStore) GetLatest(allowFromCache bool) (*model.TermsOfService, error) { 7998 start := timemodule.Now() 7999 8000 result, err := s.TermsOfServiceStore.GetLatest(allowFromCache) 8001 8002 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8003 if s.Root.Metrics != nil { 8004 success := "false" 8005 if err == nil { 8006 success = "true" 8007 } 8008 s.Root.Metrics.ObserveStoreMethodDuration("TermsOfServiceStore.GetLatest", success, elapsed) 8009 } 8010 return result, err 8011 } 8012 8013 func (s *TimerLayerTermsOfServiceStore) Save(termsOfService *model.TermsOfService) (*model.TermsOfService, error) { 8014 start := timemodule.Now() 8015 8016 result, err := s.TermsOfServiceStore.Save(termsOfService) 8017 8018 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8019 if s.Root.Metrics != nil { 8020 success := "false" 8021 if err == nil { 8022 success = "true" 8023 } 8024 s.Root.Metrics.ObserveStoreMethodDuration("TermsOfServiceStore.Save", success, elapsed) 8025 } 8026 return result, err 8027 } 8028 8029 func (s *TimerLayerThreadStore) CollectThreadsWithNewerReplies(userId string, channelIds []string, timestamp int64) ([]string, error) { 8030 start := timemodule.Now() 8031 8032 result, err := s.ThreadStore.CollectThreadsWithNewerReplies(userId, channelIds, timestamp) 8033 8034 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8035 if s.Root.Metrics != nil { 8036 success := "false" 8037 if err == nil { 8038 success = "true" 8039 } 8040 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.CollectThreadsWithNewerReplies", success, elapsed) 8041 } 8042 return result, err 8043 } 8044 8045 func (s *TimerLayerThreadStore) Delete(postID string) error { 8046 start := timemodule.Now() 8047 8048 err := s.ThreadStore.Delete(postID) 8049 8050 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8051 if s.Root.Metrics != nil { 8052 success := "false" 8053 if err == nil { 8054 success = "true" 8055 } 8056 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.Delete", success, elapsed) 8057 } 8058 return err 8059 } 8060 8061 func (s *TimerLayerThreadStore) DeleteMembershipForUser(userId string, postID string) error { 8062 start := timemodule.Now() 8063 8064 err := s.ThreadStore.DeleteMembershipForUser(userId, postID) 8065 8066 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8067 if s.Root.Metrics != nil { 8068 success := "false" 8069 if err == nil { 8070 success = "true" 8071 } 8072 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.DeleteMembershipForUser", success, elapsed) 8073 } 8074 return err 8075 } 8076 8077 func (s *TimerLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { 8078 start := timemodule.Now() 8079 8080 result, err := s.ThreadStore.DeleteOrphanedRows(limit) 8081 8082 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8083 if s.Root.Metrics != nil { 8084 success := "false" 8085 if err == nil { 8086 success = "true" 8087 } 8088 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.DeleteOrphanedRows", success, elapsed) 8089 } 8090 return result, err 8091 } 8092 8093 func (s *TimerLayerThreadStore) Get(id string) (*model.Thread, error) { 8094 start := timemodule.Now() 8095 8096 result, err := s.ThreadStore.Get(id) 8097 8098 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8099 if s.Root.Metrics != nil { 8100 success := "false" 8101 if err == nil { 8102 success = "true" 8103 } 8104 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.Get", success, elapsed) 8105 } 8106 return result, err 8107 } 8108 8109 func (s *TimerLayerThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { 8110 start := timemodule.Now() 8111 8112 result, err := s.ThreadStore.GetMembershipForUser(userId, postID) 8113 8114 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8115 if s.Root.Metrics != nil { 8116 success := "false" 8117 if err == nil { 8118 success = "true" 8119 } 8120 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.GetMembershipForUser", success, elapsed) 8121 } 8122 return result, err 8123 } 8124 8125 func (s *TimerLayerThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { 8126 start := timemodule.Now() 8127 8128 result, err := s.ThreadStore.GetMembershipsForUser(userId, teamID) 8129 8130 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8131 if s.Root.Metrics != nil { 8132 success := "false" 8133 if err == nil { 8134 success = "true" 8135 } 8136 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.GetMembershipsForUser", success, elapsed) 8137 } 8138 return result, err 8139 } 8140 8141 func (s *TimerLayerThreadStore) GetPosts(threadID string, since int64) ([]*model.Post, error) { 8142 start := timemodule.Now() 8143 8144 result, err := s.ThreadStore.GetPosts(threadID, since) 8145 8146 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8147 if s.Root.Metrics != nil { 8148 success := "false" 8149 if err == nil { 8150 success = "true" 8151 } 8152 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.GetPosts", success, elapsed) 8153 } 8154 return result, err 8155 } 8156 8157 func (s *TimerLayerThreadStore) GetThreadFollowers(threadID string) ([]string, error) { 8158 start := timemodule.Now() 8159 8160 result, err := s.ThreadStore.GetThreadFollowers(threadID) 8161 8162 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8163 if s.Root.Metrics != nil { 8164 success := "false" 8165 if err == nil { 8166 success = "true" 8167 } 8168 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.GetThreadFollowers", success, elapsed) 8169 } 8170 return result, err 8171 } 8172 8173 func (s *TimerLayerThreadStore) GetThreadForUser(teamID string, threadMembership *model.ThreadMembership, extended bool) (*model.ThreadResponse, error) { 8174 start := timemodule.Now() 8175 8176 result, err := s.ThreadStore.GetThreadForUser(teamID, threadMembership, extended) 8177 8178 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8179 if s.Root.Metrics != nil { 8180 success := "false" 8181 if err == nil { 8182 success = "true" 8183 } 8184 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.GetThreadForUser", success, elapsed) 8185 } 8186 return result, err 8187 } 8188 8189 func (s *TimerLayerThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) (*model.Threads, error) { 8190 start := timemodule.Now() 8191 8192 result, err := s.ThreadStore.GetThreadsForUser(userId, teamID, opts) 8193 8194 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8195 if s.Root.Metrics != nil { 8196 success := "false" 8197 if err == nil { 8198 success = "true" 8199 } 8200 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.GetThreadsForUser", success, elapsed) 8201 } 8202 return result, err 8203 } 8204 8205 func (s *TimerLayerThreadStore) MaintainMembership(userID string, postID string, opts store.ThreadMembershipOpts) (*model.ThreadMembership, error) { 8206 start := timemodule.Now() 8207 8208 result, err := s.ThreadStore.MaintainMembership(userID, postID, opts) 8209 8210 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8211 if s.Root.Metrics != nil { 8212 success := "false" 8213 if err == nil { 8214 success = "true" 8215 } 8216 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.MaintainMembership", success, elapsed) 8217 } 8218 return result, err 8219 } 8220 8221 func (s *TimerLayerThreadStore) MarkAllAsRead(userID string, teamID string) error { 8222 start := timemodule.Now() 8223 8224 err := s.ThreadStore.MarkAllAsRead(userID, teamID) 8225 8226 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8227 if s.Root.Metrics != nil { 8228 success := "false" 8229 if err == nil { 8230 success = "true" 8231 } 8232 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.MarkAllAsRead", success, elapsed) 8233 } 8234 return err 8235 } 8236 8237 func (s *TimerLayerThreadStore) MarkAllAsReadInChannels(userID string, channelIDs []string) error { 8238 start := timemodule.Now() 8239 8240 err := s.ThreadStore.MarkAllAsReadInChannels(userID, channelIDs) 8241 8242 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8243 if s.Root.Metrics != nil { 8244 success := "false" 8245 if err == nil { 8246 success = "true" 8247 } 8248 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.MarkAllAsReadInChannels", success, elapsed) 8249 } 8250 return err 8251 } 8252 8253 func (s *TimerLayerThreadStore) MarkAsRead(userID string, threadID string, timestamp int64) error { 8254 start := timemodule.Now() 8255 8256 err := s.ThreadStore.MarkAsRead(userID, threadID, timestamp) 8257 8258 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8259 if s.Root.Metrics != nil { 8260 success := "false" 8261 if err == nil { 8262 success = "true" 8263 } 8264 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.MarkAsRead", success, elapsed) 8265 } 8266 return err 8267 } 8268 8269 func (s *TimerLayerThreadStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { 8270 start := timemodule.Now() 8271 8272 result, resultVar1, err := s.ThreadStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) 8273 8274 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8275 if s.Root.Metrics != nil { 8276 success := "false" 8277 if err == nil { 8278 success = "true" 8279 } 8280 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.PermanentDeleteBatchForRetentionPolicies", success, elapsed) 8281 } 8282 return result, resultVar1, err 8283 } 8284 8285 func (s *TimerLayerThreadStore) PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { 8286 start := timemodule.Now() 8287 8288 result, resultVar1, err := s.ThreadStore.PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) 8289 8290 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8291 if s.Root.Metrics != nil { 8292 success := "false" 8293 if err == nil { 8294 success = "true" 8295 } 8296 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.PermanentDeleteBatchThreadMembershipsForRetentionPolicies", success, elapsed) 8297 } 8298 return result, resultVar1, err 8299 } 8300 8301 func (s *TimerLayerThreadStore) Save(thread *model.Thread) (*model.Thread, error) { 8302 start := timemodule.Now() 8303 8304 result, err := s.ThreadStore.Save(thread) 8305 8306 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8307 if s.Root.Metrics != nil { 8308 success := "false" 8309 if err == nil { 8310 success = "true" 8311 } 8312 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.Save", success, elapsed) 8313 } 8314 return result, err 8315 } 8316 8317 func (s *TimerLayerThreadStore) SaveMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error) { 8318 start := timemodule.Now() 8319 8320 result, err := s.ThreadStore.SaveMembership(membership) 8321 8322 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8323 if s.Root.Metrics != nil { 8324 success := "false" 8325 if err == nil { 8326 success = "true" 8327 } 8328 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.SaveMembership", success, elapsed) 8329 } 8330 return result, err 8331 } 8332 8333 func (s *TimerLayerThreadStore) SaveMultiple(thread []*model.Thread) ([]*model.Thread, int, error) { 8334 start := timemodule.Now() 8335 8336 result, resultVar1, err := s.ThreadStore.SaveMultiple(thread) 8337 8338 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8339 if s.Root.Metrics != nil { 8340 success := "false" 8341 if err == nil { 8342 success = "true" 8343 } 8344 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.SaveMultiple", success, elapsed) 8345 } 8346 return result, resultVar1, err 8347 } 8348 8349 func (s *TimerLayerThreadStore) Update(thread *model.Thread) (*model.Thread, error) { 8350 start := timemodule.Now() 8351 8352 result, err := s.ThreadStore.Update(thread) 8353 8354 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8355 if s.Root.Metrics != nil { 8356 success := "false" 8357 if err == nil { 8358 success = "true" 8359 } 8360 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.Update", success, elapsed) 8361 } 8362 return result, err 8363 } 8364 8365 func (s *TimerLayerThreadStore) UpdateMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error) { 8366 start := timemodule.Now() 8367 8368 result, err := s.ThreadStore.UpdateMembership(membership) 8369 8370 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8371 if s.Root.Metrics != nil { 8372 success := "false" 8373 if err == nil { 8374 success = "true" 8375 } 8376 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.UpdateMembership", success, elapsed) 8377 } 8378 return result, err 8379 } 8380 8381 func (s *TimerLayerThreadStore) UpdateUnreadsByChannel(userId string, changedThreads []string, timestamp int64, updateViewedTimestamp bool) error { 8382 start := timemodule.Now() 8383 8384 err := s.ThreadStore.UpdateUnreadsByChannel(userId, changedThreads, timestamp, updateViewedTimestamp) 8385 8386 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8387 if s.Root.Metrics != nil { 8388 success := "false" 8389 if err == nil { 8390 success = "true" 8391 } 8392 s.Root.Metrics.ObserveStoreMethodDuration("ThreadStore.UpdateUnreadsByChannel", success, elapsed) 8393 } 8394 return err 8395 } 8396 8397 func (s *TimerLayerTokenStore) Cleanup() { 8398 start := timemodule.Now() 8399 8400 s.TokenStore.Cleanup() 8401 8402 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8403 if s.Root.Metrics != nil { 8404 success := "false" 8405 if true { 8406 success = "true" 8407 } 8408 s.Root.Metrics.ObserveStoreMethodDuration("TokenStore.Cleanup", success, elapsed) 8409 } 8410 } 8411 8412 func (s *TimerLayerTokenStore) Delete(token string) error { 8413 start := timemodule.Now() 8414 8415 err := s.TokenStore.Delete(token) 8416 8417 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8418 if s.Root.Metrics != nil { 8419 success := "false" 8420 if err == nil { 8421 success = "true" 8422 } 8423 s.Root.Metrics.ObserveStoreMethodDuration("TokenStore.Delete", success, elapsed) 8424 } 8425 return err 8426 } 8427 8428 func (s *TimerLayerTokenStore) GetAllTokensByType(tokenType string) ([]*model.Token, error) { 8429 start := timemodule.Now() 8430 8431 result, err := s.TokenStore.GetAllTokensByType(tokenType) 8432 8433 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8434 if s.Root.Metrics != nil { 8435 success := "false" 8436 if err == nil { 8437 success = "true" 8438 } 8439 s.Root.Metrics.ObserveStoreMethodDuration("TokenStore.GetAllTokensByType", success, elapsed) 8440 } 8441 return result, err 8442 } 8443 8444 func (s *TimerLayerTokenStore) GetByToken(token string) (*model.Token, error) { 8445 start := timemodule.Now() 8446 8447 result, err := s.TokenStore.GetByToken(token) 8448 8449 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8450 if s.Root.Metrics != nil { 8451 success := "false" 8452 if err == nil { 8453 success = "true" 8454 } 8455 s.Root.Metrics.ObserveStoreMethodDuration("TokenStore.GetByToken", success, elapsed) 8456 } 8457 return result, err 8458 } 8459 8460 func (s *TimerLayerTokenStore) RemoveAllTokensByType(tokenType string) error { 8461 start := timemodule.Now() 8462 8463 err := s.TokenStore.RemoveAllTokensByType(tokenType) 8464 8465 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8466 if s.Root.Metrics != nil { 8467 success := "false" 8468 if err == nil { 8469 success = "true" 8470 } 8471 s.Root.Metrics.ObserveStoreMethodDuration("TokenStore.RemoveAllTokensByType", success, elapsed) 8472 } 8473 return err 8474 } 8475 8476 func (s *TimerLayerTokenStore) Save(recovery *model.Token) error { 8477 start := timemodule.Now() 8478 8479 err := s.TokenStore.Save(recovery) 8480 8481 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8482 if s.Root.Metrics != nil { 8483 success := "false" 8484 if err == nil { 8485 success = "true" 8486 } 8487 s.Root.Metrics.ObserveStoreMethodDuration("TokenStore.Save", success, elapsed) 8488 } 8489 return err 8490 } 8491 8492 func (s *TimerLayerTrackPointStore) Get(trackPointId string) (*model.TrackPoint, error) { 8493 start := timemodule.Now() 8494 8495 result, err := s.TrackPointStore.Get(trackPointId) 8496 8497 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8498 if s.Root.Metrics != nil { 8499 success := "false" 8500 if err == nil { 8501 success = "true" 8502 } 8503 s.Root.Metrics.ObserveStoreMethodDuration("TrackPointStore.Get", success, elapsed) 8504 } 8505 return result, err 8506 } 8507 8508 func (s *TimerLayerTrackPointStore) GetByTargetId(targetId string) ([]*model.TrackPoint, error) { 8509 start := timemodule.Now() 8510 8511 result, err := s.TrackPointStore.GetByTargetId(targetId) 8512 8513 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8514 if s.Root.Metrics != nil { 8515 success := "false" 8516 if err == nil { 8517 success = "true" 8518 } 8519 s.Root.Metrics.ObserveStoreMethodDuration("TrackPointStore.GetByTargetId", success, elapsed) 8520 } 8521 return result, err 8522 } 8523 8524 func (s *TimerLayerTrackPointStore) Save(trackPoint *model.TrackPoint) (*model.TrackPoint, error) { 8525 start := timemodule.Now() 8526 8527 result, err := s.TrackPointStore.Save(trackPoint) 8528 8529 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8530 if s.Root.Metrics != nil { 8531 success := "false" 8532 if err == nil { 8533 success = "true" 8534 } 8535 s.Root.Metrics.ObserveStoreMethodDuration("TrackPointStore.Save", success, elapsed) 8536 } 8537 return result, err 8538 } 8539 8540 func (s *TimerLayerTrackRecordStore) End(trackRecordId string) (*model.TrackRecord, error) { 8541 start := timemodule.Now() 8542 8543 result, err := s.TrackRecordStore.End(trackRecordId) 8544 8545 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8546 if s.Root.Metrics != nil { 8547 success := "false" 8548 if err == nil { 8549 success = "true" 8550 } 8551 s.Root.Metrics.ObserveStoreMethodDuration("TrackRecordStore.End", success, elapsed) 8552 } 8553 return result, err 8554 } 8555 8556 func (s *TimerLayerTrackRecordStore) Get(trackRecordId string) (*model.TrackRecord, error) { 8557 start := timemodule.Now() 8558 8559 result, err := s.TrackRecordStore.Get(trackRecordId) 8560 8561 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8562 if s.Root.Metrics != nil { 8563 success := "false" 8564 if err == nil { 8565 success = "true" 8566 } 8567 s.Root.Metrics.ObserveStoreMethodDuration("TrackRecordStore.Get", success, elapsed) 8568 } 8569 return result, err 8570 } 8571 8572 func (s *TimerLayerTrackRecordStore) Save(trackRecord *model.TrackRecord) (*model.TrackRecord, error) { 8573 start := timemodule.Now() 8574 8575 result, err := s.TrackRecordStore.Save(trackRecord) 8576 8577 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8578 if s.Root.Metrics != nil { 8579 success := "false" 8580 if err == nil { 8581 success = "true" 8582 } 8583 s.Root.Metrics.ObserveStoreMethodDuration("TrackRecordStore.Save", success, elapsed) 8584 } 8585 return result, err 8586 } 8587 8588 func (s *TimerLayerTrackRecordStore) Start(trackRecordId string) (*model.TrackRecord, error) { 8589 start := timemodule.Now() 8590 8591 result, err := s.TrackRecordStore.Start(trackRecordId) 8592 8593 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8594 if s.Root.Metrics != nil { 8595 success := "false" 8596 if err == nil { 8597 success = "true" 8598 } 8599 s.Root.Metrics.ObserveStoreMethodDuration("TrackRecordStore.Start", success, elapsed) 8600 } 8601 return result, err 8602 } 8603 8604 func (s *TimerLayerTrackRecordStore) Update(trackRecord *model.TrackRecord) (*model.TrackRecord, error) { 8605 start := timemodule.Now() 8606 8607 result, err := s.TrackRecordStore.Update(trackRecord) 8608 8609 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8610 if s.Root.Metrics != nil { 8611 success := "false" 8612 if err == nil { 8613 success = "true" 8614 } 8615 s.Root.Metrics.ObserveStoreMethodDuration("TrackRecordStore.Update", success, elapsed) 8616 } 8617 return result, err 8618 } 8619 8620 func (s *TimerLayerUploadSessionStore) Delete(id string) error { 8621 start := timemodule.Now() 8622 8623 err := s.UploadSessionStore.Delete(id) 8624 8625 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8626 if s.Root.Metrics != nil { 8627 success := "false" 8628 if err == nil { 8629 success = "true" 8630 } 8631 s.Root.Metrics.ObserveStoreMethodDuration("UploadSessionStore.Delete", success, elapsed) 8632 } 8633 return err 8634 } 8635 8636 func (s *TimerLayerUploadSessionStore) Get(id string) (*model.UploadSession, error) { 8637 start := timemodule.Now() 8638 8639 result, err := s.UploadSessionStore.Get(id) 8640 8641 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8642 if s.Root.Metrics != nil { 8643 success := "false" 8644 if err == nil { 8645 success = "true" 8646 } 8647 s.Root.Metrics.ObserveStoreMethodDuration("UploadSessionStore.Get", success, elapsed) 8648 } 8649 return result, err 8650 } 8651 8652 func (s *TimerLayerUploadSessionStore) GetForUser(userID string) ([]*model.UploadSession, error) { 8653 start := timemodule.Now() 8654 8655 result, err := s.UploadSessionStore.GetForUser(userID) 8656 8657 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8658 if s.Root.Metrics != nil { 8659 success := "false" 8660 if err == nil { 8661 success = "true" 8662 } 8663 s.Root.Metrics.ObserveStoreMethodDuration("UploadSessionStore.GetForUser", success, elapsed) 8664 } 8665 return result, err 8666 } 8667 8668 func (s *TimerLayerUploadSessionStore) Save(session *model.UploadSession) (*model.UploadSession, error) { 8669 start := timemodule.Now() 8670 8671 result, err := s.UploadSessionStore.Save(session) 8672 8673 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8674 if s.Root.Metrics != nil { 8675 success := "false" 8676 if err == nil { 8677 success = "true" 8678 } 8679 s.Root.Metrics.ObserveStoreMethodDuration("UploadSessionStore.Save", success, elapsed) 8680 } 8681 return result, err 8682 } 8683 8684 func (s *TimerLayerUploadSessionStore) Update(session *model.UploadSession) error { 8685 start := timemodule.Now() 8686 8687 err := s.UploadSessionStore.Update(session) 8688 8689 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8690 if s.Root.Metrics != nil { 8691 success := "false" 8692 if err == nil { 8693 success = "true" 8694 } 8695 s.Root.Metrics.ObserveStoreMethodDuration("UploadSessionStore.Update", success, elapsed) 8696 } 8697 return err 8698 } 8699 8700 func (s *TimerLayerUserStore) AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, error) { 8701 start := timemodule.Now() 8702 8703 result, err := s.UserStore.AnalyticsActiveCount(time, options) 8704 8705 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8706 if s.Root.Metrics != nil { 8707 success := "false" 8708 if err == nil { 8709 success = "true" 8710 } 8711 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsActiveCount", success, elapsed) 8712 } 8713 return result, err 8714 } 8715 8716 func (s *TimerLayerUserStore) AnalyticsActiveCountForPeriod(startTime int64, endTime int64, options model.UserCountOptions) (int64, error) { 8717 start := timemodule.Now() 8718 8719 result, err := s.UserStore.AnalyticsActiveCountForPeriod(startTime, endTime, options) 8720 8721 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8722 if s.Root.Metrics != nil { 8723 success := "false" 8724 if err == nil { 8725 success = "true" 8726 } 8727 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsActiveCountForPeriod", success, elapsed) 8728 } 8729 return result, err 8730 } 8731 8732 func (s *TimerLayerUserStore) AnalyticsGetExternalUsers(hostDomain string) (bool, error) { 8733 start := timemodule.Now() 8734 8735 result, err := s.UserStore.AnalyticsGetExternalUsers(hostDomain) 8736 8737 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8738 if s.Root.Metrics != nil { 8739 success := "false" 8740 if err == nil { 8741 success = "true" 8742 } 8743 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsGetExternalUsers", success, elapsed) 8744 } 8745 return result, err 8746 } 8747 8748 func (s *TimerLayerUserStore) AnalyticsGetGuestCount() (int64, error) { 8749 start := timemodule.Now() 8750 8751 result, err := s.UserStore.AnalyticsGetGuestCount() 8752 8753 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8754 if s.Root.Metrics != nil { 8755 success := "false" 8756 if err == nil { 8757 success = "true" 8758 } 8759 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsGetGuestCount", success, elapsed) 8760 } 8761 return result, err 8762 } 8763 8764 func (s *TimerLayerUserStore) AnalyticsGetInactiveUsersCount() (int64, error) { 8765 start := timemodule.Now() 8766 8767 result, err := s.UserStore.AnalyticsGetInactiveUsersCount() 8768 8769 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8770 if s.Root.Metrics != nil { 8771 success := "false" 8772 if err == nil { 8773 success = "true" 8774 } 8775 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsGetInactiveUsersCount", success, elapsed) 8776 } 8777 return result, err 8778 } 8779 8780 func (s *TimerLayerUserStore) AnalyticsGetSystemAdminCount() (int64, error) { 8781 start := timemodule.Now() 8782 8783 result, err := s.UserStore.AnalyticsGetSystemAdminCount() 8784 8785 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8786 if s.Root.Metrics != nil { 8787 success := "false" 8788 if err == nil { 8789 success = "true" 8790 } 8791 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AnalyticsGetSystemAdminCount", success, elapsed) 8792 } 8793 return result, err 8794 } 8795 8796 func (s *TimerLayerUserStore) AutocompleteUsersInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, error) { 8797 start := timemodule.Now() 8798 8799 result, err := s.UserStore.AutocompleteUsersInChannel(teamID, channelID, term, options) 8800 8801 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8802 if s.Root.Metrics != nil { 8803 success := "false" 8804 if err == nil { 8805 success = "true" 8806 } 8807 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.AutocompleteUsersInChannel", success, elapsed) 8808 } 8809 return result, err 8810 } 8811 8812 func (s *TimerLayerUserStore) ClearAllCustomRoleAssignments() error { 8813 start := timemodule.Now() 8814 8815 err := s.UserStore.ClearAllCustomRoleAssignments() 8816 8817 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8818 if s.Root.Metrics != nil { 8819 success := "false" 8820 if err == nil { 8821 success = "true" 8822 } 8823 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.ClearAllCustomRoleAssignments", success, elapsed) 8824 } 8825 return err 8826 } 8827 8828 func (s *TimerLayerUserStore) ClearCaches() { 8829 start := timemodule.Now() 8830 8831 s.UserStore.ClearCaches() 8832 8833 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8834 if s.Root.Metrics != nil { 8835 success := "false" 8836 if true { 8837 success = "true" 8838 } 8839 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.ClearCaches", success, elapsed) 8840 } 8841 } 8842 8843 func (s *TimerLayerUserStore) Count(options model.UserCountOptions) (int64, error) { 8844 start := timemodule.Now() 8845 8846 result, err := s.UserStore.Count(options) 8847 8848 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8849 if s.Root.Metrics != nil { 8850 success := "false" 8851 if err == nil { 8852 success = "true" 8853 } 8854 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.Count", success, elapsed) 8855 } 8856 return result, err 8857 } 8858 8859 func (s *TimerLayerUserStore) DeactivateGuests() ([]string, error) { 8860 start := timemodule.Now() 8861 8862 result, err := s.UserStore.DeactivateGuests() 8863 8864 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8865 if s.Root.Metrics != nil { 8866 success := "false" 8867 if err == nil { 8868 success = "true" 8869 } 8870 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.DeactivateGuests", success, elapsed) 8871 } 8872 return result, err 8873 } 8874 8875 func (s *TimerLayerUserStore) DemoteUserToGuest(userID string) (*model.User, error) { 8876 start := timemodule.Now() 8877 8878 result, err := s.UserStore.DemoteUserToGuest(userID) 8879 8880 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8881 if s.Root.Metrics != nil { 8882 success := "false" 8883 if err == nil { 8884 success = "true" 8885 } 8886 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.DemoteUserToGuest", success, elapsed) 8887 } 8888 return result, err 8889 } 8890 8891 func (s *TimerLayerUserStore) Get(ctx context.Context, id string) (*model.User, error) { 8892 start := timemodule.Now() 8893 8894 result, err := s.UserStore.Get(ctx, id) 8895 8896 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8897 if s.Root.Metrics != nil { 8898 success := "false" 8899 if err == nil { 8900 success = "true" 8901 } 8902 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.Get", success, elapsed) 8903 } 8904 return result, err 8905 } 8906 8907 func (s *TimerLayerUserStore) GetAll() ([]*model.User, error) { 8908 start := timemodule.Now() 8909 8910 result, err := s.UserStore.GetAll() 8911 8912 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8913 if s.Root.Metrics != nil { 8914 success := "false" 8915 if err == nil { 8916 success = "true" 8917 } 8918 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAll", success, elapsed) 8919 } 8920 return result, err 8921 } 8922 8923 func (s *TimerLayerUserStore) GetAllAfter(limit int, afterID string) ([]*model.User, error) { 8924 start := timemodule.Now() 8925 8926 result, err := s.UserStore.GetAllAfter(limit, afterID) 8927 8928 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8929 if s.Root.Metrics != nil { 8930 success := "false" 8931 if err == nil { 8932 success = "true" 8933 } 8934 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAllAfter", success, elapsed) 8935 } 8936 return result, err 8937 } 8938 8939 func (s *TimerLayerUserStore) GetAllNotInAuthService(authServices []string) ([]*model.User, error) { 8940 start := timemodule.Now() 8941 8942 result, err := s.UserStore.GetAllNotInAuthService(authServices) 8943 8944 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8945 if s.Root.Metrics != nil { 8946 success := "false" 8947 if err == nil { 8948 success = "true" 8949 } 8950 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAllNotInAuthService", success, elapsed) 8951 } 8952 return result, err 8953 } 8954 8955 func (s *TimerLayerUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error) { 8956 start := timemodule.Now() 8957 8958 result, err := s.UserStore.GetAllProfiles(options) 8959 8960 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8961 if s.Root.Metrics != nil { 8962 success := "false" 8963 if err == nil { 8964 success = "true" 8965 } 8966 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAllProfiles", success, elapsed) 8967 } 8968 return result, err 8969 } 8970 8971 func (s *TimerLayerUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { 8972 start := timemodule.Now() 8973 8974 result, err := s.UserStore.GetAllProfilesInChannel(ctx, channelID, allowFromCache) 8975 8976 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8977 if s.Root.Metrics != nil { 8978 success := "false" 8979 if err == nil { 8980 success = "true" 8981 } 8982 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAllProfilesInChannel", success, elapsed) 8983 } 8984 return result, err 8985 } 8986 8987 func (s *TimerLayerUserStore) GetAllUsingAuthService(authService string) ([]*model.User, error) { 8988 start := timemodule.Now() 8989 8990 result, err := s.UserStore.GetAllUsingAuthService(authService) 8991 8992 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 8993 if s.Root.Metrics != nil { 8994 success := "false" 8995 if err == nil { 8996 success = "true" 8997 } 8998 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAllUsingAuthService", success, elapsed) 8999 } 9000 return result, err 9001 } 9002 9003 func (s *TimerLayerUserStore) GetAnyUnreadPostCountForChannel(userID string, channelID string) (int64, error) { 9004 start := timemodule.Now() 9005 9006 result, err := s.UserStore.GetAnyUnreadPostCountForChannel(userID, channelID) 9007 9008 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9009 if s.Root.Metrics != nil { 9010 success := "false" 9011 if err == nil { 9012 success = "true" 9013 } 9014 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetAnyUnreadPostCountForChannel", success, elapsed) 9015 } 9016 return result, err 9017 } 9018 9019 func (s *TimerLayerUserStore) GetByAuth(authData *string, authService string) (*model.User, error) { 9020 start := timemodule.Now() 9021 9022 result, err := s.UserStore.GetByAuth(authData, authService) 9023 9024 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9025 if s.Root.Metrics != nil { 9026 success := "false" 9027 if err == nil { 9028 success = "true" 9029 } 9030 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetByAuth", success, elapsed) 9031 } 9032 return result, err 9033 } 9034 9035 func (s *TimerLayerUserStore) GetByEmail(email string) (*model.User, error) { 9036 start := timemodule.Now() 9037 9038 result, err := s.UserStore.GetByEmail(email) 9039 9040 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9041 if s.Root.Metrics != nil { 9042 success := "false" 9043 if err == nil { 9044 success = "true" 9045 } 9046 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetByEmail", success, elapsed) 9047 } 9048 return result, err 9049 } 9050 9051 func (s *TimerLayerUserStore) GetByUsername(username string) (*model.User, error) { 9052 start := timemodule.Now() 9053 9054 result, err := s.UserStore.GetByUsername(username) 9055 9056 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9057 if s.Root.Metrics != nil { 9058 success := "false" 9059 if err == nil { 9060 success = "true" 9061 } 9062 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetByUsername", success, elapsed) 9063 } 9064 return result, err 9065 } 9066 9067 func (s *TimerLayerUserStore) GetChannelGroupUsers(channelID string) ([]*model.User, error) { 9068 start := timemodule.Now() 9069 9070 result, err := s.UserStore.GetChannelGroupUsers(channelID) 9071 9072 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9073 if s.Root.Metrics != nil { 9074 success := "false" 9075 if err == nil { 9076 success = "true" 9077 } 9078 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetChannelGroupUsers", success, elapsed) 9079 } 9080 return result, err 9081 } 9082 9083 func (s *TimerLayerUserStore) GetEtagForAllProfiles() string { 9084 start := timemodule.Now() 9085 9086 result := s.UserStore.GetEtagForAllProfiles() 9087 9088 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9089 if s.Root.Metrics != nil { 9090 success := "false" 9091 if true { 9092 success = "true" 9093 } 9094 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetEtagForAllProfiles", success, elapsed) 9095 } 9096 return result 9097 } 9098 9099 func (s *TimerLayerUserStore) GetEtagForProfiles(teamID string) string { 9100 start := timemodule.Now() 9101 9102 result := s.UserStore.GetEtagForProfiles(teamID) 9103 9104 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9105 if s.Root.Metrics != nil { 9106 success := "false" 9107 if true { 9108 success = "true" 9109 } 9110 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetEtagForProfiles", success, elapsed) 9111 } 9112 return result 9113 } 9114 9115 func (s *TimerLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) string { 9116 start := timemodule.Now() 9117 9118 result := s.UserStore.GetEtagForProfilesNotInTeam(teamID) 9119 9120 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9121 if s.Root.Metrics != nil { 9122 success := "false" 9123 if true { 9124 success = "true" 9125 } 9126 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetEtagForProfilesNotInTeam", success, elapsed) 9127 } 9128 return result 9129 } 9130 9131 func (s *TimerLayerUserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) { 9132 start := timemodule.Now() 9133 9134 result, err := s.UserStore.GetForLogin(loginID, allowSignInWithUsername, allowSignInWithEmail) 9135 9136 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9137 if s.Root.Metrics != nil { 9138 success := "false" 9139 if err == nil { 9140 success = "true" 9141 } 9142 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetForLogin", success, elapsed) 9143 } 9144 return result, err 9145 } 9146 9147 func (s *TimerLayerUserStore) GetKnownUsers(userID string) ([]string, error) { 9148 start := timemodule.Now() 9149 9150 result, err := s.UserStore.GetKnownUsers(userID) 9151 9152 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9153 if s.Root.Metrics != nil { 9154 success := "false" 9155 if err == nil { 9156 success = "true" 9157 } 9158 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetKnownUsers", success, elapsed) 9159 } 9160 return result, err 9161 } 9162 9163 func (s *TimerLayerUserStore) GetMany(ctx context.Context, ids []string) ([]*model.User, error) { 9164 start := timemodule.Now() 9165 9166 result, err := s.UserStore.GetMany(ctx, ids) 9167 9168 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9169 if s.Root.Metrics != nil { 9170 success := "false" 9171 if err == nil { 9172 success = "true" 9173 } 9174 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetMany", success, elapsed) 9175 } 9176 return result, err 9177 } 9178 9179 func (s *TimerLayerUserStore) GetNewUsersForTeam(teamID string, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { 9180 start := timemodule.Now() 9181 9182 result, err := s.UserStore.GetNewUsersForTeam(teamID, offset, limit, viewRestrictions) 9183 9184 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9185 if s.Root.Metrics != nil { 9186 success := "false" 9187 if err == nil { 9188 success = "true" 9189 } 9190 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetNewUsersForTeam", success, elapsed) 9191 } 9192 return result, err 9193 } 9194 9195 func (s *TimerLayerUserStore) GetProfileByGroupChannelIdsForUser(userID string, channelIds []string) (map[string][]*model.User, error) { 9196 start := timemodule.Now() 9197 9198 result, err := s.UserStore.GetProfileByGroupChannelIdsForUser(userID, channelIds) 9199 9200 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9201 if s.Root.Metrics != nil { 9202 success := "false" 9203 if err == nil { 9204 success = "true" 9205 } 9206 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfileByGroupChannelIdsForUser", success, elapsed) 9207 } 9208 return result, err 9209 } 9210 9211 func (s *TimerLayerUserStore) GetProfileByIds(ctx context.Context, userIds []string, options *store.UserGetByIdsOpts, allowFromCache bool) ([]*model.User, error) { 9212 start := timemodule.Now() 9213 9214 result, err := s.UserStore.GetProfileByIds(ctx, userIds, options, allowFromCache) 9215 9216 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9217 if s.Root.Metrics != nil { 9218 success := "false" 9219 if err == nil { 9220 success = "true" 9221 } 9222 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfileByIds", success, elapsed) 9223 } 9224 return result, err 9225 } 9226 9227 func (s *TimerLayerUserStore) GetProfiles(options *model.UserGetOptions) ([]*model.User, error) { 9228 start := timemodule.Now() 9229 9230 result, err := s.UserStore.GetProfiles(options) 9231 9232 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9233 if s.Root.Metrics != nil { 9234 success := "false" 9235 if err == nil { 9236 success = "true" 9237 } 9238 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfiles", success, elapsed) 9239 } 9240 return result, err 9241 } 9242 9243 func (s *TimerLayerUserStore) GetProfilesByUsernames(usernames []string, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { 9244 start := timemodule.Now() 9245 9246 result, err := s.UserStore.GetProfilesByUsernames(usernames, viewRestrictions) 9247 9248 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9249 if s.Root.Metrics != nil { 9250 success := "false" 9251 if err == nil { 9252 success = "true" 9253 } 9254 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfilesByUsernames", success, elapsed) 9255 } 9256 return result, err 9257 } 9258 9259 func (s *TimerLayerUserStore) GetProfilesInChannel(options *model.UserGetOptions) ([]*model.User, error) { 9260 start := timemodule.Now() 9261 9262 result, err := s.UserStore.GetProfilesInChannel(options) 9263 9264 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9265 if s.Root.Metrics != nil { 9266 success := "false" 9267 if err == nil { 9268 success = "true" 9269 } 9270 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfilesInChannel", success, elapsed) 9271 } 9272 return result, err 9273 } 9274 9275 func (s *TimerLayerUserStore) GetProfilesInChannelByStatus(options *model.UserGetOptions) ([]*model.User, error) { 9276 start := timemodule.Now() 9277 9278 result, err := s.UserStore.GetProfilesInChannelByStatus(options) 9279 9280 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9281 if s.Root.Metrics != nil { 9282 success := "false" 9283 if err == nil { 9284 success = "true" 9285 } 9286 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfilesInChannelByStatus", success, elapsed) 9287 } 9288 return result, err 9289 } 9290 9291 func (s *TimerLayerUserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { 9292 start := timemodule.Now() 9293 9294 result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) 9295 9296 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9297 if s.Root.Metrics != nil { 9298 success := "false" 9299 if err == nil { 9300 success = "true" 9301 } 9302 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfilesNotInChannel", success, elapsed) 9303 } 9304 return result, err 9305 } 9306 9307 func (s *TimerLayerUserStore) GetProfilesNotInTeam(teamID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { 9308 start := timemodule.Now() 9309 9310 result, err := s.UserStore.GetProfilesNotInTeam(teamID, groupConstrained, offset, limit, viewRestrictions) 9311 9312 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9313 if s.Root.Metrics != nil { 9314 success := "false" 9315 if err == nil { 9316 success = "true" 9317 } 9318 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfilesNotInTeam", success, elapsed) 9319 } 9320 return result, err 9321 } 9322 9323 func (s *TimerLayerUserStore) GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, error) { 9324 start := timemodule.Now() 9325 9326 result, err := s.UserStore.GetProfilesWithoutTeam(options) 9327 9328 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9329 if s.Root.Metrics != nil { 9330 success := "false" 9331 if err == nil { 9332 success = "true" 9333 } 9334 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetProfilesWithoutTeam", success, elapsed) 9335 } 9336 return result, err 9337 } 9338 9339 func (s *TimerLayerUserStore) GetRecentlyActiveUsersForTeam(teamID string, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { 9340 start := timemodule.Now() 9341 9342 result, err := s.UserStore.GetRecentlyActiveUsersForTeam(teamID, offset, limit, viewRestrictions) 9343 9344 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9345 if s.Root.Metrics != nil { 9346 success := "false" 9347 if err == nil { 9348 success = "true" 9349 } 9350 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetRecentlyActiveUsersForTeam", success, elapsed) 9351 } 9352 return result, err 9353 } 9354 9355 func (s *TimerLayerUserStore) GetSystemAdminProfiles() (map[string]*model.User, error) { 9356 start := timemodule.Now() 9357 9358 result, err := s.UserStore.GetSystemAdminProfiles() 9359 9360 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9361 if s.Root.Metrics != nil { 9362 success := "false" 9363 if err == nil { 9364 success = "true" 9365 } 9366 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetSystemAdminProfiles", success, elapsed) 9367 } 9368 return result, err 9369 } 9370 9371 func (s *TimerLayerUserStore) GetTeamGroupUsers(teamID string) ([]*model.User, error) { 9372 start := timemodule.Now() 9373 9374 result, err := s.UserStore.GetTeamGroupUsers(teamID) 9375 9376 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9377 if s.Root.Metrics != nil { 9378 success := "false" 9379 if err == nil { 9380 success = "true" 9381 } 9382 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetTeamGroupUsers", success, elapsed) 9383 } 9384 return result, err 9385 } 9386 9387 func (s *TimerLayerUserStore) GetUnreadCount(userID string) (int64, error) { 9388 start := timemodule.Now() 9389 9390 result, err := s.UserStore.GetUnreadCount(userID) 9391 9392 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9393 if s.Root.Metrics != nil { 9394 success := "false" 9395 if err == nil { 9396 success = "true" 9397 } 9398 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetUnreadCount", success, elapsed) 9399 } 9400 return result, err 9401 } 9402 9403 func (s *TimerLayerUserStore) GetUnreadCountForChannel(userID string, channelID string) (int64, error) { 9404 start := timemodule.Now() 9405 9406 result, err := s.UserStore.GetUnreadCountForChannel(userID, channelID) 9407 9408 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9409 if s.Root.Metrics != nil { 9410 success := "false" 9411 if err == nil { 9412 success = "true" 9413 } 9414 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetUnreadCountForChannel", success, elapsed) 9415 } 9416 return result, err 9417 } 9418 9419 func (s *TimerLayerUserStore) GetUsersBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.UserForIndexing, error) { 9420 start := timemodule.Now() 9421 9422 result, err := s.UserStore.GetUsersBatchForIndexing(startTime, endTime, limit) 9423 9424 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9425 if s.Root.Metrics != nil { 9426 success := "false" 9427 if err == nil { 9428 success = "true" 9429 } 9430 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.GetUsersBatchForIndexing", success, elapsed) 9431 } 9432 return result, err 9433 } 9434 9435 func (s *TimerLayerUserStore) InferSystemInstallDate() (int64, error) { 9436 start := timemodule.Now() 9437 9438 result, err := s.UserStore.InferSystemInstallDate() 9439 9440 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9441 if s.Root.Metrics != nil { 9442 success := "false" 9443 if err == nil { 9444 success = "true" 9445 } 9446 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.InferSystemInstallDate", success, elapsed) 9447 } 9448 return result, err 9449 } 9450 9451 func (s *TimerLayerUserStore) InvalidateProfileCacheForUser(userID string) { 9452 start := timemodule.Now() 9453 9454 s.UserStore.InvalidateProfileCacheForUser(userID) 9455 9456 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9457 if s.Root.Metrics != nil { 9458 success := "false" 9459 if true { 9460 success = "true" 9461 } 9462 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.InvalidateProfileCacheForUser", success, elapsed) 9463 } 9464 } 9465 9466 func (s *TimerLayerUserStore) InvalidateProfilesInChannelCache(channelID string) { 9467 start := timemodule.Now() 9468 9469 s.UserStore.InvalidateProfilesInChannelCache(channelID) 9470 9471 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9472 if s.Root.Metrics != nil { 9473 success := "false" 9474 if true { 9475 success = "true" 9476 } 9477 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.InvalidateProfilesInChannelCache", success, elapsed) 9478 } 9479 } 9480 9481 func (s *TimerLayerUserStore) InvalidateProfilesInChannelCacheByUser(userID string) { 9482 start := timemodule.Now() 9483 9484 s.UserStore.InvalidateProfilesInChannelCacheByUser(userID) 9485 9486 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9487 if s.Root.Metrics != nil { 9488 success := "false" 9489 if true { 9490 success = "true" 9491 } 9492 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.InvalidateProfilesInChannelCacheByUser", success, elapsed) 9493 } 9494 } 9495 9496 func (s *TimerLayerUserStore) PermanentDelete(userID string) error { 9497 start := timemodule.Now() 9498 9499 err := s.UserStore.PermanentDelete(userID) 9500 9501 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9502 if s.Root.Metrics != nil { 9503 success := "false" 9504 if err == nil { 9505 success = "true" 9506 } 9507 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.PermanentDelete", success, elapsed) 9508 } 9509 return err 9510 } 9511 9512 func (s *TimerLayerUserStore) PromoteGuestToUser(userID string) error { 9513 start := timemodule.Now() 9514 9515 err := s.UserStore.PromoteGuestToUser(userID) 9516 9517 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9518 if s.Root.Metrics != nil { 9519 success := "false" 9520 if err == nil { 9521 success = "true" 9522 } 9523 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.PromoteGuestToUser", success, elapsed) 9524 } 9525 return err 9526 } 9527 9528 func (s *TimerLayerUserStore) ResetAuthDataToEmailForUsers(service string, userIDs []string, includeDeleted bool, dryRun bool) (int, error) { 9529 start := timemodule.Now() 9530 9531 result, err := s.UserStore.ResetAuthDataToEmailForUsers(service, userIDs, includeDeleted, dryRun) 9532 9533 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9534 if s.Root.Metrics != nil { 9535 success := "false" 9536 if err == nil { 9537 success = "true" 9538 } 9539 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.ResetAuthDataToEmailForUsers", success, elapsed) 9540 } 9541 return result, err 9542 } 9543 9544 func (s *TimerLayerUserStore) ResetLastPictureUpdate(userID string) error { 9545 start := timemodule.Now() 9546 9547 err := s.UserStore.ResetLastPictureUpdate(userID) 9548 9549 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9550 if s.Root.Metrics != nil { 9551 success := "false" 9552 if err == nil { 9553 success = "true" 9554 } 9555 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.ResetLastPictureUpdate", success, elapsed) 9556 } 9557 return err 9558 } 9559 9560 func (s *TimerLayerUserStore) Save(user *model.User) (*model.User, error) { 9561 start := timemodule.Now() 9562 9563 result, err := s.UserStore.Save(user) 9564 9565 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9566 if s.Root.Metrics != nil { 9567 success := "false" 9568 if err == nil { 9569 success = "true" 9570 } 9571 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.Save", success, elapsed) 9572 } 9573 return result, err 9574 } 9575 9576 func (s *TimerLayerUserStore) Search(teamID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { 9577 start := timemodule.Now() 9578 9579 result, err := s.UserStore.Search(teamID, term, options) 9580 9581 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9582 if s.Root.Metrics != nil { 9583 success := "false" 9584 if err == nil { 9585 success = "true" 9586 } 9587 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.Search", success, elapsed) 9588 } 9589 return result, err 9590 } 9591 9592 func (s *TimerLayerUserStore) SearchInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { 9593 start := timemodule.Now() 9594 9595 result, err := s.UserStore.SearchInChannel(channelID, term, options) 9596 9597 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9598 if s.Root.Metrics != nil { 9599 success := "false" 9600 if err == nil { 9601 success = "true" 9602 } 9603 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.SearchInChannel", success, elapsed) 9604 } 9605 return result, err 9606 } 9607 9608 func (s *TimerLayerUserStore) SearchInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { 9609 start := timemodule.Now() 9610 9611 result, err := s.UserStore.SearchInGroup(groupID, term, options) 9612 9613 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9614 if s.Root.Metrics != nil { 9615 success := "false" 9616 if err == nil { 9617 success = "true" 9618 } 9619 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.SearchInGroup", success, elapsed) 9620 } 9621 return result, err 9622 } 9623 9624 func (s *TimerLayerUserStore) SearchNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { 9625 start := timemodule.Now() 9626 9627 result, err := s.UserStore.SearchNotInChannel(teamID, channelID, term, options) 9628 9629 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9630 if s.Root.Metrics != nil { 9631 success := "false" 9632 if err == nil { 9633 success = "true" 9634 } 9635 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.SearchNotInChannel", success, elapsed) 9636 } 9637 return result, err 9638 } 9639 9640 func (s *TimerLayerUserStore) SearchNotInTeam(notInTeamID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { 9641 start := timemodule.Now() 9642 9643 result, err := s.UserStore.SearchNotInTeam(notInTeamID, term, options) 9644 9645 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9646 if s.Root.Metrics != nil { 9647 success := "false" 9648 if err == nil { 9649 success = "true" 9650 } 9651 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.SearchNotInTeam", success, elapsed) 9652 } 9653 return result, err 9654 } 9655 9656 func (s *TimerLayerUserStore) SearchWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, error) { 9657 start := timemodule.Now() 9658 9659 result, err := s.UserStore.SearchWithoutTeam(term, options) 9660 9661 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9662 if s.Root.Metrics != nil { 9663 success := "false" 9664 if err == nil { 9665 success = "true" 9666 } 9667 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.SearchWithoutTeam", success, elapsed) 9668 } 9669 return result, err 9670 } 9671 9672 func (s *TimerLayerUserStore) Update(user *model.User, allowRoleUpdate bool) (*model.UserUpdate, error) { 9673 start := timemodule.Now() 9674 9675 result, err := s.UserStore.Update(user, allowRoleUpdate) 9676 9677 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9678 if s.Root.Metrics != nil { 9679 success := "false" 9680 if err == nil { 9681 success = "true" 9682 } 9683 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.Update", success, elapsed) 9684 } 9685 return result, err 9686 } 9687 9688 func (s *TimerLayerUserStore) UpdateAuthData(userID string, service string, authData *string, email string, resetMfa bool) (string, error) { 9689 start := timemodule.Now() 9690 9691 result, err := s.UserStore.UpdateAuthData(userID, service, authData, email, resetMfa) 9692 9693 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9694 if s.Root.Metrics != nil { 9695 success := "false" 9696 if err == nil { 9697 success = "true" 9698 } 9699 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdateAuthData", success, elapsed) 9700 } 9701 return result, err 9702 } 9703 9704 func (s *TimerLayerUserStore) UpdateFailedPasswordAttempts(userID string, attempts int) error { 9705 start := timemodule.Now() 9706 9707 err := s.UserStore.UpdateFailedPasswordAttempts(userID, attempts) 9708 9709 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9710 if s.Root.Metrics != nil { 9711 success := "false" 9712 if err == nil { 9713 success = "true" 9714 } 9715 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdateFailedPasswordAttempts", success, elapsed) 9716 } 9717 return err 9718 } 9719 9720 func (s *TimerLayerUserStore) UpdateLastPictureUpdate(userID string) error { 9721 start := timemodule.Now() 9722 9723 err := s.UserStore.UpdateLastPictureUpdate(userID) 9724 9725 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9726 if s.Root.Metrics != nil { 9727 success := "false" 9728 if err == nil { 9729 success = "true" 9730 } 9731 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdateLastPictureUpdate", success, elapsed) 9732 } 9733 return err 9734 } 9735 9736 func (s *TimerLayerUserStore) UpdateMfaActive(userID string, active bool) error { 9737 start := timemodule.Now() 9738 9739 err := s.UserStore.UpdateMfaActive(userID, active) 9740 9741 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9742 if s.Root.Metrics != nil { 9743 success := "false" 9744 if err == nil { 9745 success = "true" 9746 } 9747 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdateMfaActive", success, elapsed) 9748 } 9749 return err 9750 } 9751 9752 func (s *TimerLayerUserStore) UpdateMfaSecret(userID string, secret string) error { 9753 start := timemodule.Now() 9754 9755 err := s.UserStore.UpdateMfaSecret(userID, secret) 9756 9757 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9758 if s.Root.Metrics != nil { 9759 success := "false" 9760 if err == nil { 9761 success = "true" 9762 } 9763 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdateMfaSecret", success, elapsed) 9764 } 9765 return err 9766 } 9767 9768 func (s *TimerLayerUserStore) UpdatePassword(userID string, newPassword string) error { 9769 start := timemodule.Now() 9770 9771 err := s.UserStore.UpdatePassword(userID, newPassword) 9772 9773 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9774 if s.Root.Metrics != nil { 9775 success := "false" 9776 if err == nil { 9777 success = "true" 9778 } 9779 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdatePassword", success, elapsed) 9780 } 9781 return err 9782 } 9783 9784 func (s *TimerLayerUserStore) UpdateUpdateAt(userID string) (int64, error) { 9785 start := timemodule.Now() 9786 9787 result, err := s.UserStore.UpdateUpdateAt(userID) 9788 9789 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9790 if s.Root.Metrics != nil { 9791 success := "false" 9792 if err == nil { 9793 success = "true" 9794 } 9795 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.UpdateUpdateAt", success, elapsed) 9796 } 9797 return result, err 9798 } 9799 9800 func (s *TimerLayerUserStore) VerifyEmail(userID string, email string) (string, error) { 9801 start := timemodule.Now() 9802 9803 result, err := s.UserStore.VerifyEmail(userID, email) 9804 9805 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9806 if s.Root.Metrics != nil { 9807 success := "false" 9808 if err == nil { 9809 success = "true" 9810 } 9811 s.Root.Metrics.ObserveStoreMethodDuration("UserStore.VerifyEmail", success, elapsed) 9812 } 9813 return result, err 9814 } 9815 9816 func (s *TimerLayerUserAccessTokenStore) Delete(tokenID string) error { 9817 start := timemodule.Now() 9818 9819 err := s.UserAccessTokenStore.Delete(tokenID) 9820 9821 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9822 if s.Root.Metrics != nil { 9823 success := "false" 9824 if err == nil { 9825 success = "true" 9826 } 9827 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.Delete", success, elapsed) 9828 } 9829 return err 9830 } 9831 9832 func (s *TimerLayerUserAccessTokenStore) DeleteAllForUser(userID string) error { 9833 start := timemodule.Now() 9834 9835 err := s.UserAccessTokenStore.DeleteAllForUser(userID) 9836 9837 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9838 if s.Root.Metrics != nil { 9839 success := "false" 9840 if err == nil { 9841 success = "true" 9842 } 9843 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.DeleteAllForUser", success, elapsed) 9844 } 9845 return err 9846 } 9847 9848 func (s *TimerLayerUserAccessTokenStore) Get(tokenID string) (*model.UserAccessToken, error) { 9849 start := timemodule.Now() 9850 9851 result, err := s.UserAccessTokenStore.Get(tokenID) 9852 9853 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9854 if s.Root.Metrics != nil { 9855 success := "false" 9856 if err == nil { 9857 success = "true" 9858 } 9859 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.Get", success, elapsed) 9860 } 9861 return result, err 9862 } 9863 9864 func (s *TimerLayerUserAccessTokenStore) GetAll(offset int, limit int) ([]*model.UserAccessToken, error) { 9865 start := timemodule.Now() 9866 9867 result, err := s.UserAccessTokenStore.GetAll(offset, limit) 9868 9869 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9870 if s.Root.Metrics != nil { 9871 success := "false" 9872 if err == nil { 9873 success = "true" 9874 } 9875 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.GetAll", success, elapsed) 9876 } 9877 return result, err 9878 } 9879 9880 func (s *TimerLayerUserAccessTokenStore) GetByToken(tokenString string) (*model.UserAccessToken, error) { 9881 start := timemodule.Now() 9882 9883 result, err := s.UserAccessTokenStore.GetByToken(tokenString) 9884 9885 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9886 if s.Root.Metrics != nil { 9887 success := "false" 9888 if err == nil { 9889 success = "true" 9890 } 9891 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.GetByToken", success, elapsed) 9892 } 9893 return result, err 9894 } 9895 9896 func (s *TimerLayerUserAccessTokenStore) GetByUser(userID string, page int, perPage int) ([]*model.UserAccessToken, error) { 9897 start := timemodule.Now() 9898 9899 result, err := s.UserAccessTokenStore.GetByUser(userID, page, perPage) 9900 9901 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9902 if s.Root.Metrics != nil { 9903 success := "false" 9904 if err == nil { 9905 success = "true" 9906 } 9907 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.GetByUser", success, elapsed) 9908 } 9909 return result, err 9910 } 9911 9912 func (s *TimerLayerUserAccessTokenStore) Save(token *model.UserAccessToken) (*model.UserAccessToken, error) { 9913 start := timemodule.Now() 9914 9915 result, err := s.UserAccessTokenStore.Save(token) 9916 9917 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9918 if s.Root.Metrics != nil { 9919 success := "false" 9920 if err == nil { 9921 success = "true" 9922 } 9923 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.Save", success, elapsed) 9924 } 9925 return result, err 9926 } 9927 9928 func (s *TimerLayerUserAccessTokenStore) Search(term string) ([]*model.UserAccessToken, error) { 9929 start := timemodule.Now() 9930 9931 result, err := s.UserAccessTokenStore.Search(term) 9932 9933 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9934 if s.Root.Metrics != nil { 9935 success := "false" 9936 if err == nil { 9937 success = "true" 9938 } 9939 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.Search", success, elapsed) 9940 } 9941 return result, err 9942 } 9943 9944 func (s *TimerLayerUserAccessTokenStore) UpdateTokenDisable(tokenID string) error { 9945 start := timemodule.Now() 9946 9947 err := s.UserAccessTokenStore.UpdateTokenDisable(tokenID) 9948 9949 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9950 if s.Root.Metrics != nil { 9951 success := "false" 9952 if err == nil { 9953 success = "true" 9954 } 9955 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.UpdateTokenDisable", success, elapsed) 9956 } 9957 return err 9958 } 9959 9960 func (s *TimerLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) error { 9961 start := timemodule.Now() 9962 9963 err := s.UserAccessTokenStore.UpdateTokenEnable(tokenID) 9964 9965 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9966 if s.Root.Metrics != nil { 9967 success := "false" 9968 if err == nil { 9969 success = "true" 9970 } 9971 s.Root.Metrics.ObserveStoreMethodDuration("UserAccessTokenStore.UpdateTokenEnable", success, elapsed) 9972 } 9973 return err 9974 } 9975 9976 func (s *TimerLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { 9977 start := timemodule.Now() 9978 9979 err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceId) 9980 9981 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9982 if s.Root.Metrics != nil { 9983 success := "false" 9984 if err == nil { 9985 success = "true" 9986 } 9987 s.Root.Metrics.ObserveStoreMethodDuration("UserTermsOfServiceStore.Delete", success, elapsed) 9988 } 9989 return err 9990 } 9991 9992 func (s *TimerLayerUserTermsOfServiceStore) GetByUser(userID string) (*model.UserTermsOfService, error) { 9993 start := timemodule.Now() 9994 9995 result, err := s.UserTermsOfServiceStore.GetByUser(userID) 9996 9997 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 9998 if s.Root.Metrics != nil { 9999 success := "false" 10000 if err == nil { 10001 success = "true" 10002 } 10003 s.Root.Metrics.ObserveStoreMethodDuration("UserTermsOfServiceStore.GetByUser", success, elapsed) 10004 } 10005 return result, err 10006 } 10007 10008 func (s *TimerLayerUserTermsOfServiceStore) Save(userTermsOfService *model.UserTermsOfService) (*model.UserTermsOfService, error) { 10009 start := timemodule.Now() 10010 10011 result, err := s.UserTermsOfServiceStore.Save(userTermsOfService) 10012 10013 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10014 if s.Root.Metrics != nil { 10015 success := "false" 10016 if err == nil { 10017 success = "true" 10018 } 10019 s.Root.Metrics.ObserveStoreMethodDuration("UserTermsOfServiceStore.Save", success, elapsed) 10020 } 10021 return result, err 10022 } 10023 10024 func (s *TimerLayerWebhookStore) AnalyticsIncomingCount(teamID string) (int64, error) { 10025 start := timemodule.Now() 10026 10027 result, err := s.WebhookStore.AnalyticsIncomingCount(teamID) 10028 10029 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10030 if s.Root.Metrics != nil { 10031 success := "false" 10032 if err == nil { 10033 success = "true" 10034 } 10035 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.AnalyticsIncomingCount", success, elapsed) 10036 } 10037 return result, err 10038 } 10039 10040 func (s *TimerLayerWebhookStore) AnalyticsOutgoingCount(teamID string) (int64, error) { 10041 start := timemodule.Now() 10042 10043 result, err := s.WebhookStore.AnalyticsOutgoingCount(teamID) 10044 10045 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10046 if s.Root.Metrics != nil { 10047 success := "false" 10048 if err == nil { 10049 success = "true" 10050 } 10051 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.AnalyticsOutgoingCount", success, elapsed) 10052 } 10053 return result, err 10054 } 10055 10056 func (s *TimerLayerWebhookStore) ClearCaches() { 10057 start := timemodule.Now() 10058 10059 s.WebhookStore.ClearCaches() 10060 10061 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10062 if s.Root.Metrics != nil { 10063 success := "false" 10064 if true { 10065 success = "true" 10066 } 10067 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.ClearCaches", success, elapsed) 10068 } 10069 } 10070 10071 func (s *TimerLayerWebhookStore) DeleteIncoming(webhookID string, time int64) error { 10072 start := timemodule.Now() 10073 10074 err := s.WebhookStore.DeleteIncoming(webhookID, time) 10075 10076 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10077 if s.Root.Metrics != nil { 10078 success := "false" 10079 if err == nil { 10080 success = "true" 10081 } 10082 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.DeleteIncoming", success, elapsed) 10083 } 10084 return err 10085 } 10086 10087 func (s *TimerLayerWebhookStore) DeleteOutgoing(webhookID string, time int64) error { 10088 start := timemodule.Now() 10089 10090 err := s.WebhookStore.DeleteOutgoing(webhookID, time) 10091 10092 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10093 if s.Root.Metrics != nil { 10094 success := "false" 10095 if err == nil { 10096 success = "true" 10097 } 10098 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.DeleteOutgoing", success, elapsed) 10099 } 10100 return err 10101 } 10102 10103 func (s *TimerLayerWebhookStore) GetIncoming(id string, allowFromCache bool) (*model.IncomingWebhook, error) { 10104 start := timemodule.Now() 10105 10106 result, err := s.WebhookStore.GetIncoming(id, allowFromCache) 10107 10108 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10109 if s.Root.Metrics != nil { 10110 success := "false" 10111 if err == nil { 10112 success = "true" 10113 } 10114 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncoming", success, elapsed) 10115 } 10116 return result, err 10117 } 10118 10119 func (s *TimerLayerWebhookStore) GetIncomingByChannel(channelID string) ([]*model.IncomingWebhook, error) { 10120 start := timemodule.Now() 10121 10122 result, err := s.WebhookStore.GetIncomingByChannel(channelID) 10123 10124 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10125 if s.Root.Metrics != nil { 10126 success := "false" 10127 if err == nil { 10128 success = "true" 10129 } 10130 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncomingByChannel", success, elapsed) 10131 } 10132 return result, err 10133 } 10134 10135 func (s *TimerLayerWebhookStore) GetIncomingByTeam(teamID string, offset int, limit int) ([]*model.IncomingWebhook, error) { 10136 start := timemodule.Now() 10137 10138 result, err := s.WebhookStore.GetIncomingByTeam(teamID, offset, limit) 10139 10140 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10141 if s.Root.Metrics != nil { 10142 success := "false" 10143 if err == nil { 10144 success = "true" 10145 } 10146 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncomingByTeam", success, elapsed) 10147 } 10148 return result, err 10149 } 10150 10151 func (s *TimerLayerWebhookStore) GetIncomingByTeamByUser(teamID string, userID string, offset int, limit int) ([]*model.IncomingWebhook, error) { 10152 start := timemodule.Now() 10153 10154 result, err := s.WebhookStore.GetIncomingByTeamByUser(teamID, userID, offset, limit) 10155 10156 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10157 if s.Root.Metrics != nil { 10158 success := "false" 10159 if err == nil { 10160 success = "true" 10161 } 10162 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncomingByTeamByUser", success, elapsed) 10163 } 10164 return result, err 10165 } 10166 10167 func (s *TimerLayerWebhookStore) GetIncomingList(offset int, limit int) ([]*model.IncomingWebhook, error) { 10168 start := timemodule.Now() 10169 10170 result, err := s.WebhookStore.GetIncomingList(offset, limit) 10171 10172 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10173 if s.Root.Metrics != nil { 10174 success := "false" 10175 if err == nil { 10176 success = "true" 10177 } 10178 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncomingList", success, elapsed) 10179 } 10180 return result, err 10181 } 10182 10183 func (s *TimerLayerWebhookStore) GetIncomingListByUser(userID string, offset int, limit int) ([]*model.IncomingWebhook, error) { 10184 start := timemodule.Now() 10185 10186 result, err := s.WebhookStore.GetIncomingListByUser(userID, offset, limit) 10187 10188 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10189 if s.Root.Metrics != nil { 10190 success := "false" 10191 if err == nil { 10192 success = "true" 10193 } 10194 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetIncomingListByUser", success, elapsed) 10195 } 10196 return result, err 10197 } 10198 10199 func (s *TimerLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) { 10200 start := timemodule.Now() 10201 10202 result, err := s.WebhookStore.GetOutgoing(id) 10203 10204 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10205 if s.Root.Metrics != nil { 10206 success := "false" 10207 if err == nil { 10208 success = "true" 10209 } 10210 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoing", success, elapsed) 10211 } 10212 return result, err 10213 } 10214 10215 func (s *TimerLayerWebhookStore) GetOutgoingByChannel(channelID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { 10216 start := timemodule.Now() 10217 10218 result, err := s.WebhookStore.GetOutgoingByChannel(channelID, offset, limit) 10219 10220 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10221 if s.Root.Metrics != nil { 10222 success := "false" 10223 if err == nil { 10224 success = "true" 10225 } 10226 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingByChannel", success, elapsed) 10227 } 10228 return result, err 10229 } 10230 10231 func (s *TimerLayerWebhookStore) GetOutgoingByChannelByUser(channelID string, userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { 10232 start := timemodule.Now() 10233 10234 result, err := s.WebhookStore.GetOutgoingByChannelByUser(channelID, userID, offset, limit) 10235 10236 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10237 if s.Root.Metrics != nil { 10238 success := "false" 10239 if err == nil { 10240 success = "true" 10241 } 10242 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingByChannelByUser", success, elapsed) 10243 } 10244 return result, err 10245 } 10246 10247 func (s *TimerLayerWebhookStore) GetOutgoingByTeam(teamID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { 10248 start := timemodule.Now() 10249 10250 result, err := s.WebhookStore.GetOutgoingByTeam(teamID, offset, limit) 10251 10252 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10253 if s.Root.Metrics != nil { 10254 success := "false" 10255 if err == nil { 10256 success = "true" 10257 } 10258 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingByTeam", success, elapsed) 10259 } 10260 return result, err 10261 } 10262 10263 func (s *TimerLayerWebhookStore) GetOutgoingByTeamByUser(teamID string, userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { 10264 start := timemodule.Now() 10265 10266 result, err := s.WebhookStore.GetOutgoingByTeamByUser(teamID, userID, offset, limit) 10267 10268 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10269 if s.Root.Metrics != nil { 10270 success := "false" 10271 if err == nil { 10272 success = "true" 10273 } 10274 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingByTeamByUser", success, elapsed) 10275 } 10276 return result, err 10277 } 10278 10279 func (s *TimerLayerWebhookStore) GetOutgoingList(offset int, limit int) ([]*model.OutgoingWebhook, error) { 10280 start := timemodule.Now() 10281 10282 result, err := s.WebhookStore.GetOutgoingList(offset, limit) 10283 10284 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10285 if s.Root.Metrics != nil { 10286 success := "false" 10287 if err == nil { 10288 success = "true" 10289 } 10290 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingList", success, elapsed) 10291 } 10292 return result, err 10293 } 10294 10295 func (s *TimerLayerWebhookStore) GetOutgoingListByUser(userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { 10296 start := timemodule.Now() 10297 10298 result, err := s.WebhookStore.GetOutgoingListByUser(userID, offset, limit) 10299 10300 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10301 if s.Root.Metrics != nil { 10302 success := "false" 10303 if err == nil { 10304 success = "true" 10305 } 10306 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.GetOutgoingListByUser", success, elapsed) 10307 } 10308 return result, err 10309 } 10310 10311 func (s *TimerLayerWebhookStore) InvalidateWebhookCache(webhook string) { 10312 start := timemodule.Now() 10313 10314 s.WebhookStore.InvalidateWebhookCache(webhook) 10315 10316 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10317 if s.Root.Metrics != nil { 10318 success := "false" 10319 if true { 10320 success = "true" 10321 } 10322 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.InvalidateWebhookCache", success, elapsed) 10323 } 10324 } 10325 10326 func (s *TimerLayerWebhookStore) PermanentDeleteIncomingByChannel(channelID string) error { 10327 start := timemodule.Now() 10328 10329 err := s.WebhookStore.PermanentDeleteIncomingByChannel(channelID) 10330 10331 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10332 if s.Root.Metrics != nil { 10333 success := "false" 10334 if err == nil { 10335 success = "true" 10336 } 10337 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.PermanentDeleteIncomingByChannel", success, elapsed) 10338 } 10339 return err 10340 } 10341 10342 func (s *TimerLayerWebhookStore) PermanentDeleteIncomingByUser(userID string) error { 10343 start := timemodule.Now() 10344 10345 err := s.WebhookStore.PermanentDeleteIncomingByUser(userID) 10346 10347 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10348 if s.Root.Metrics != nil { 10349 success := "false" 10350 if err == nil { 10351 success = "true" 10352 } 10353 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.PermanentDeleteIncomingByUser", success, elapsed) 10354 } 10355 return err 10356 } 10357 10358 func (s *TimerLayerWebhookStore) PermanentDeleteOutgoingByChannel(channelID string) error { 10359 start := timemodule.Now() 10360 10361 err := s.WebhookStore.PermanentDeleteOutgoingByChannel(channelID) 10362 10363 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10364 if s.Root.Metrics != nil { 10365 success := "false" 10366 if err == nil { 10367 success = "true" 10368 } 10369 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.PermanentDeleteOutgoingByChannel", success, elapsed) 10370 } 10371 return err 10372 } 10373 10374 func (s *TimerLayerWebhookStore) PermanentDeleteOutgoingByUser(userID string) error { 10375 start := timemodule.Now() 10376 10377 err := s.WebhookStore.PermanentDeleteOutgoingByUser(userID) 10378 10379 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10380 if s.Root.Metrics != nil { 10381 success := "false" 10382 if err == nil { 10383 success = "true" 10384 } 10385 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.PermanentDeleteOutgoingByUser", success, elapsed) 10386 } 10387 return err 10388 } 10389 10390 func (s *TimerLayerWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) { 10391 start := timemodule.Now() 10392 10393 result, err := s.WebhookStore.SaveIncoming(webhook) 10394 10395 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10396 if s.Root.Metrics != nil { 10397 success := "false" 10398 if err == nil { 10399 success = "true" 10400 } 10401 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.SaveIncoming", success, elapsed) 10402 } 10403 return result, err 10404 } 10405 10406 func (s *TimerLayerWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) { 10407 start := timemodule.Now() 10408 10409 result, err := s.WebhookStore.SaveOutgoing(webhook) 10410 10411 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10412 if s.Root.Metrics != nil { 10413 success := "false" 10414 if err == nil { 10415 success = "true" 10416 } 10417 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.SaveOutgoing", success, elapsed) 10418 } 10419 return result, err 10420 } 10421 10422 func (s *TimerLayerWebhookStore) UpdateIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) { 10423 start := timemodule.Now() 10424 10425 result, err := s.WebhookStore.UpdateIncoming(webhook) 10426 10427 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10428 if s.Root.Metrics != nil { 10429 success := "false" 10430 if err == nil { 10431 success = "true" 10432 } 10433 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.UpdateIncoming", success, elapsed) 10434 } 10435 return result, err 10436 } 10437 10438 func (s *TimerLayerWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) { 10439 start := timemodule.Now() 10440 10441 result, err := s.WebhookStore.UpdateOutgoing(hook) 10442 10443 elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) 10444 if s.Root.Metrics != nil { 10445 success := "false" 10446 if err == nil { 10447 success = "true" 10448 } 10449 s.Root.Metrics.ObserveStoreMethodDuration("WebhookStore.UpdateOutgoing", success, elapsed) 10450 } 10451 return result, err 10452 } 10453 10454 func (s *TimerLayer) Close() { 10455 s.Store.Close() 10456 } 10457 10458 func (s *TimerLayer) DropAllTables() { 10459 s.Store.DropAllTables() 10460 } 10461 10462 func (s *TimerLayer) GetCurrentSchemaVersion() string { 10463 return s.Store.GetCurrentSchemaVersion() 10464 } 10465 10466 func (s *TimerLayer) LockToMaster() { 10467 s.Store.LockToMaster() 10468 } 10469 10470 func (s *TimerLayer) MarkSystemRanUnitTests() { 10471 s.Store.MarkSystemRanUnitTests() 10472 } 10473 10474 func (s *TimerLayer) SetContext(context context.Context) { 10475 s.Store.SetContext(context) 10476 } 10477 10478 func (s *TimerLayer) TotalMasterDbConnections() int { 10479 return s.Store.TotalMasterDbConnections() 10480 } 10481 10482 func (s *TimerLayer) TotalReadDbConnections() int { 10483 return s.Store.TotalReadDbConnections() 10484 } 10485 10486 func (s *TimerLayer) TotalSearchDbConnections() int { 10487 return s.Store.TotalSearchDbConnections() 10488 } 10489 10490 func (s *TimerLayer) UnlockFromMaster() { 10491 s.Store.UnlockFromMaster() 10492 } 10493 10494 func New(childStore store.Store, metrics einterfaces.MetricsInterface) *TimerLayer { 10495 newStore := TimerLayer{ 10496 Store: childStore, 10497 Metrics: metrics, 10498 } 10499 10500 newStore.AuditStore = &TimerLayerAuditStore{AuditStore: childStore.Audit(), Root: &newStore} 10501 newStore.BotStore = &TimerLayerBotStore{BotStore: childStore.Bot(), Root: &newStore} 10502 newStore.ChannelStore = &TimerLayerChannelStore{ChannelStore: childStore.Channel(), Root: &newStore} 10503 newStore.ChannelMemberHistoryStore = &TimerLayerChannelMemberHistoryStore{ChannelMemberHistoryStore: childStore.ChannelMemberHistory(), Root: &newStore} 10504 newStore.ClusterDiscoveryStore = &TimerLayerClusterDiscoveryStore{ClusterDiscoveryStore: childStore.ClusterDiscovery(), Root: &newStore} 10505 newStore.CommandStore = &TimerLayerCommandStore{CommandStore: childStore.Command(), Root: &newStore} 10506 newStore.CommandWebhookStore = &TimerLayerCommandWebhookStore{CommandWebhookStore: childStore.CommandWebhook(), Root: &newStore} 10507 newStore.ComplianceStore = &TimerLayerComplianceStore{ComplianceStore: childStore.Compliance(), Root: &newStore} 10508 newStore.EmojiStore = &TimerLayerEmojiStore{EmojiStore: childStore.Emoji(), Root: &newStore} 10509 newStore.FileInfoStore = &TimerLayerFileInfoStore{FileInfoStore: childStore.FileInfo(), Root: &newStore} 10510 newStore.GroupStore = &TimerLayerGroupStore{GroupStore: childStore.Group(), Root: &newStore} 10511 newStore.JobStore = &TimerLayerJobStore{JobStore: childStore.Job(), Root: &newStore} 10512 newStore.LicenseStore = &TimerLayerLicenseStore{LicenseStore: childStore.License(), Root: &newStore} 10513 newStore.LinkMetadataStore = &TimerLayerLinkMetadataStore{LinkMetadataStore: childStore.LinkMetadata(), Root: &newStore} 10514 newStore.OAuthStore = &TimerLayerOAuthStore{OAuthStore: childStore.OAuth(), Root: &newStore} 10515 newStore.PluginStore = &TimerLayerPluginStore{PluginStore: childStore.Plugin(), Root: &newStore} 10516 newStore.PostStore = &TimerLayerPostStore{PostStore: childStore.Post(), Root: &newStore} 10517 newStore.PreferenceStore = &TimerLayerPreferenceStore{PreferenceStore: childStore.Preference(), Root: &newStore} 10518 newStore.ProductNoticesStore = &TimerLayerProductNoticesStore{ProductNoticesStore: childStore.ProductNotices(), Root: &newStore} 10519 newStore.ReactionStore = &TimerLayerReactionStore{ReactionStore: childStore.Reaction(), Root: &newStore} 10520 newStore.RemoteClusterStore = &TimerLayerRemoteClusterStore{RemoteClusterStore: childStore.RemoteCluster(), Root: &newStore} 10521 newStore.RetentionPolicyStore = &TimerLayerRetentionPolicyStore{RetentionPolicyStore: childStore.RetentionPolicy(), Root: &newStore} 10522 newStore.RoleStore = &TimerLayerRoleStore{RoleStore: childStore.Role(), Root: &newStore} 10523 newStore.SchemeStore = &TimerLayerSchemeStore{SchemeStore: childStore.Scheme(), Root: &newStore} 10524 newStore.SessionStore = &TimerLayerSessionStore{SessionStore: childStore.Session(), Root: &newStore} 10525 newStore.SharedChannelStore = &TimerLayerSharedChannelStore{SharedChannelStore: childStore.SharedChannel(), Root: &newStore} 10526 newStore.StatusStore = &TimerLayerStatusStore{StatusStore: childStore.Status(), Root: &newStore} 10527 newStore.SystemStore = &TimerLayerSystemStore{SystemStore: childStore.System(), Root: &newStore} 10528 newStore.TeamStore = &TimerLayerTeamStore{TeamStore: childStore.Team(), Root: &newStore} 10529 newStore.TermsOfServiceStore = &TimerLayerTermsOfServiceStore{TermsOfServiceStore: childStore.TermsOfService(), Root: &newStore} 10530 newStore.ThreadStore = &TimerLayerThreadStore{ThreadStore: childStore.Thread(), Root: &newStore} 10531 newStore.TokenStore = &TimerLayerTokenStore{TokenStore: childStore.Token(), Root: &newStore} 10532 newStore.TrackPointStore = &TimerLayerTrackPointStore{TrackPointStore: childStore.TrackPoint(), Root: &newStore} 10533 newStore.TrackRecordStore = &TimerLayerTrackRecordStore{TrackRecordStore: childStore.TrackRecord(), Root: &newStore} 10534 newStore.UploadSessionStore = &TimerLayerUploadSessionStore{UploadSessionStore: childStore.UploadSession(), Root: &newStore} 10535 newStore.UserStore = &TimerLayerUserStore{UserStore: childStore.User(), Root: &newStore} 10536 newStore.UserAccessTokenStore = &TimerLayerUserAccessTokenStore{UserAccessTokenStore: childStore.UserAccessToken(), Root: &newStore} 10537 newStore.UserTermsOfServiceStore = &TimerLayerUserTermsOfServiceStore{UserTermsOfServiceStore: childStore.UserTermsOfService(), Root: &newStore} 10538 newStore.WebhookStore = &TimerLayerWebhookStore{WebhookStore: childStore.Webhook(), Root: &newStore} 10539 return &newStore 10540 }