Revert "Mm 30807 granular data retention scaffold (#16891)" (#17437)

This reverts commit 3ea75332e7.
Этот коммит содержится в:
Agniva De Sarker
2021-04-18 22:41:50 +05:30
коммит произвёл GitHub
родитель 3a13987ee1
Коммит e0efdd708b
49 изменённых файлов: 984 добавлений и 5079 удалений

Просмотреть файл

@@ -39,7 +39,6 @@ type TimerLayer struct {
ProductNoticesStore store.ProductNoticesStore
ReactionStore store.ReactionStore
RemoteClusterStore store.RemoteClusterStore
RetentionPolicyStore store.RetentionPolicyStore
RoleStore store.RoleStore
SchemeStore store.SchemeStore
SessionStore store.SessionStore
@@ -141,10 +140,6 @@ func (s *TimerLayer) RemoteCluster() store.RemoteClusterStore {
return s.RemoteClusterStore
}
func (s *TimerLayer) RetentionPolicy() store.RetentionPolicyStore {
return s.RetentionPolicyStore
}
func (s *TimerLayer) Role() store.RoleStore {
return s.RoleStore
}
@@ -310,11 +305,6 @@ type TimerLayerRemoteClusterStore struct {
Root *TimerLayer
}
type TimerLayerRetentionPolicyStore struct {
store.RetentionPolicyStore
Root *TimerLayer
}
type TimerLayerRoleStore struct {
store.RoleStore
Root *TimerLayer
@@ -5529,294 +5519,6 @@ func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topi
return result, err
}
func (s *TimerLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error {
start := timemodule.Now()
err := s.RetentionPolicyStore.AddChannels(policyId, channelIds)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.AddChannels", success, elapsed)
}
return err
}
func (s *TimerLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error {
start := timemodule.Now()
err := s.RetentionPolicyStore.AddTeams(policyId, teamIds)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.AddTeams", success, elapsed)
}
return err
}
func (s *TimerLayerRetentionPolicyStore) Delete(id string) error {
start := timemodule.Now()
err := s.RetentionPolicyStore.Delete(id)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Delete", success, elapsed)
}
return err
}
func (s *TimerLayerRetentionPolicyStore) Get(id string) (*model.RetentionPolicyWithTeamAndChannelCounts, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.Get(id)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Get", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetAll(offset int, limit int) ([]*model.RetentionPolicyWithTeamAndChannelCounts, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetAll(offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetAll", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesCountForUser(userID string) (int64, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetChannelPoliciesCountForUser(userID)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannelPoliciesCountForUser", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForChannel, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetChannelPoliciesForUser(userID, offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannelPoliciesForUser", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannels", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetChannelsCount(policyId)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetChannelsCount", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetCount() (int64, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetCount", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesCountForUser(userID string) (int64, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetTeamPoliciesCountForUser(userID)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeamPoliciesCountForUser", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForTeam, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetTeamPoliciesForUser(userID, offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeamPoliciesForUser", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeams", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.GetTeamsCount(policyId)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.GetTeamsCount", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.Patch(patch)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Patch", success, elapsed)
}
return result, err
}
func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error {
start := timemodule.Now()
err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.RemoveChannels", success, elapsed)
}
return err
}
func (s *TimerLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error {
start := timemodule.Now()
err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.RemoveTeams", success, elapsed)
}
return err
}
func (s *TimerLayerRetentionPolicyStore) Save(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) {
start := timemodule.Now()
result, err := s.RetentionPolicyStore.Save(policy)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("RetentionPolicyStore.Save", success, elapsed)
}
return result, err
}
func (s *TimerLayerRoleStore) AllChannelSchemeRoles() ([]*model.Role, error) {
start := timemodule.Now()
@@ -6984,10 +6686,42 @@ func (s *TimerLayerTeamStore) AnalyticsGetTeamCountForScheme(schemeID string) (i
return result, err
}
func (s *TimerLayerTeamStore) AnalyticsTeamCount(opts *model.TeamSearch) (int64, error) {
func (s *TimerLayerTeamStore) AnalyticsPrivateTeamCount() (int64, error) {
start := timemodule.Now()
result, err := s.TeamStore.AnalyticsTeamCount(opts)
result, err := s.TeamStore.AnalyticsPrivateTeamCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.AnalyticsPrivateTeamCount", success, elapsed)
}
return result, err
}
func (s *TimerLayerTeamStore) AnalyticsPublicTeamCount() (int64, error) {
start := timemodule.Now()
result, err := s.TeamStore.AnalyticsPublicTeamCount()
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.AnalyticsPublicTeamCount", success, elapsed)
}
return result, err
}
func (s *TimerLayerTeamStore) AnalyticsTeamCount(includeDeleted bool) (int64, error) {
start := timemodule.Now()
result, err := s.TeamStore.AnalyticsTeamCount(includeDeleted)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -7095,10 +6829,10 @@ func (s *TimerLayerTeamStore) GetAllForExportAfter(limit int, afterID string) ([
return result, err
}
func (s *TimerLayerTeamStore) GetAllPage(offset int, limit int, opts *model.TeamSearch) ([]*model.Team, error) {
func (s *TimerLayerTeamStore) GetAllPage(offset int, limit int) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.GetAllPage(offset, limit, opts)
result, err := s.TeamStore.GetAllPage(offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -7127,6 +6861,38 @@ func (s *TimerLayerTeamStore) GetAllPrivateTeamListing() ([]*model.Team, error)
return result, err
}
func (s *TimerLayerTeamStore) GetAllPrivateTeamPageListing(offset int, limit int) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.GetAllPrivateTeamPageListing(offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllPrivateTeamPageListing", success, elapsed)
}
return result, err
}
func (s *TimerLayerTeamStore) GetAllPublicTeamPageListing(offset int, limit int) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.GetAllPublicTeamPageListing(offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllPublicTeamPageListing", success, elapsed)
}
return result, err
}
func (s *TimerLayerTeamStore) GetAllTeamListing() ([]*model.Team, error) {
start := timemodule.Now()
@@ -7143,6 +6909,22 @@ func (s *TimerLayerTeamStore) GetAllTeamListing() ([]*model.Team, error) {
return result, err
}
func (s *TimerLayerTeamStore) GetAllTeamPageListing(offset int, limit int) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.GetAllTeamPageListing(offset, limit)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("TeamStore.GetAllTeamPageListing", success, elapsed)
}
return result, err
}
func (s *TimerLayerTeamStore) GetByInviteId(inviteID string) (*model.Team, error) {
start := timemodule.Now()
@@ -7574,10 +7356,10 @@ func (s *TimerLayerTeamStore) SaveMultipleMembers(members []*model.TeamMember, m
return result, err
}
func (s *TimerLayerTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team, error) {
func (s *TimerLayerTeamStore) SearchAll(term string, opts *model.TeamSearch) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.SearchAll(opts)
result, err := s.TeamStore.SearchAll(term, opts)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -7590,10 +7372,10 @@ func (s *TimerLayerTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team,
return result, err
}
func (s *TimerLayerTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.Team, int64, error) {
func (s *TimerLayerTeamStore) SearchAllPaged(term string, opts *model.TeamSearch) ([]*model.Team, int64, error) {
start := timemodule.Now()
result, resultVar1, err := s.TeamStore.SearchAllPaged(opts)
result, resultVar1, err := s.TeamStore.SearchAllPaged(term, opts)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -7606,10 +7388,10 @@ func (s *TimerLayerTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.T
return result, resultVar1, err
}
func (s *TimerLayerTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team, error) {
func (s *TimerLayerTeamStore) SearchOpen(term string) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.SearchOpen(opts)
result, err := s.TeamStore.SearchOpen(term)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -7622,10 +7404,10 @@ func (s *TimerLayerTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team,
return result, err
}
func (s *TimerLayerTeamStore) SearchPrivate(opts *model.TeamSearch) ([]*model.Team, error) {
func (s *TimerLayerTeamStore) SearchPrivate(term string) ([]*model.Team, error) {
start := timemodule.Now()
result, err := s.TeamStore.SearchPrivate(opts)
result, err := s.TeamStore.SearchPrivate(term)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -10050,7 +9832,6 @@ func New(childStore store.Store, metrics einterfaces.MetricsInterface) *TimerLay
newStore.ProductNoticesStore = &TimerLayerProductNoticesStore{ProductNoticesStore: childStore.ProductNotices(), Root: &newStore}
newStore.ReactionStore = &TimerLayerReactionStore{ReactionStore: childStore.Reaction(), Root: &newStore}
newStore.RemoteClusterStore = &TimerLayerRemoteClusterStore{RemoteClusterStore: childStore.RemoteCluster(), Root: &newStore}
newStore.RetentionPolicyStore = &TimerLayerRetentionPolicyStore{RetentionPolicyStore: childStore.RetentionPolicy(), Root: &newStore}
newStore.RoleStore = &TimerLayerRoleStore{RoleStore: childStore.Role(), Root: &newStore}
newStore.SchemeStore = &TimerLayerSchemeStore{SchemeStore: childStore.Scheme(), Root: &newStore}
newStore.SessionStore = &TimerLayerSessionStore{SessionStore: childStore.Session(), Root: &newStore}