| 914 | } |
| 915 | |
| 916 | func (s daemonMemoryProviderService) Get( |
| 917 | ctx context.Context, |
| 918 | workspaceID string, |
| 919 | name string, |
| 920 | ) (contract.MemoryProviderPayload, error) { |
| 921 | if s.registry == nil { |
| 922 | return contract.MemoryProviderPayload{}, errors.New("daemon: memory provider registry is not configured") |
| 923 | } |
| 924 | active, activeErr := s.registry.Select(ctx, workspaceID, "") |
| 925 | if activeErr != nil && !isMemoryProviderNotFound(activeErr) { |
| 926 | return contract.MemoryProviderPayload{}, activeErr |
| 927 | } |
| 928 | registration, err := s.registry.Select(ctx, workspaceID, name) |
| 929 | if err != nil { |
| 930 | if isMemoryProviderNotFound(err) { |
| 931 | return contract.MemoryProviderPayload{}, fmt.Errorf("%w: %w", os.ErrNotExist, err) |
| 932 | } |
| 933 | return contract.MemoryProviderPayload{}, err |
| 934 | } |
| 935 | return memoryProviderPayload(registration, registration.Name == active.Name), nil |
| 936 | } |
| 937 | |
| 938 | func (s daemonMemoryProviderService) Select( |
| 939 | ctx context.Context, |