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

Method GetRoleSnapshot

backend/store/role.go:141–146  ·  view source on GitHub ↗

GetRoleSnapshot returns a role by ID with snapshot reads (with cache). Trades consistency for performance.

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

Source from the content-addressed store, hash-verified

139// GetRoleSnapshot returns a role by ID with snapshot reads (with cache).
140// Trades consistency for performance.
141func (s *Store) GetRoleSnapshot(ctx context.Context, workspaceID string, resourceID string) (*RoleMessage, error) {
142 if v, ok := s.rolesCache.Get(resourceID); ok {
143 return v, nil
144 }
145 return s.GetRole(ctx, &FindRoleMessage{Workspace: workspaceID, ResourceID: &resourceID})
146}
147
148// ListRoles returns a list of roles.
149func (s *Store) ListRoles(ctx context.Context, find *FindRoleMessage) ([]*RoleMessage, error) {

Callers 1

GetPermissionsMethod · 0.80

Calls 2

GetRoleMethod · 0.95
GetMethod · 0.80

Tested by

no test coverage detected