MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetGroupMembersSnapshot

Method GetGroupMembersSnapshot

backend/store/group.go:393–413  ·  view source on GitHub ↗

GetGroupMembersSnapshot returns group members with snapshot reads (with cache). groupName format is "groups/{identifier}" where identifier can be an email or an ID. Trades consistency for performance.

(ctx context.Context, workspaceID string, groupName string)

Source from the content-addressed store, hash-verified

391// groupName format is "groups/{identifier}" where identifier can be an email or an ID.
392// Trades consistency for performance.
393func (s *Store) GetGroupMembersSnapshot(ctx context.Context, workspaceID string, groupName string) (map[string]bool, error) {
394 cacheKey := getGroupMembersCacheKey(workspaceID, groupName)
395 if v, ok := s.groupMembersCache.Get(cacheKey); ok {
396 return v, nil
397 }
398
399 group, err := s.GetGroupByName(ctx, workspaceID, groupName)
400 if err != nil {
401 return nil, err
402 }
403 if group == nil {
404 return nil, nil
405 }
406
407 members := make(map[string]bool)
408 for _, m := range group.Payload.GetMembers() {
409 members[m.Member] = true
410 }
411 s.groupMembersCache.Add(cacheKey, members)
412 return members, nil
413}
414
415func GetListGroupFilter(find *FindGroupMessage, filter string) (*qb.Query, error) {
416 if filter == "" {

Callers 3

CheckPermissionMethod · 0.80
countUsersInIamPolicyFunction · 0.80

Calls 4

GetGroupByNameMethod · 0.95
getGroupMembersCacheKeyFunction · 0.85
GetMethod · 0.80
GetMembersMethod · 0.45

Tested by

no test coverage detected