1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: Apache-2.0
11 "git.arvados.org/arvados.git/sdk/go/arvados"
14 // ErrNoManifest indicates the given collection has no manifest
15 // information (e.g., manifest_text was excluded by a "select"
16 // parameter when retrieving the collection record).
17 var ErrNoManifest = errors.New("Collection has no manifest")
19 // CollectionFileReader returns a Reader that reads content from a single file
20 // in the collection. The filename must be relative to the root of the
21 // collection. A leading prefix of "/" or "./" in the filename is ignored.
22 func (kc *KeepClient) CollectionFileReader(collection map[string]interface{}, filename string) (arvados.File, error) {
23 mText, ok := collection["manifest_text"].(string)
25 return nil, ErrNoManifest
27 fs, err := (&arvados.Collection{ManifestText: mText}).FileSystem(nil, kc)
31 return fs.OpenFile(filename, os.O_RDONLY, 0)