(ctx context.Context, id string)
| 53 | } |
| 54 | |
| 55 | func (s *containerStore) Get(ctx context.Context, id string) (containers.Container, error) { |
| 56 | namespace, err := namespaces.NamespaceRequired(ctx) |
| 57 | if err != nil { |
| 58 | return containers.Container{}, err |
| 59 | } |
| 60 | |
| 61 | container := containers.Container{ID: id} |
| 62 | |
| 63 | if err := view(ctx, s.db, func(tx *bolt.Tx) error { |
| 64 | bkt := getContainerBucket(tx, namespace, id) |
| 65 | if bkt == nil { |
| 66 | return fmt.Errorf("container %q in namespace %q: %w", id, namespace, errdefs.ErrNotFound) |
| 67 | } |
| 68 | |
| 69 | if err := readContainer(&container, bkt); err != nil { |
| 70 | return fmt.Errorf("failed to read container %q: %w", id, err) |
| 71 | } |
| 72 | |
| 73 | return nil |
| 74 | }); err != nil { |
| 75 | return containers.Container{}, err |
| 76 | } |
| 77 | |
| 78 | return container, nil |
| 79 | } |
| 80 | |
| 81 | func (s *containerStore) List(ctx context.Context, fs ...string) ([]containers.Container, error) { |
| 82 | namespace, err := namespaces.NamespaceRequired(ctx) |
no test coverage detected