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